Bug#343140: resolver uses search list before other addresses
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
Reply to: