[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Patch: IPv6 support for evhttp_bind_socket*



On Thu, Oct 22, 2009 at 11:22:12PM -0500, Ryan Phillips wrote:
> With this patch evhttp_bind_socket will use IPv6 sockets as well as
> IPv4 sockets for the ANY address or use the corresponding address
> passed into the second parameter of evhttp_bind_socket. This patch
> only modifies the code path where _EVENT_HAVE_GETADDRINFO is defined.
> A longer term and more robust solution should setup listening sockets
> on all addresses returned by getaddrinfo().

Hi!  Did you try running the unit tests with this?  When I tried this
patch, it made all the HTTP unit tests crash on this line in
bind_socket_ai():

  fd = socket(ai->ai_family, SOCK_STREAM, 0);

It turns out that bind_socket_ai can be called with ai==NULL, to
indicate "bind to the default address."

Instead, I'd suggest that the line be something like

  fd = socket(ai ? ai->ai_family : AF_INET, SOCK_STREAM, 0);

Does that work for you?A

yrs,
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.