This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [bug] nss resolver code doesn't stop at files lookup



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.

> hosts:
> 	127.0.0.1	localhost

Add the following:
# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback
 

> 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.

 Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/       kukuk@suse.de
SuSE GmbH            Schanzaeckerstr. 10            90443 Nuernberg
Linux is like a Vorlon.  It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]