Bug#582916: libc6: getaddrinfo() returns EAI_NONAME for temporary problem.
see the same here under specific circumstances: to reproduce the following test (see also the comments): /*BINFMTC: test for getaddrinfo bug: getaddrinfo returns EAI_NONAME when it should return EAI_EAGAIN getaddrinfo returns EAI_NONAME when it should return EAI_EAGAIN for hosts with A but no record and there is packet loss and/or a an overloaded dns server to easily reproduce, fake packet loss/overloaded dns server on linux do something like: # iptables -I OUTPUT -p udp -m udp --dport 53 -j DROP # iptables -I OUTPUT -p udp -m udp --dport 53 -j LOG --log-prefix DROP DNS REQUEST # iptables -I OUTPUT -p udp -m udp --dport 53 -m limit --limit 10/sec -j ACCEPT first */ #include sys/types.h #include sys/socket.h #include netdb.h #include stdio.h #include stdlib.h struct addrinfo hints; // all 0 int main(int argc, char** argv) { struct addrinfo* res; int i; hints.ai_family = AF_INET; /* should work on mosts setups (there is another bug involving mdns if it fails try to replace the hosts line in /etc/nsswitch.conf with something like: hosts: files dns ) */ for(i=0;i1000;++i) { /* test host must have a A record but no record */ int r=getaddrinfo(karme.de,0,hints,res); if(!((r==0)||(r==EAI_AGAIN))) { printf(%s:%d: error: r=%d %s\n,__FILE__,__LINE__,r,gai_strerror(r)); exit(EXIT_FAILURE); } if (!r) freeaddrinfo(res); } /* this will fail sometimes what happens? DNS request for A record is sent but no answer is received DNS request for record is sent and answer without entries received now getaddrinfo returns EAI_NONAME when in fact it should return EAI_AGAIN */ hints.ai_family = AF_UNSPEC; for(i=0;i1000;++i) { int r=getaddrinfo(karme.de,0,hints,res); if(!((r==0)||(r==EAI_AGAIN))) { printf(%s:%d: error: r=%d %s\n,__FILE__,__LINE__,r,gai_strerror(r)); exit(EXIT_FAILURE); } if (!r) freeaddrinfo(res); } return EXIT_SUCCESS; } -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87zk3131zl@karme.de
Bug#582916: Info received (Bug#582916: libc6: getaddrinfo() returns EAI_NONAME for temporary problem.)
updated test: /*BINFMTC: -Wall -Wextra -Wno-unused-parameter test for getaddrinfo bug: getaddrinfo returns EAI_NONAME when it should return EAI_EAGAIN getaddrinfo returns EAI_NONAME when it should return EAI_EAGAIN for hosts with A but no record and there is packet loss and/or a an overloaded dns server to easily reproduce, fake packet loss/overloaded dns server on linux do something like: # iptables -I OUTPUT -p udp -m udp --dport 53 -j DROP # iptables -I OUTPUT -p udp -m udp --dport 53 -j LOG --log-prefix DROP DNS REQUEST # iptables -I OUTPUT -p udp -m udp --dport 53 -m limit --limit 10/sec -j ACCEPT first */ #include sys/types.h #include sys/socket.h #include netdb.h #include stdio.h #include stdlib.h /* test host must have a A record but no record also note the final dot - otherwise a search entry in resolv.conf might cause the first test to fail, too */ const char* host=karme.de.; struct addrinfo hints; // all 0 int main(int argc, char** argv) { struct addrinfo* res; int i; hints.ai_family = AF_INET; /* first test should work on mosts setups (there is another bug involving mdns if it fails try to replace the hosts line in /etc/nsswitch.conf with something like: hosts: files dns ) */ for(i=0;i1000;++i) { int r=getaddrinfo(host,0,hints,res); if(!((r==0)||(r==EAI_AGAIN))) { printf(%s:%d: error: r=%d %s\n,__FILE__,__LINE__,r,gai_strerror(r)); exit(EXIT_FAILURE); } if (!r) freeaddrinfo(res); } /* second test will fail sometimes what happens? DNS request for A record is sent but no answer is received DNS request for record is sent and answer without entries received now getaddrinfo returns EAI_NONAME when in fact it should return EAI_AGAIN */ hints.ai_family = AF_UNSPEC; for(i=0;i1000;++i) { int r=getaddrinfo(host,0,hints,res); if(!((r==0)||(r==EAI_AGAIN))) { printf(%s:%d: error: r=%d %s\n,__FILE__,__LINE__,r,gai_strerror(r)); exit(EXIT_FAILURE); } if (!r) freeaddrinfo(res); } return EXIT_SUCCESS; } -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87sj8t1llo@karme.de
Bug#582916: libc6: getaddrinfo() returns EAI_NONAME for temporary problem.
similar report upstream: http://sourceware.org/bugzilla/show_bug.cgi?id=12994 -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87pq3xz4sw.fsf...@karme.de
Bug#582916: libc6: getaddrinfo() returns EAI_NONAME for temporary problem.
Package: libc6 Version: 2.10.2-6 Severity: important Hi, It seems that getaddrinfo() now returns EAI_NONAME for a non-permanent error. Trying to resolve something using host or dig, I get as error: ;; connection timed out; no servers could be reached That is clearly different that an error message like: Host host not found: 3(NXDOMAIN) For that error I would expect to get EAI_NONAME. In case I don't get a reply, I would expect to get back EAI_AGAIN. The version in lenny still returns EAI_AGAIN. Kurt -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20100524141000.ga16...@roeckx.be