This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [bug] nss resolver code doesn't stop at files lookup
- To: Thorsten Kukuk <kukuk at suse dot de>
- Subject: Re: [bug] nss resolver code doesn't stop at files lookup
- From: Ben Collins <bcollins at debian dot org>
- Date: Sat, 11 Nov 2000 01:35:54 -0500
- Cc: libc-alpha at sources dot redhat dot com
- References: <20001110210106.F229@visi.net> <20001111072411.A9025@suse.de>
On Sat, Nov 11, 2000 at 07:24:11AM +0100, Thorsten Kukuk wrote:
>
> Hi,
>
> On Fri, Nov 10, Ben Collins wrote:
>
> > This is pretty easy to reproduce. Basically what happens (and can be seen
> > from an strace) is that that with getaddrinfo(), a success on a /etc/hosts
> > lookup does not stop the NSS lookup process, and it continues to try and
> > find it via DNS.
>
> You forget to say one important thing: glibc tries to get the IPv6 address
> over DNS.
Uggh. Anyway to prevent this, or is it merely an extension/feature of
getaddrinfo?
> > hosts:
> > 127.0.0.1 localhost
>
> Add the following:
> # special IPv6 addresses
> ::1 localhost ipv6-localhost ipv6-loopback
That worked.
> > Now, if you do a name lookup for `localhost' under these conditions, I
> > would expect that it would not attempt a DNS lookup. This is not the case
> > with getaddrinfo(), but it is the case with gethostbyname().
>
> I would expect a DNS lookup, since you have not specified the IPv6 address
> in /etc/hosts.
> SuSE solves this problem for a long time with a second libnss_dns Module.
> Our standard libnss_dns Module does not make lookups for IPv6 addresses.
>
>
> > getaddrinfo() continues to do a DNS lookup, even after it has read and
> > parsed /etc/hosts. Now this would not be a major problem, if it did not
> > cause the call to getaddrinfo to fail and return non-zero. IOW, any DNS
> > failure (other than notfound) for a host in /etc/hosts, will cause a
> > failure for the getaddrinfo call completely.
>
> Strange, I never saw this. This sounds like a real bug.
Yeah, this is the biggest problem. The others wouln't matter so much if
things didn't fail like they are.
--
-----------=======-=-======-=========-----------=====------------=-=------
/ Ben Collins -- ...on that fantastic voyage... -- Debian GNU/Linux \
` bcollins@debian.org -- bcollins@openldap.org -- bcollins@linux.com '
`---=========------=======-------------=-=-----=-===-======-------=--=---'