path: root/libc
diff options
authorTim Hockin <>2016-03-09 20:48:32 (GMT)
committerWaldemar Brodkorb <>2016-03-10 20:50:25 (GMT)
commit2ac8348609b63d6f3a87cb27ce17deff889c6a73 (patch)
tree36fa9514b8baf5b2362c81a122eb624766b4b0c8 /libc
parent3c67c044f93b452aa483eb1246195ebb4443cb44 (diff)
DNS: don't count search-path miss as a retry
Currently a miss on a search-path entry is counted as a retry. This means that users with more than (num_nameservers * retries) entries in their search path list fail before trying all search paths. Concretely, a single nameserver with 4 search paths will never try the 4th search because the default retry is 3. The code doesn't currently retry a given nameserver in case of an error, so retries is sort of meaningless (though there are some comments indicating it might come). This change only treats total failure of a nameserver (try next server) as a retry. Signed-off-by: Tim Hockin <>
Diffstat (limited to 'libc')
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 4b33896..e676f53 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1320,7 +1320,6 @@ int __dns_lookup(const char *name,
local_ns_num = last_ns_num;
retries_left = __nameservers * __resolv_attempts;
- retries_left--;
if (local_ns_num >= __nameservers)
local_ns_num = 0;
@@ -1572,6 +1571,7 @@ int __dns_lookup(const char *name,
/* Try next nameserver */
+ retries_left--;
variant = -1;
} while (retries_left > 0);