[PATCH] Make Fedora not require reboots on wireless network changes

Colin Walters walters@redhat.com
Mon Sep 13 18:17:00 GMT 2010


GNU ChangeLog:

2010-09-13  Colin Walters  <walters@verbum.org>

	* resolv/res_libc.c (__res_maybe_init): If the DYNAMIC
	option is specified, call _res_dynamic_check() to re-stat
	the resolv.conf file.
	(_res_dynamic_check): New function.
	* resolv/res_init.c: Check for "dynamic" option.
	* resolv/resolv.h: Define #RES_DYNAMIC.

Patch is attached, for convenience I've pasted the git log inline, which has
the justification and details:

[PATCH] resolv: Add a new "dynamic" option which tells us to re-stat the file

Various operating system vendors have been shipping variants of a
patch which stat()s resolv.conf on every gethostbyname() call.  Actually,
effectively every important OS vendor shipping glibc does, except Fedora.

The reason for this is simply that on mobile devices, nameservers can
change, and having to restart all applications and processes which
have cached resolv.conf data for this is simply broken.  (NSCD exists,
but is considered deprecated by SSSD, which is now in Fedora 13 by
default.)  SSSD does not do name service caching.

Another simple argument for this patch - the canonical location of the
data is in /etc/resolv.conf; if glibc is reading it into memory
without a mechanism for invalidating that copy - it's not a cache,
it's a copy, which is a bug.

The intent of this patch is that in e.g. Fedora, NetworkManager's
generated resolv.conf file will include this if it gets any of its
data from DHCP.  Otherwise, it can omit the option, and processes
won't have to pay the cost of the stat() (assuming it was even a real
concern to begin with).

Note that NetworkManager will *also* be adding support for different
userspace DNS caching frameworks like dnsmasq, but having this patch
in the C library simply makes sense - we won't fail if there's no
running DNS cacher, which certainly seems possible for early-boot
scenarios.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-resolv-Add-a-new-dynamic-option-which-tells-us-to-re.patch
Type: text/x-patch
Size: 3952 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20100913/ec3aa3bf/attachment.bin>


More information about the Libc-alpha mailing list