From 68f1203c7c33fc26c1eef85465608bce4aa479b7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 25 Jun 2015 21:31:22 +0200 Subject: [PATCH] dns: rewrite "resolv.conf" on SIGHUP and SIGUSR1 Also rewrite resolv.conf if the configuration didn't actually change. Especially, react on SIGUSR1 which does not reload the configuration but only writes "resolv.conf". https://bugzilla.redhat.com/show_bug.cgi?id=1062301 --- src/dns-manager/nm-dns-manager.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index 09e3a1d66c..ac4a050ec0 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -1303,15 +1303,19 @@ config_changed_cb (NMConfig *config, { GError *error = NULL; - if (!NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_DNS_MODE | - NM_CONFIG_CHANGE_RC_MANAGER)) - return; + if (NM_FLAGS_HAS (changes, NM_CONFIG_CHANGE_DNS_MODE)) + init_resolv_conf_mode (self); + if (NM_FLAGS_HAS (changes, NM_CONFIG_CHANGE_RC_MANAGER)) + init_resolv_conf_manager (self); - init_resolv_conf_mode (self); - init_resolv_conf_manager (self); - if (!update_dns (self, TRUE, &error)) { - nm_log_warn (LOGD_DNS, "could not commit DNS changes: %s", error->message); - g_clear_error (&error); + if (NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_SIGHUP | + NM_CONFIG_CHANGE_SIGUSR1 | + NM_CONFIG_CHANGE_DNS_MODE | + NM_CONFIG_CHANGE_RC_MANAGER)) { + if (!update_dns (self, TRUE, &error)) { + nm_log_warn (LOGD_DNS, "could not commit DNS changes: %s", error->message); + g_clear_error (&error); + } } }