httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colm MacCarthaigh <c...@stdlib.net>
Subject 2.1 Listen Broken [Was Re: Darwin and IPv6]
Date Sun, 24 Aug 2003 03:31:07 GMT
On Thu, Aug 14, 2003 at 03:47:09PM -0700, Justin Erenkrantz wrote:
> I've got the patch to do multiple listeners off one Listen directive in my 
> tree and tested, but I'm currently swamped with other stuff.

Now that it's been commited, I've been trying it out and it's broken :(

Right now, httpd won't even start for me on Linux. The first problem 
is that the order of the getaddrinfo() result set is ignored. This is most
definitely not a good idea, the order is intentional. It's the only
way listening will ever work on an OS that does not support IPv6 only
sockets :)

The next problem is that v6only_setting=0 is now handled incorrectly,
with the result that we generate an addressing conflict. Right now
(after fixing the order) it tries to listen on :: which works,
and then on 0.0.0.0, which doesnt ... on platforms that don't support
V6ONLY sockets (Linux is one, but there are more).

Here's what should happen when we try to listen on all interfaces:

   1.  call getaddrinfo with PF_UNSPEC and AI_PASSIVE, get
       :: and 0.0.0.0 back in that order.

   2.  try to create a socket on ::, don't scream too loudly if it
       doesnt work.

   3.  try to set it to IPv6 only, don't scream too loudly if it
       doesnt work. 

   4.  Try to bind() and listen() to it, don't scream too loudly
       if it doesnt work.

   5.1 If 2 and 4 were successful, but 3 wasnt; Don't even try to 
       listen on 0.0.0.0.

   5.2 Otherwise try to listen on 0.0.0.0 and bomb out on error.

Now unfortunately listen.c isnt structured to make this logic easy to
implement, the only easy place to remove 0.0.0.0 from the listeners
list is alloc_listener(), but the only place to test part 4 is 
make_sock(), bummer. Solution; compromise and put it in ap_listen_open.

So, attachted is a best-effort patch which should solve the 
problems. I've tried to make it as readable as possible but
inevitably it's going to be a bit convoluted within the current
design. But that said, I think it strikes a reasonable compromise.

With the patch applied, Linux now works :)

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net
colm@stdlib.net					  http://www.stdlib.net/

Mime
View raw message