[uClibc 0000660]: getaddrinfo() queries are redundant and in odd order

bugs at busybox.net bugs at busybox.net
Mon Nov 17 16:03:42 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=660 
====================================================================== 
Reported By:                akvadrako
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   660
Category:                   Networking Support
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             01-25-2006 16:52 PST
Last Modified:              11-17-2008 08:03 PST
====================================================================== 
Summary:                    getaddrinfo() queries are redundant and in odd order
Description: 
I have IPv6 support enabled and three DNS servers listed in
/etc/resolv.conf.  I'm looking up a hostname that only has an A record. 
uClibc's getaddrinfo() looks up the records by trying each nameserver in
order then trying again two more times.  When the family is AF_UNSPEC, it
completes this process for AAAA records then A records.

So in my case, to get the A record, I have to wait for 9 queries to fail
first.  Since they timeout in ten seconds, this is unacceptably long if
some of the DNS servers are down.

To make the situation worse, getaddrinfo() doesn't trust query responses
with no answers.  Instead it treats them as an error, and repeats the
query, even to the same host.

RFC1035 recommends retransmissions (but not timeouts) every 2-5 seconds. 
I suggest three changes to the current lookup method:

  * trust the first response without an error, even if negative
  * ask for both type of records in each query (adds negligable size)
  * retransmit every 5 seconds, not every 10
====================================================================== 

---------------------------------------------------------------------- 
 vapier - 01-25-06 19:04  
---------------------------------------------------------------------- 
can you try the patch in Bug 473:
http://busybox.net/bugs/file_download.php?file_id=389&type=bug 

---------------------------------------------------------------------- 
 akvadrako - 01-25-06 21:10  
---------------------------------------------------------------------- 
Patch 389 is not relevant to this issue. This issue does not deal with
search domains or invalid encoding of domain names.  The problems
discussed in this issue apply to queries of all domain names. 

---------------------------------------------------------------------- 
 vda - 11-01-08 16:26  
---------------------------------------------------------------------- 
Revision 23895 contains a fix to not treat negative responses as errors. 

---------------------------------------------------------------------- 
 vda - 11-17-08 07:59  
---------------------------------------------------------------------- 
rev 24075 reduced timeout to 5 seconds, to match glibc 

---------------------------------------------------------------------- 
 vda - 11-17-08 08:03  
---------------------------------------------------------------------- 
Re "ask for both type of records in each query (adds negligable size)":

1. do you have a patch? I know little about DNS...

2. maybe it makes sense to make it possible to suppress AAAA (or A)
queries? Are there any other libc's which do this, so that we can do the
same (I imagine "options ipv4" or something in /etc/resolv.conf?) 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-25-06 16:52  akvadrako      New Issue                                    
01-25-06 16:52  akvadrako      Status                   new => assigned     
01-25-06 16:52  akvadrako      Assigned To               => uClibc          
01-25-06 19:04  vapier         Note Added: 0001005                          
01-25-06 21:10  akvadrako      Note Added: 0001006                          
07-25-06 14:34  dcostako       Issue Monitored: dcostako                    
11-01-08 16:26  vda            Note Added: 0014804                          
11-17-08 07:59  vda            Note Added: 0015944                          
11-17-08 08:03  vda            Note Added: 0015964                          
======================================================================




More information about the uClibc-cvs mailing list