소스 검색

Immediately try next nameserver on recv() failure

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@gmx.de>
Acked-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Ingo van Lil 14 년 전
부모
커밋
05ef2d67dc
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      libc/inet/resolv.c

+ 3 - 1
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;
 		}