[git commit master 1/1] Immediately try next nameserver on recv() failure

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Jul 28 13:36:03 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=05ef2d67dcfca516e49e133d9f7e3c62feed2358
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

If there is a problem communicating with a nameserver the __dns_lookup()
function will not immediately advance to the next nameserver but instead
continue waiting until the timeout expires. This will cause a 30 second
delay even if no nameserver is configured in resolv.conf and no DNS is
running on localhost.

Signed-off-by: Ingo van Lil <inguin at gmx.de>
Acked-by: Roman I Khimov <khimov at altell.ru>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/inet/resolv.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 320aec4..6a9b807 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1432,9 +1432,11 @@ int attribute_hidden __dns_lookup(const char *name,
 
 		if (packet_len < HFIXEDSZ) {
 			/* too short!
+			 * If the peer did shutdown then retry later,
+			 * try next peer on error.
 			 * it's just a bogus packet from somewhere */
  bogus_packet:
-			if (reply_timeout)
+			if (packet_len >= 0 && reply_timeout)
 				goto wait_again;
 			goto try_next_server;
 		}
-- 
1.7.1



More information about the uClibc-cvs mailing list