Sources Bugzilla – Bug 10851
no fallback to nameserver 0.0.0.0 if /etc/resolv.conf is missing
Last modified: 2010-09-14 17:04:19 UTC
Starting with glibc 2.10, there is no fallback to nameserver 0.0.0.0 anymore if
/etc/resolv.conf is missing. This is due to this change:
2008-12-02 Ulrich Drepper <firstname.lastname@example.org>
* resolv/res_init.c (__res_vinit): Initialize nscount to zero.
This value should be set back to 1 so that the following code is actually useful:
statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
statp->nsaddr.sin_addr.s_addr = INADDR_ANY;
statp->nsaddr.sin_family = AF_INET;
statp->nsaddr.sin_port = htons(NAMESERVER_PORT);
Created attachment 4322 [details]
Patch to fix the problem
Created attachment 4369 [details]
The previous patch does not work in case /etc/resolv.conf exists, but does not
contain a nameserver entry. This new patch also takes that into account.
See also http://sourceware.org/ml/libc-alpha/2009-02/msg00028.html :(
Created attachment 4402 [details]
Oops, I haven't noticed you already implemented a fix; anyway, here's what I've
done independently, somewhat simpler patch. YMMV.
I checked in a different patch.
(In reply to comment #5)
> I checked in a different patch.
... but broken what. You forget to set statp->nscount to 1, so it doesn't work.
Fixed in Git now for good, hopefully.