On Thu, Aug 14, 2003 at 09:14:35AM -0700, Justin Erenkrantz wrote: > - 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.)
Both these things really need to happen. The first is relatively trivial: Index: sockaddr.c =================================================================== RCS file: /home/cvspublic/apr/network_io/unix/sockaddr.c,v retrieving revision 1.40 diff -u -r1.40 sockaddr.c --- sockaddr.c 14 Aug 2003 00:09:28 -0000 1.40 +++ sockaddr.c 14 Aug 2003 16:39:47 -0000 @@ -599,6 +599,9 @@ if (flags & APR_IPV6_ADDR_OK) { return APR_ENOTIMPL; } + if (family == AF_UNSPEC) { + family = AF_INET: + } #endif } .. or similar. The darwin one is complicated, but I know of at least 3 people running Apache on Darwin for months, all they've been doing is changing v6_broken to 0 in the apr configure script ;) Until a truly AF agnostic ACL implementation can be used (see http://www.stdlib.net/~colmmacc/nsd/subnet.h and the accomponying subnet.c for a rough idea) the Darwin problem should be solveable by checking the IN6_IS_ADDR_V4MAPPED macro, and if so ignoring the first 96 bytes and passing the last 32 on. > 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(). This is the bug I was trying to get accross (badly) the day before yesterday. The fact that getaddrinfo returns a linked list is pretty much ignored by alloc_listener :( > Try out: > > http://www.apache.org/~jerenkrantz/getaddr.c That has a a bug of it's own :) --- getaddr.c Thu Aug 14 17:12:10 2003 +++ getaddr-new.c Thu Aug 14 17:58:22 2003 @@ -2,6 +2,7 @@ #include <sys/socket.h> #include <netdb.h> #include <sys/errno.h> +#include <strings.h> int main() { struct addrinfo hints, *res, *res0; @@ -42,7 +43,7 @@ s = -1; continue; } - if (accept(s, &client, &addrlen) < 0) { + if (accept(s, res->ai_addr, &res->ai_addrlen) < 0) { cause = "accept"; printf("%s %d\n", cause, errno); close(s); -- Colm MacCárthaigh Public Key: [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.stdlib.net/