On Wed, Feb 23, 2005 at 07:37:54AM -0800, Justin Erenkrantz wrote:
> --On Wednesday, February 23, 2005 9:42 AM +0000 Joe Orton 
> <[EMAIL PROTECTED]> wrote:
> 
> >But there is no way to differentiate between any different interfaces
> >for the address (without doing magic), so I would say that is a resolver
> >misfeature.
> 
> But, the resolver was explicitly told that the socket addresses will be 
> used to connect() - not for bind().  That's why I'm not convinced this 
> behavior is 'wrong' per se.

A connect() to 0.0.0.0:80 is just the same; I don't see why it would
ever be useful to include two completely identical addresses in the
getaddrinfo results.

Simply passing AI_PASSIVE does make it omit the duplicates?
(http://cvs.apache.org/~jorton/gai.c is useful for testing getaddrinfo
behaviour)

> >to configure httpd to bind only to "all IPv4 addresses on the local host
> >with port X" (right?), which is certainly a valid and useful thing to
> >do.
> >
> >I think httpd should work around this: does something like the attached
> >work? (tested only to compile ;) Not necessarily the best place to put
> >this logic.
> 
> It seems that we should have a better internal semantic than passing in a 
> bogus address to connect to.  Perhaps httpd in alloc_listener should 
> intercept the '0.0.0.0' case and set the hostname to NULL and set the 
> family to IPv4? This would preserve the correct internal semantics we're 
> looking for such that AI_PASSIVE can be set so we get bind()able addresses.
> 
> Would that be better?  -- justin

INADDR_ANY is not really a bogus address, but yes I think that does make
more sense.  It would also need to translate "::" into
hostname=NULL+family=AF_INET6 for consistency I suppose.  But triggering
the AI_PASSIVE path is generally desirable.

Do you have time to try that out?

joe

Reply via email to