Bug 442172 - Call res_init() on NetworkManager reconfiguration
Call res_init() on NetworkManager reconfiguration
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
Blocks: 442171
  Show dependency treegraph
Reported: 2008-04-12 08:23 EDT by Jan Kratochvil
Modified: 2008-08-08 18:03 EDT (History)
2 users (show)

See Also:
Fixed In Version: 2.8.90-11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-08-08 17:18:41 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Testcase not seeing changed `/etc/resolv.conf'. (375 bytes, text/x-csrc)
2008-04-12 08:23 EDT, Jan Kratochvil
no flags Details

  None (edit)
Description Jan Kratochvil 2008-04-12 08:23:17 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
changed beneath.

Version-Release number of selected component (if applicable):
rawhide-20080409.i386 (exact glibc version upon request)

How reproducible:
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'.

Actual results:
Testcase still prints

Expected results:
Testcase should print
for immediate valid name resolving: killall -USR1 netdb

Additional info:
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.
Comment 1 Jan Kratochvil 2008-04-12 08:23:18 EDT
Created attachment 302209 [details]
Testcase not seeing changed `/etc/resolv.conf'.
Comment 2 Dan Williams 2008-04-14 10:04:17 EDT
I think the preferred upstream solution proposed by the glibc maintainers is to
use nscd.  NM already does:

/etc/init.d/nscd condrestart
/usr/sbin/nscd -i hosts

whenever it updates resolv.conf.
Comment 3 Jan Kratochvil 2008-04-14 10:15:46 EDT
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?).
Comment 4 Dan Williams 2008-04-14 10:37:37 EDT
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...
Comment 5 Jan Kratochvil 2008-04-14 11:08:39 EDT
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.
Comment 6 Bug Zapper 2008-05-14 05:20:54 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
Comment 7 Brennan Ashton 2008-06-07 22:59:07 EDT
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.
Comment 8 Ulrich Drepper 2008-08-08 17:18:41 EDT
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

in /etc/nscd.conf.
Comment 9 Ulrich Drepper 2008-08-08 17:19:12 EDT
I'ts of course

   check-files   hosts   yes
Comment 10 Jan Kratochvil 2008-08-08 17:46:03 EDT
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.)
Comment 11 Ulrich Drepper 2008-08-08 18:03:42 EDT
(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.

Note You need to log in before you can comment on or make changes to this bug.