Bug#684794: getaddrinfo sorts IPv4 before IPv6
Package: libc6
Version: 2.13-35
Severity: normal
Tags: ipv6
Hi,
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.
Here's an example:
$ 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
I see the same behavior in chromium and iceweasel. If I go to
http://ip6.me/, I see my IPv4 address instead of my IPv6 address. If I
click "IPv6 only Test" I get my IPv6 address
(http://ipv6.whatismyv6.com/).
My ifconfig output looks like this:
eth0 Link encap:Ethernet HWaddr 00:24:81:18:a7:9e
inet addr:192.168.1.195 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 2002:d567:c828:1:224:81ff:fe18:a79e/64 Scope:Global
inet6 addr: fe80::224:81ff:fe18:a79e/64 Scope:Link
That is, I have a NAT'ed IPv4 address and a global (non-NAT'ed) 6to4
IPv6 address. The actual 6to4 relaying is done by my router.
ping6 and browsing IPv6-only domains (e.g., ipv6.google.com) work fine.
I have not modified /etc/gai.conf which is empty (except for comments).
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Foreign Architectures: amd64
Kernel: Linux 3.2.0-3-686-pae (SMP w/2 CPU cores)
Locale: LANG=sv_SE.utf8, LC_CTYPE=sv_SE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libc6 depends on:
ii libc-bin 2.13-35
ii libgcc1 1:4.7.1-6
Versions of packages libc6 recommends:
ii libc6-i686 2.13-35
Versions of packages libc6 suggests:
ii debconf [debconf-2.0] 1.5.45
pn glibc-doc <none>
ii locales 2.13-35
-- debconf information excluded
Reply to: