Hi,

On Sat, Jan 11, 2014 at 11:01:58AM +0100, Tore Anderson wrote:
> > I *thought* that both proto udp and proto udp6 would create an IPv6 socket
> > bound to :: with IPV6_V6ONLY set to 0 (= accepting IPv4 and IPv6 packets
> > to any address).  Only "proto udp4" should listen to 0.0.0.0.
> 
> This is not how git master behaves for me. "proto udp" and "proto udp4"
> both yield an IPv4-only socket (AF_INET):

Mmmh.  Right you are, at least on *Linux*...

"proto upd6" gives an udp6/TYPE=IPv6 socket, while "proto udp" gives
an udp/TYPE=IPv4 socket, on my Gentoo system (and this is not an artifact
from netstat or lsof, but it really only listens on 0.0.0.0)...

Sat Jan 11 12:27:35 2014 us=883703   proto = udp
Sat Jan 11 12:27:35 2014 us=883794   local = '[UNDEF]'
Sat Jan 11 12:27:35 2014 us=883885   local_port = '61194'
Sat Jan 11 12:27:35 2014 us=912736 UDP link local (bound): 
[AF_INET][undef]:61194


When I tested that, I used a FreeBSD system, which behaves differently - 
there, "proto udp" gives the same result as "proto udp6", and you need to do
"proto udp4" to get an IPv4-only socket...

Sat Jan 11 12:11:44 2014 us=286820   proto = udp
Sat Jan 11 12:11:44 2014 us=286849   local = '[UNDEF]'
Sat Jan 11 12:11:44 2014 us=286877   local_port = '51194'
Sat Jan 11 12:11:44 2014 us=383743 UDP link local (bound): 
[AF_INET6][undef]:51194

$ netstat -an |grep 1194
udp46      0      0 *.51194                *.* 


I do think I know where the problem is coming from (or, more precise, Arne
mentioned this a while ago already) - Arne's new code uses getaddrinfo()
with AI_PASSIVE to get "something suitable for listening on", and Linux' 
getaddrinfo() seems to return INADDR_ANY before IN6ADDR_ANY, which is 
arguably a pretty stupid thing to do... and yes, I think that we should
workaround this.


> I can submit a separate bug
> report about this if you wish. That said, I would be perfectly happy to
> simply use "proto udp6" instead, IFF "multihome" had worked correctly.

Our documentation says that "proto udp" or "proto tcp[-server]" is "use
dual-stack", so it should better do that, correctly on all platforms.

Bug opened, #360, and assigned to Arne.  Thanks for telling us.

gert

-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Attachment: pgp8vX67JDivU.pgp
Description: PGP signature

Reply via email to