getaddrinfo(AF_UNSPEC,AI_PASSIVE) result order

Dimitrios Apostolou jimis@gmx.net
Fri Jun 7 19:50:00 GMT 2013


Hello list,

getaddrinfo(AF_UNSPEC, AI_PASSIVE) on my RHEL 6.3 system returns first 
0.0.0.0 and second ::0. However according to RFC 3484, paragraph 10.3:

     The default policy table gives IPv6 addresses higher precedence than
     IPv4 addresses. This means that applications will use IPv6 in
     preference to IPv4 when the two are equally suitable. An
     administrator can change the policy table to prefer IPv4 addresses by
     giving the ::ffff:0.0.0.0/96 prefix a higher precedence:

The glibc resolver precedence is changed by tweaking /etc/gai.conf, which 
is empty on this system. As a result my application listens only to 
IPv4, even though IPv6 loopback works as expected:

# ping6 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.237 ms


What am I missing?

Thanks,
Dimitris



More information about the Libc-help mailing list