Bug 573904

Summary: getaddrinfo failing with 'Temporary failure in name resolution' while nslookup is succeeding
Product: [Fedora] Fedora Reporter: Tim Long <timwarm>
Component: glibcAssignee: Andreas Schwab <schwab>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: jakub, schwab
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: glibc-2.11.1-4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-04-10 10:24:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tim Long 2010-03-16 04:42:24 UTC
Description of problem:

On our network certain applications on the Fedora 12 computers can not resolve a specific host. They return the DNS error message 'Temporary failure in name resolution'. But doing a nslookup/dig of the host returns the IP address successfully.

I have written a simple C application that queries for the IP address of the host is question using the two system calls gethostbyname and getaddrinfo. gethostbyname succeeds but getaddrinfo fails. The program output is:

$ ./testDNS www
Getting DNS info for host: www
Trying gethostbyname
hosent details:
h_name: www.bom.gov.au
h_aliases:

h_addrtype: 2
h_length:4
h_addr_list:
210.8.186.60 

Trying getaddrinfo
Error returned by getaddrinfo: Temporary failure in name resolution
$

This application sets very minimal arguments for struct addrinfo:

memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;    /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM; /* Datagram socket */
hints.ai_flags = 0;
hints.ai_protocol = 0;          /* Any protocol */

The DNS server being queried is a Windows box. If I set the computer to use a backup Unix DNS server on the network the problem disappears.

Additional Information:

Perform a dig for the bad host from the default Windows DNS server returns the following: 

$ dig www.bom.gov.au

; <<>> DiG 9.6.1-P3-RedHat-9.6.1-16.P3.fc12 <<>> www.bom.gov.au
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5080
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.bom.gov.au.			IN	A

;; ANSWER SECTION:
www.bom.gov.au.		13	IN	A	210.8.186.60

;; Query time: 2 msec
;; SERVER: 134.178.14.1#53(134.178.14.1)
;; WHEN: Tue Mar 16 15:23:45 2010
;; MSG SIZE  rcvd: 48

$

Querying the backup Unix DNS server returns the following:

$ dig @134.178.6.5 www.bom.gov.au

; <<>> DiG 9.6.1-P3-RedHat-9.6.1-16.P3.fc12 <<>> @134.178.6.5 www.bom.gov.au
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64932
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;www.bom.gov.au.			IN	A

;; ANSWER SECTION:
www.bom.gov.au.		20	IN	A	210.8.42.125

;; AUTHORITY SECTION:
www.bom.gov.au.		600	IN	NS	bom-aapt-scss.bom.gov.au.
www.bom.gov.au.		600	IN	NS	bom-aapt-pcss.bom.gov.au.

;; ADDITIONAL SECTION:
bom-aapt-pcss.bom.gov.au. 600	IN	A	210.8.186.42
bom-aapt-scss.bom.gov.au. 600	IN	A	210.8.42.106

;; Query time: 6 msec
;; SERVER: 134.178.6.5#53(134.178.6.5)
;; WHEN: Tue Mar 16 15:38:17 2010
;; MSG SIZE  rcvd: 136

$

Comment 1 Andreas Schwab 2010-03-16 13:08:27 UTC
The server is handing out corrupted answers.

Comment 2 Andreas Schwab 2010-03-16 15:23:21 UTC
The broken debug statements have confused me.

Comment 3 Fedora Update System 2010-03-19 08:46:58 UTC
glibc-2.11.1-4 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/glibc-2.11.1-4

Comment 4 Fedora Update System 2010-03-23 02:22:11 UTC
glibc-2.11.1-4 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update glibc'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/glibc-2.11.1-4

Comment 5 Tim Long 2010-03-24 00:06:12 UTC
I managed to test this fix today. It doesn't solve the problem. 

Though I now get a new error message from getaddrinfo:

$ ./testDNS www.bom.gov.au
Getting DNS info for host: www.bom.gov.au
Trying gethostbyname
hosent details:
h_name: www.bom.gov.au
h_aliases:

h_addrtype: 2
h_length:4
h_addr_list:
210.8.42.125 

Trying getaddrinfo
Error returned by getaddrinfo: Name or service not known
$

Also this is on a x86_64 host. I will see if I can find a x386 host to test.

Also of note I have managed to test some RHEL4 and RHEL5 boxes pointing at the same DNS servers. They don't have this issue.

Comment 6 Andreas Schwab 2010-03-24 09:02:04 UTC
That's correct, the name server is not usable.

Comment 7 Tim Long 2010-03-25 00:42:28 UTC
I have tried running tcpdump when running the test code.

It appears that the computer is confused by the response to the AAAA query it makes to the server:

./testDNS www.bom.gov.au
Getting DNS info for host: www.bom.gov.au

Trying getaddrinfo
Error returned by getaddrinfo: Temporary failure in name resolution
-------

# tcpdump -v host 134.178.14.1 and port 53
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
09:48:53.145828 IP (tos 0x0, ttl 64, id 8631, offset 0, flags [DF], proto UDP (17), length 60)
    mdtlap35985.bom.gov.au.39474 > bom1.bom.gov.au.domain: 32942+ A? www.bom.gov.au. (32)
09:48:53.145850 IP (tos 0x0, ttl 64, id 8632, offset 0, flags [DF], proto UDP (17), length 60)
    mdtlap35985.bom.gov.au.39474 > bom1.bom.gov.au.domain: 55927+ AAAA? www.bom.gov.au. (32)
09:48:53.146290 IP (tos 0x0, ttl 127, id 25348, offset 0, flags [none], proto UDP (17), length 76)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.39474: 32942 1/0/0 www.bom.gov.au. A 210.8.42.125 (48)
09:48:53.146349 IP (tos 0x0, ttl 64, id 8632, offset 0, flags [DF], proto UDP (17), length 71)
    mdtlap35985.bom.gov.au.59548 > bom1.bom.gov.au.domain: 11934+ PTR? 1.14.178.134.in-addr.arpa. (43)
09:48:53.146732 IP (tos 0x0, ttl 127, id 25351, offset 0, flags [none], proto UDP (17), length 100)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.59548: 11934* 1/0/0 1.14.178.134.in-addr.arpa. PTR bom1.bom.gov.au. (72)
09:48:53.146858 IP (tos 0x0, ttl 64, id 8632, offset 0, flags [DF], proto UDP (17), length 72)
    mdtlap35985.bom.gov.au.57124 > bom1.bom.gov.au.domain: 15556+ PTR? 186.8.178.134.in-addr.arpa. (44)
09:48:53.147270 IP (tos 0x0, ttl 127, id 25353, offset 0, flags [none], proto UDP (17), length 127)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.57124: 15556* 2/0/0 186.8.178.134.in-addr.arpa. PTR mdtlap35985.bom.gov.au., 186.8.178.134.in-addr.arpa. PTR timl.bom.gov.au. (99)
09:48:53.149836 IP (tos 0x0, ttl 127, id 25361, offset 0, flags [none], proto UDP (17), length 60)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.39474: 55927- 0/0/0 (32)
09:48:53.155834 IP (tos 0x0, ttl 64, id 8641, offset 0, flags [DF], proto UDP (17), length 60)
    mdtlap35985.bom.gov.au.54284 > bom1.bom.gov.au.domain: 32942+ A? www.bom.gov.au. (32)
09:48:53.155889 IP (tos 0x0, ttl 64, id 8642, offset 0, flags [DF], proto UDP (17), length 60)
    mdtlap35985.bom.gov.au.54284 > bom1.bom.gov.au.domain: 55927+ AAAA? www.bom.gov.au. (32)
09:48:53.156282 IP (tos 0x0, ttl 127, id 25376, offset 0, flags [none], proto UDP (17), length 76)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.54284: 32942 1/0/0 www.bom.gov.au. A 210.8.42.125 (48)
09:48:53.159260 IP (tos 0x0, ttl 127, id 25385, offset 0, flags [none], proto UDP (17), length 60)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.54284: 55927- 0/0/0 (32)
09:48:53.162938 IP (tos 0x0, ttl 64, id 8649, offset 0, flags [DF], proto UDP (17), length 71)
    mdtlap35985.bom.gov.au.36312 > bom1.bom.gov.au.domain: 10990+ A? www.bom.gov.au.bom.gov.au. (43)
09:48:53.162952 IP (tos 0x0, ttl 64, id 8650, offset 0, flags [DF], proto UDP (17), length 71)
    mdtlap35985.bom.gov.au.36312 > bom1.bom.gov.au.domain: 10867+ AAAA? www.bom.gov.au.bom.gov.au. (43)
09:48:53.163512 IP (tos 0x0, ttl 127, id 25396, offset 0, flags [none], proto UDP (17), length 133)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.36312: 10867 NXDomain* 0/1/0 (105)
09:48:53.163523 IP (tos 0x0, ttl 127, id 25397, offset 0, flags [none], proto UDP (17), length 133)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.36312: 10990 NXDomain* 0/1/0 (105)

--------------------------

Modifying the test code to query for just AAAA records returns this:

./testDNSip6 www.bom.gov.au
Getting DNS info for host: www.bom.gov.au

Trying getaddrinfo
Error returned by getaddrinfo: Name or service not known

-----------

# tcpdump -v host 134.178.14.1 and port 53
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
10:50:59.947897 IP (tos 0x0, ttl 64, id 26943, offset 0, flags [DF], proto UDP (17), length 60)
    mdtlap35985.bom.gov.au.53792 > bom1.bom.gov.au.domain: 36634+ AAAA? www.bom.gov.au. (32)
10:50:59.948406 IP (tos 0x0, ttl 64, id 26943, offset 0, flags [DF], proto UDP (17), length 71)
    mdtlap35985.bom.gov.au.50594 > bom1.bom.gov.au.domain: 17652+ PTR? 1.14.178.134.in-addr.arpa. (43)
10:50:59.948737 IP (tos 0x0, ttl 127, id 13217, offset 0, flags [none], proto UDP (17), length 100)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.50594: 17652* 1/0/0 1.14.178.134.in-addr.arpa. PTR bom1.bom.gov.au. (72)
10:50:59.948867 IP (tos 0x0, ttl 64, id 26944, offset 0, flags [DF], proto UDP (17), length 72)
    mdtlap35985.bom.gov.au.53805 > bom1.bom.gov.au.domain: 16531+ PTR? 186.8.178.134.in-addr.arpa. (44)
10:50:59.949260 IP (tos 0x0, ttl 127, id 13219, offset 0, flags [none], proto UDP (17), length 127)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.53805: 16531* 2/0/0 186.8.178.134.in-addr.arpa. PTR mdtlap35985.bom.gov.au., 186.8.178.134.in-addr.arpa. PTR timl.bom.gov.au. (99)
10:50:59.951785 IP (tos 0x0, ttl 127, id 13223, offset 0, flags [none], proto UDP (17), length 60)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.53792: 36634- 0/0/0 (32)
10:50:59.955931 IP (tos 0x0, ttl 64, id 26951, offset 0, flags [DF], proto UDP (17), length 60)
    mdtlap35985.bom.gov.au.32848 > bom1.bom.gov.au.domain: 36634+ AAAA? www.bom.gov.au. (32)
10:50:59.959755 IP (tos 0x0, ttl 127, id 13229, offset 0, flags [none], proto UDP (17), length 60)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.32848: 36634- 0/0/0 (32)
10:50:59.964200 IP (tos 0x0, ttl 64, id 26959, offset 0, flags [DF], proto UDP (17), length 71)
    mdtlap35985.bom.gov.au.40619 > bom1.bom.gov.au.domain: 63900+ AAAA? www.bom.gov.au.bom.gov.au. (43)
10:50:59.964543 IP (tos 0x0, ttl 127, id 13230, offset 0, flags [none], proto UDP (17), length 133)
    bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.40619: 63900 NXDomain* 0/1/0 (105)


------------------------------

Performing a dig for the AAAA record from the windows DNS server returns:

$ dig www.bom.gov.au AAAA

; <<>> DiG 9.6.2-RedHat-9.6.2-1.fc12 <<>> www.bom.gov.au AAAA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58886
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.bom.gov.au.			IN	AAAA

;; Query time: 4 msec
;; SERVER: 134.178.14.1#53(134.178.14.1)
;; WHEN: Thu Mar 25 11:30:49 2010
;; MSG SIZE  rcvd: 32

This is quite different from a query to the Unix DNS server:

$ dig @134.178.6.5 www.bom.gov.au AAAA

; <<>> DiG 9.6.2-RedHat-9.6.2-1.fc12 <<>> @134.178.6.5 www.bom.gov.au AAAA
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10196
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.bom.gov.au.			IN	AAAA

;; Query time: 6 msec
;; SERVER: 134.178.6.5#53(134.178.6.5)
;; WHEN: Thu Mar 25 11:32:04 2010
;; MSG SIZE  rcvd: 32

I am not familiar with the internals with DNS so I don't know if the Windows server is returning a valid response but if it is invalid then it appears that the resolver is not failing gracefully.

Comment 8 Andreas Schwab 2010-03-25 09:47:14 UTC
See <https://bugzilla.redhat.com/show_bug.cgi?id=162625>.

Comment 9 Tim Long 2010-03-26 05:11:12 UTC
Expanding my list of my DNS servers to include the two official windows servers and the backup unix server gives the following result from tcpdump (changed to sniff all the hosts).

# tcpdump "(host 134.178.14.1 or host 134.178.14.3 or host 134.178.6.5) and port 53"
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
15:40:30.137619 IP mdtlap35985.bom.gov.au.34246 > bom1.bom.gov.au.domain: 12410+ A? www.bom.gov.au. (32)
15:40:30.137639 IP mdtlap35985.bom.gov.au.34246 > bom1.bom.gov.au.domain: 51937+ AAAA? www.bom.gov.au. (32)
15:40:30.138086 IP mdtlap35985.bom.gov.au.41246 > bom1.bom.gov.au.domain: 34177+ PTR? 1.14.178.134.in-addr.arpa. (43)
15:40:30.138399 IP bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.34246: 12410 1/0/0 A 210.8.186.60 (48)
15:40:30.138530 IP bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.41246: 34177* 1/0/0 PTR bom1.bom.gov.au. (72)
15:40:30.138646 IP mdtlap35985.bom.gov.au.43911 > bom1.bom.gov.au.domain: 26003+ PTR? 186.8.178.134.in-addr.arpa. (44)
15:40:30.139077 IP bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.43911: 26003* 2/0/0 PTR mdtlap35985.bom.gov.au., PTR timl.bom.gov.au. (99)
15:40:30.141267 IP bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.34246: 51937- 0/0/0 (32)
15:40:30.141318 IP mdtlap35985.bom.gov.au.38753 > bom2.bom.gov.au.domain: 12410+ A? www.bom.gov.au. (32)
15:40:30.141333 IP mdtlap35985.bom.gov.au.38753 > bom2.bom.gov.au.domain: 51937+ AAAA? www.bom.gov.au. (32)
15:40:30.141399 IP mdtlap35985.bom.gov.au.58707 > bom1.bom.gov.au.domain: 12097+ PTR? 3.14.178.134.in-addr.arpa. (43)
15:40:30.141871 IP bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.58707: 12097* 1/0/0 PTR bom2.bom.gov.au. (72)
15:40:30.145055 IP bom2.bom.gov.au.domain > mdtlap35985.bom.gov.au.38753: 12410 1/0/0 A 210.8.42.125 (48)
15:40:30.148420 IP bom2.bom.gov.au.domain > mdtlap35985.bom.gov.au.38753: 51937- 0/0/0 (32)
15:40:30.148487 IP mdtlap35985.bom.gov.au.42649 > vortex.bom.gov.au.domain: 12410+ A? www.bom.gov.au. (32)
15:40:30.148500 IP mdtlap35985.bom.gov.au.42649 > vortex.bom.gov.au.domain: 51937+ AAAA? www.bom.gov.au. (32)
15:40:30.148625 IP mdtlap35985.bom.gov.au.43558 > bom1.bom.gov.au.domain: 56667+ PTR? 5.6.178.134.in-addr.arpa. (42)
15:40:30.149181 IP bom1.bom.gov.au.domain > mdtlap35985.bom.gov.au.43558: 56667* 1/0/0 PTR vortex.bom.gov.au. (73)
15:40:30.150917 IP vortex.bom.gov.au.domain > mdtlap35985.bom.gov.au.42649: 12410 1/2/2 A 210.8.42.125 (136)
15:40:30.155692 IP vortex.bom.gov.au.domain > mdtlap35985.bom.gov.au.42649: 51937 0/0/0 (32)

The resolver looks like it is going down the list of servers. My test code even returns the correct result IP address instead of an error message when I include the unix server.

Unfortunately I can not guarantee that the Unix server is around all the time.

Comment 10 Fedora Update System 2010-04-10 10:24:45 UTC
glibc-2.11.1-4 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Tim Long 2010-04-12 12:33:00 UTC
This fix does not appear to solve the issue:

glibc-2.11.1-4 is installed and I now get the following results:

$ ./testDNS www.bom.gov.au
Getting DNS info for host: www.bom.gov.au

Trying getaddrinfo
Error returned by getaddrinfo: Name or service not known