[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#343140: resolver uses search list before other addresses



On Tue, Jan 24, 2006 at 01:59:38PM -0500, Michael Stone wrote:
> >Ok, let's clarify some things here. resolv.conf(5) describes the 
> >behaviour of a _single_ resolver query. If you look at 
> >resolv/nss_dns/dns-host.c in the glibc source, you'll see that 
> >gethostbyname(3) is implemented as _two_ distinct resolver invocations.  
> >Since it is nowhere specified how many resolver invocations 
> >gethostbyname(3) should cause, the glibc behaviour is correct and will 
> >result in the second list of DNS queries you specified.
> 
> ISTM that's an issue the user user shouldn't have to care about. 
> gethostbyname(3) could be implemented as _four_ distinct resolver 
> invocations:
> 
> if (inputname doesn't end in ".") {
>  resolve(inputname., AAAA)
>    return if found
>  resolve(inputname., A)
>    return if found
> }
> resolve(inputname, AAAA)
>  return if found
> resolve(inputname, A)
>  return if found
> 
> Which would make the results match the requested behavior without a major 
> rewrite. "The code does something that makes sense if you look at the 
> code" isn't, in itself, a very good reason not to do something different.
> 
> Mike Stone

  Ack with that, though I looked at the glibc code, such a patch (that
also was my first idea) is far from trivial sadly in the current state
of the glibc resolver design.

  Given that I fear that Ullrich would just discard the bug if there is
no patch with it. I do not know the libc internals enough yet to do a
good patch by myself :|

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpYL_BHdTRVq.pgp
Description: PGP signature


Reply to: