Bug 3637 - getaddrinfo does NOT add domain to query when receive SERVFAIL
Summary: getaddrinfo does NOT add domain to query when receive SERVFAIL
Status: RESOLVED FIXED
Alias: None
Product: uClibc
Classification: Unclassified
Component: Networking (show other bugs)
Version: 0.9.32
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-17 07:21 UTC by Andrey Kovalev
Modified: 2011-06-14 14:45 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
Sniff from wireshark (992 bytes, application/octet-stream)
2011-04-17 07:21 UTC, Andrey Kovalev
Details
Patch (510 bytes, application/octet-stream)
2011-04-17 07:21 UTC, Andrey Kovalev
Details

Note You need to log in before you can comment on or make changes to this bug.
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.