Right. The reason for the problem is that getaddrinfo()
tries to resolve the name "localhost", rooted at the top
level, using the DNS server (if one is running). The
older functions don't do this - they look in /etc/hosts
first, before trying DNS; but getaddrinfo() is probably
doing the right thing - I think - because it has been
called with the AI_CANONNAME flag, which is a request
for it to find the canonical name of the specified host,
and the only way to do that is to use DNS (/etc/hosts
doesn't specify it).
Interestingly, the DNS-HOWTO supplies a couple of sample
configurations for caching DNS. RedHat have used the first
one in the HOWTO, which doesn't have a separate "localhost"
zone (hence looking up "localhost." in nslookup will try to
contact a root nameserver - "localhost" works in nslookup
though, because that's in /etc/hosts). Later on in the file,
where it talks about migration from bind 4 to bind 8, it
shows a caching configuration created by the migration
script, which includes a "localhost" zone - and after making
this change, things all work fine.
I think this is really a system configuration issue, and
RedHat's fault, but I think it might be nice to place a
comment in the PROBLEMS file about it, or maybe a configure
test to see if getaddrinfo() takes months to resolve
"localhost", and comments on what might be wrong.
The problem won't occur if:
* You automatically remove external nameservers from the
named configuration whenever you come off the Internet,
and add them back again when you connect. (Since I've
only just set all of this up, I wasn't doing that).
* Or you have a "localhost" zone in your named.conf.
* Or you aren't running named.
Regards,
Alastair.
____________________________________________________________
Alastair Houghton ajhoughton(a)lineone.net