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
This commit is contained in:
Thomas Haller 2015-06-25 21:31:22 +02:00
parent caed15e082
commit 68f1203c7c

View file

@ -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);
}
}
}