[PATCH] Fix multiple DNS queries when negative results returned

Bernhard Fischer rep.dot.nop at gmail.com
Fri Jun 27 11:53:28 UTC 2008


On Fri, Jun 27, 2008 at 01:35:16PM +0200, Ricard Wanderlof wrote:
>
> We had a problem whereby multiple DNS queries were being made against the 
> same host, even if a negative result was returned the first time. This  
> patch attempts to fix this by keeping track of which hosts returned  
> negative responses in the retry loop in__dns_lookup(). It can  
> significantly reduce corresponding network traffic in large networks.
>
> Patch made against svn 22530 and included as an attachment as well as  
> inline for review.
>
> /Ricard
>
>
>
> Index: libc/inet/resolv.c
> ===================================================================
> --- libc/inet/resolv.c	(revision 22530)
> +++ libc/inet/resolv.c	(working copy)
> @@ -757,6 +757,7 @@
>  #ifdef __UCLIBC_HAS_IPV4__
>  	struct sockaddr_in sa;
>  #endif
> +	bool negative_results[MAX_SEARCH + 1] = { 0 };

unsigned no_results;
if (got negative result)
  no_results |= (1 << variant)

Which one is smaller? size(1), please.

PS: Note that i personally think that the resolver code suffers from two
problems: 1) it's bloated 2) it doesn't work at all for IPv6-only.
and should thus be replaced by something that has neither of these
problems. ATM I don't have any sparetime to fix it.



More information about the uClibc mailing list