Red Hat Bugzilla – Bug 442172
Call res_init() on NetworkManager reconfiguration
Last modified: 2008-08-08 18:03:42 EDT
Description of problem:
NetworkManager can reconfigure /etc/resolv.conf and it can even notify anyone
who registers. But the glibc resolver never finds out /etc/resolv.conf has
Version-Release number of selected component (if applicable):
rawhide-20080409.i386 (exact glibc version upon request)
Seen once, verified /etc/resolv.conf is never read on its change.
Steps to Reproduce:
1. Put invalid nameserver into `/etc/resolv.conf'.
2. Run the testcase (./netdb).
3. Put valid nameserver into `/etc/resolv.conf'.
Testcase still prints
Testcase should print
for immediate valid name resolving: killall -USR1 netdb
NetworkManagerDispatch provides the directory `/etc/NetworkManager/dispatcher.d'
where glibc can place its hook to notify all the running applications to reload
`/etc/resolv.conf'. But I am not aware how to notify glibc without colliding
with any application using glibc vs. the application's signals/mainloop.
Not filed upstream as NetworkManager is more Fedora specific.
nscd was not installed in this case.
Created attachment 302209 [details]
Testcase not seeing changed `/etc/resolv.conf'.
I think the preferred upstream solution proposed by the glibc maintainers is to
use nscd. NM already does:
/usr/sbin/nscd -i hosts
whenever it updates resolv.conf.
In such case NetworkManager should rpm-Require the package nscd and it should
start the nscd daemon along.
In Bug 442171 was shown the practical case of a minimal Fedora installation
where nscd is missing and in such case "it just does not work".
It would be best if NetworkManager would be able to call res_init() in all the
running applications using libresolv without nscd but neither Jakub nor me knows
a safe+cheap method of such notification (shmat(2) of a flag-page?).
NM isn't going to require nscd because it's not a hard dep and not everyone
wants to run it. People that care need to start nscd if they want it.
Having NM call res_init() in each process seems like a gross hack though; if
that's the lengths NM has to go to, then the call should be in glibc itself...
glibc should call res_init() itself but it needs to know when to do so.
Any kernel call (such as stat() or time()) is not acceptable for the maintainers.
Going to try to provide a `rdtsc'-protected stat() call if it will be feasible.
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
Could you please reply to the previous question? If you won't reply in one
month, I will have to close this bug as INSUFFICIENT_DATA. Thank you.
The current rawhide nscd version automatically will discover when /etc/resolv.conf is changed and it invalidates the database. It is necessary to have
check-files passwd yes
I'ts of course
check-files hosts yes
this Bug is whole about a configuration without nscd installed. If nscd is required for the proper functionality of glibc nscd should be Required by the rpm packaging. It is currently not the case.
(As I still did not provide a patch the Bug should remain CLOSED, though.)
(In reply to comment #10)
> this Bug is whole about a configuration without nscd installed. If nscd is
> required for the proper functionality of glibc nscd should be Required by the
> rpm packaging.
nscd is required to make changes work. Period. I won't add code into the stub resolver to check the file every time. This is far too slow. We have a perfectly fine solution, so use it.
I've been arguing to change the default to use nscd by default for a long time. In fact, we should completely remove the option to not use nscd.