Bug#684794: getaddrinfo sorts IPv4 before IPv6
On Mon, Aug 13, 2012 at 10:54:28PM +0200, Per Olofsson wrote:
> I recently configured IPv6 connectivity on my system using 6to4 on my
> router. It works, except that getaddrinfo() sorts IPv4 addresses
> before IPv6 addresses, which means that IPv4 is used if the remote
> host has both IPv4 and IPv6.
This is expected behaviour if you are using 2002::/16 addresses:
| Rule 7: Prefer native transport.
| If DA is reached via an encapsulating transition mechanism (e.g.,
| IPv6 in IPv4) and DB is not, then prefer DB. Similarly, if DB
| is reached via encapsulation and DA is not, then prefer DA.
> $ getent ahosts www.debian.org
> 86.59.118.148 STREAM www.debian.org
> 86.59.118.148 DGRAM
> 86.59.118.148 RAW
> 2001:858:2:2:214:22ff:fe0d:7717 STREAM
> 2001:858:2:2:214:22ff:fe0d:7717 DGRAM
> 2001:858:2:2:214:22ff:fe0d:7717 RAW
| $ getent ahosts www.debian.org
| 2001:858:2:2:214:22ff:fe0d:7717 STREAM www.debian.org
| 2001:858:2:2:214:22ff:fe0d:7717 DGRAM
| 2001:858:2:2:214:22ff:fe0d:7717 RAW
| 86.59.118.148 STREAM
| 86.59.118.148 DGRAM
| 86.59.118.148 RAW
Bastian
--
Vulcans do not approve of violence.
-- Spock, "Journey to Babel", stardate 3842.4
Reply to: