Package: libc6 Version: 2.13-4 Severity: normal
If there are multiple nameservers in /etc/resolv.conf and the first of them refuses DNS queries for some domains, getaddrinfo will fail while gethostbyname succeeds. This can result in VERY mysterious that-shouldn't-happen problems: - host works - ping works - browser works - ssh and various other "properly written" apps fail Example: $ cat /etc/resolv.conf # Generated by NetworkManager nameserver 10.8.0.1 <- my VPN DNS server (any DNS server without recursion) nameserver 192.168.43.1 <- my phone company's server $ host bitbucket.org bitbucket.org has address 207.223.240.182 bitbucket.org has address 207.223.240.181 bitbucket.org mail is handled by 5 alt1.aspmx.l.google.com. bitbucket.org mail is handled by 5 alt2.aspmx.l.google.com. bitbucket.org mail is handled by 10 aspmx2.googlemail.com. bitbucket.org mail is handled by 10 aspmx3.googlemail.com. bitbucket.org mail is handled by 1 aspmx.l.google.com. $ host bitbucket.org 10.8.0.1 Using domain server: Name: 10.8.0.1 Address: 10.8.0.1#53 Aliases: Host bitbucket.org not found: 5(REFUSED) $ ping -c 1 bitbucket.org PING bitbucket.org (207.223.240.182) 56(84) bytes of data. 64 bytes from 207.223.240.182: icmp_req=1 ttl=50 time=316 ms --- bitbucket.org ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 316.571/316.571/316.571/0.000 ms $ ssh bitbucket.org ssh: Could not resolve hostname bitbucket.org: Name or service not known $ python >>> import socket >>> socket.gethostbyname("bitbucket.org") '207.223.240.181' >>> socket.getaddrinfo("bitbucket.org", 80, 10) Traceback (most recent call last): File "<stdin>", line 1, in <module> socket.gaierror: [Errno -5] No address associated with hostname I've used ltrace to verify that Python is calling getaddrinfo directly and that it fails. Swapping the order of DNS servers makes the above test succeed. Desired behavior: getaddrinfo() should have EXACTLY the same robust DNS resolution algorithm as gethostbyname() to avoid mysterious, hard-to-diagnose application-dependent failure modes. -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.39+ (SMP w/4 CPU cores) Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libc6 depends on: ii libc-bin 2.13-4 Embedded GNU C Library: Binaries ii libgcc1 1:4.6.0-10 GCC support library libc6 recommends no packages. Versions of packages libc6 suggests: ii debconf [debconf-2.0] 1.5.39 Debian configuration management sy pn glibc-doc <none> (no description available) ii locales 2.13-4 Embedded GNU C Library: National L -- debconf information excluded -- Mathematics is the supreme nostalgia of our time. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org