Browse Source

resolv: try next server on SERVFAIL

in bug 3637 Andrey Kovalev aka pxe.ru writes:
getaddrinfo does NOT add domain to query when receive SERVFAIL

RFC1035 7.2 suggests that
   - If a resolver gets a server error or other bizarre response
     from a name server, it should remove it from SLIST, and may
     wish to schedule an immediate transmission to the next
     candidate server address.

So let's try the next server upon SERVFAIL even if it's not strictly
required.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Bernhard Reutner-Fischer 13 years ago
parent
commit
0100056707
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libc/inet/resolv.c

+ 1 - 1
libc/inet/resolv.c

@@ -1461,7 +1461,7 @@ int attribute_hidden __dns_lookup(const char *name,
 		/* 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);