tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: connect to 0.0.0.0 vs ::



On Fri, Feb 13, 2015 at 09:37:06AM -0800, Dennis Ferguson wrote:
> I wouldn't have expected this to work for either protocol.  The only
> standard use of 0.0.0.0 and :: is as a source address, never a
> destination (though standards for on-the-wire behaviour don't
> necessarily dictate what goes on inside a host), while 127.0.0.1
> and ::1 are explicitly meant to be used for this so I don't quite
> get why it would want to use something else.  I'm struggling to
> think of a problem that allowing this behaviour would solve.

It's lasyness from the apache developers I guess.
But connecting to 127.0.0.1 or ::1 isn't guaranteed to work either:
the httpd server may listen on a public address but not on the localhost
addresses, depending on what's in the configuration.

What they to is to connect to one of the listen address (the last one from
the list it seems). You can specify the listen address as 0.0.0.0 or ::,
if you don't want to restrict to a speicific address. The apache 
developers assume using this as destination address will also connect to
one of the local addresses.

> 
> Is this a linux-ism and, if so, can you tell what it actually does
> with the address?  In particular, if you open a connection to 0.0.0.0
> and then look for the connection in netstat output does it show a
> connection to 0.0.0.0 or does it translate the address to a "real"
> local address before connecting?

linux translates to 127.0.0.1 or ::1, so does NetBSD with 0.0.0.0.
But on NetBSD, :: is not translated to ::1.

> 
> It would be nice to know if this use actually needs to be supported
> now, and if so how, since if I had noticed this working I think I
> would have taken it to be a bug and fixed it.

If you remove it you'll have to fix apache at last.
Right now it's broken for v6 addresses, but a workaround it to use
Listen [::]:80
Listen 0.0.0.0:80

instead of
Listen 0.0.0.0:80
Listen [::]:80

(i.e. but the wilcard v4 address last)

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index