Bug 442172

Summary: Call res_init() on NetworkManager reconfiguration
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 9CC: dcbw, drepper
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.8.90-11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-08-08 21:18:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 442171    
Attachments:
Description Flags
Testcase not seeing changed `/etc/resolv.conf'. none

Description Jan Kratochvil 2008-04-12 12:23:17 UTC
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
(nil)

Expected results:
Testcase should print
0xhexaddr
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 12:23:18 UTC
Created attachment 302209 [details]
Testcase not seeing changed `/etc/resolv.conf'.

Comment 2 Dan Williams 2008-04-14 14:04:17 UTC
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 14:15:46 UTC
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 14:37:37 UTC
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 15:08:39 UTC
Dan,
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 09:20:54 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Brennan Ashton 2008-06-08 02:59:07 UTC
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 21:18:41 UTC
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 21:19:12 UTC
I'ts of course

   check-files   hosts   yes

Comment 10 Jan Kratochvil 2008-08-08 21:46:03 UTC
Ulrich,
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 22:03:42 UTC
(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.