From aef16cc8a4c670036d45590877d411a97f01e0cd Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 3 Jul 2017 21:06:23 +0200 Subject: resolv: Automatically reload a changed /etc/resolv.conf file [BZ #984] This commit enhances the stub resolver to reload the configuration in the per-thread _res object if the /etc/resolv.conf file has changed. The resolver checks whether the application has modified _res and will not overwrite the _res object in that case. The struct resolv_context mechanism is used to check the configuration file only once per name lookup. --- ChangeLog | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 6478aed5ff..bf91026cec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2017-06-30 Florian Weimer + + [BZ #984] + Reload /etc/resolv.conf if has been changed on disk. + * resolv/resolv_conf.h (resolv_conf): Remove initstamp member. + (__resolv_conf_load, __resolv_conf_get_current): Declare. + * resolv/resolv_conf.c (struct resolv_conf_global): Add + conf_current, conf_mtime, conf_ctime, conf_size, conf_ino members. + (__resolv_conf_get_current): New function. + (__resolv_conf_allocate): Do not initialize initstamp. + (freeres): Deallocate global->conf_current. + * resolv/resolv.h (RES_NORELOAD): Define. + * resolv/res_debug.c (p_option): Add RES_NORELOAD. + * resolv/resolv-internal.h (__res_initstamp): Remove declaration. + * resolv/resolv_context.c (replicated_configuration_matches): New. + (maybe_init): Call it. Use __resolv_conf_get_current to obtain + the current configration. + * resolv/res_init.c (__res_initstamp): Remove variable definition. + (has_preinit_values): New function. + (__resolv_conf_load): Renamed from __res_vinit. Drop res_state + parameter and do not call __resolv_conf_attach. + (__res_vinit): Reimplement based __resolv_conf_load. + (res_options): Handle no-reload. + * resolv/res_libc.c (atomicinclock, atomicincunlock, atomicinc) + (lock): Remove. + (res_int): Do not update __res_initstamp. + * resolv/tst-resolv-res_init-skeleton.c (print_resp): Handle + RES_NORELOAD. + (test_cases): Test no-reload. + (special_test_call_res_init): Remove. + (special_test_callback): Rely on automated reloading. Add tests + for no-reload. + 2017-06-30 Florian Weimer Mirror the entire resolver configuration in struct resolv_conf. -- cgit v1.2.1