Bug 3637

Summary: getaddrinfo does NOT add domain to query when receive SERVFAIL
Product: uClibc Reporter: Andrey Kovalev <aka>
Component: NetworkingAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: uclibc-cvs
Priority: P5    
Version: 0.9.32   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: Sniff from wireshark
Patch

Description Andrey Kovalev 2011-04-17 07:21:14 UTC
Created attachment 3223 [details]
Sniff from wireshark

--- resolv.conf ---
nameserver 195.144.192.60
domain Legion-Group.local
-------------------

Command: ping dc

Sniff domain.pcap: 1-4 packets. Query "dc", got NXDOMAIN, query "dc.Legion-Group.local". Unix bind at 195.144.192.60, right behaviour.


Ok, next test:

--- resolv.conf ---
nameserver 10.100.50.75
domain Legion-Group.local
-------------------

Command: ping dc

Sniff: 5-10 packets. Microsoft DNS at 10.100.50.75 (domain controller for Legion-Group.local) return SERVFAIL. Query "dc", got SERVFAIL, query "dc" again.

Bug: resolv.c does NOT add domain to query when receive SERVFAIL.

Trivial patch to libc/inet/resolv.c:

--- resolv.c-0.9.32-rc3-next	2011-04-16 13:29:51.000000000 +0000
+++ resolv.c	2011-04-16 14:34:09.000000000 +0000
@@ -1461,7 +1461,7 @@
 		/* bug 660 says we treat negative response as an error
 		 * and retry, which is, eh, an error. :)
 		 * We were incurring long delays because of this. */
-		if (h.rcode == NXDOMAIN) {
+		if (h.rcode == NXDOMAIN || h.rcode == SERVFAIL) {
 			/* if possible, try next search domain */
 			if (!ends_with_dot) {
 				DPRINTF("variant:%d sdomains:%d\n", variant, sdomains);
Comment 1 Andrey Kovalev 2011-04-17 07:21:48 UTC
Created attachment 3229 [details]
Patch
Comment 2 Bernhard Reutner-Fischer 2011-06-14 14:45:46 UTC
Hi,

I've applied this as 0100056707c0ca5c51bb0b8d88612a407be09ef1 and will backport it for 0.9.32.1

Please read http://uclibc.org/developing.html#contrib
next time you submit a patch.
TIA.