Up until glibc 2.8, this would work and return the IPv4 address: struct addrinfo hints, *ai, *aitop; int err; char *host=strdup("www.google.com"); char *port=strdup("80"); memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; err=getaddrinfo(host, port, &hints, &aitop); if(err) fprintf(stderr, "Error: %s", strerror(err)); In glibc 2.9, it returns Error: Name or service not known Changing hints.ai_family to PF_INET makes it work with glibc 2.9. I'm not sure which behavior is correct, but 2.9's does break a few applications (ncftp for one). This is on an IPv4 machine (with an IPv6 address for localhost set); nsswitch.conf has "hosts: files mdns dns"
This works as before in 2.9 for hostnames that are listed in /etc/hosts; it only fails if it has to look up stuff on the DNS. The DNS itself works (applications that don't use getaddrinfo(), such as host, ping, konqueror, firefox, ... keep working).
What nameserver are you using? Most likely a DNS server bug.
The DNS is the internal DNS of a Netopia 3346N-VGx DSL modem, revision 7.7.4r1. Modifying /etc/resolv.conf to point at a Linux box running bind 9.5.x does fix it. A workaround is probably needed though, Netopia 3346N-VGx DSL modems come with every Swisscom DSL line for free...
Created attachment 3084 [details] Patch that fixes it by reverting to 2.8 behavior The attached patch fixes it by reverting most of getaddrinfo.c to what it was in glibc 2.8 -- not quite the right thing to do, but I can confirm it fixes the problem.
I'm also facing this bug when using the Hotbrick LB2 as DNS server. Disabling ipv6 on my system fixes this problem. Installing a local recursor like pdns-recursor also fixes this issue, so it's related to broken DNS servers. with pdns-recursor: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21282 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;redhat.com. IN AAAA ;; AUTHORITY SECTION: redhat.com. 600 IN SOA ns1.redhat.com. noc.redhat.com. 2008112502 3600 1800 604800 86400 Result with Hotbrick LB2: ;; ->>HEADER<<- opcode: QUERY, status: NOTIMP, id: 51617 ;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;redhat.com. IN AAAA The hotbrick LB2 returns NOTIMP, which violates the RFC.
Note that a simpler workaround is to just disable the gethostbyname4() lookup method being exported, as Jakub Jelinek did for Fedora (and me doing for SUSE now): http://pasky.or.cz/~pasky/dev/glibc/glibc-2.10-dns-no-gethostbyname4.diff
Also note that it is just a temporary measure, Ulrich plans to work on the resolv code soon.
Should be fixed in 2.10.
Have to got this amazing post online here just follow and look at here http://freevbucks-generator.mystrikingly.com latest v bucks game zone start to play it ans i wish you have to a batter score