I'm still having problems with HEAD this morning on os X (Darwin Kernel Version 6.6) - is that expected? (i'm not sure what the status is, but the above email implies a fix was applied).
(22)Invalid argument: make_sock: could not bind to address :80 no listening sockets available, shutting down
No, it's not expected. ;-)
But, here's what the problem is:
- We've disabled IPv6 across the board on Darwin because getnameinfo() doesn't do IPv6->IPv4 mapping correctly (my rough probably incorrect remembrance of the thread). The thread in question was from last October:
<http://groups.yahoo.com/group/new-httpd/message/40185>
- We're getting IPv6 addresses back from getaddrinfo() because, well, that's what getaddrinfo is supposed to return. The IPv6 addresses are returned back to alloc_listener.
- APR_HAVE_IPV6 is 0, so the apr_sockaddr_t doesn't contain the sin6 field in the union.
- You'll notice that the 22 is EINVAL (*not* EHOSTUNREACH). That's because the sockaddr_in6 that we copied from getaddrinfo's return list is corrupted.
So, a few suggestions:
- Trim IPv6 addresses from getaddrinfo()'s return values if APR_HAVE_IPV6 is 0. (Perhaps only allow PF_INET sockets values to go in there.)
- Re-enable IPv6 on Darwin, and try to come up with a better solution to the problem proposed last October. (I proposed this before, but no one was interested.)
And, I'm not sure if this is expected or not, but binding to the IPv6 address on my Darwin box does *not* bind to the IPv4 interface. In order to do that, we'd have to bind to each address returned from getaddrinfo(). But, we'll only bind to the first one. I think that's wrong. Or, perhaps binding to the IPv6 interface is supposed to bind to the IPv4 interface, but my tests on Darwin don't show that to hold. Try out:
http://www.apache.org/~jerenkrantz/getaddr.c
This IPv6 code is just a complete mess. -- justin
