Commit df734a03 authored by Thomas Haller's avatar Thomas Haller
Browse files

dns: fix connecting signals to DNS plugin in init_resolv_conf_mode()

Each time when enabling/disabling "systemd-resolved" in combination with another
plugin (which is unchanged), another pair of signal handlers was
connected. That's wrong.

Fixes: d4eb4cb4
parent 0c17d34a
......@@ -1975,8 +1975,10 @@ init_resolv_conf_mode (NMDnsManager *self, gboolean force_reload_plugin)
NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self);
NMDnsManagerResolvConfManager rc_manager;
const char *mode;
gboolean systemd_resolved = FALSE;
gboolean param_changed = FALSE, plugin_changed = FALSE;
gboolean systemd_resolved;
gboolean param_changed = FALSE;
gboolean plugin_changed = FALSE;
gboolean systemd_resolved_changed = FALSE;
mode = nm_config_data_get_dns_mode (nm_config_get_data (priv->config));
systemd_resolved = nm_config_data_get_systemd_resolved (nm_config_get_data (priv->config));
......@@ -2053,16 +2055,13 @@ again:
if (systemd_resolved) {
if (!priv->sd_resolve_plugin) {
priv->sd_resolve_plugin = nm_dns_systemd_resolved_new ();
plugin_changed = TRUE;
systemd_resolved_changed = TRUE;
}
} else {
if (priv->sd_resolve_plugin) {
g_clear_object (&priv->sd_resolve_plugin);
plugin_changed = TRUE;
}
}
} else if (nm_clear_g_object (&priv->sd_resolve_plugin))
systemd_resolved_changed = TRUE;
if (plugin_changed && priv->plugin) {
if ( plugin_changed
&& priv->plugin) {
g_signal_connect (priv->plugin, NM_DNS_PLUGIN_FAILED, G_CALLBACK (plugin_failed), self);
g_signal_connect (priv->plugin, NM_DNS_PLUGIN_CHILD_QUIT, G_CALLBACK (plugin_child_quit), self);
}
......@@ -2082,9 +2081,10 @@ again:
_notify (self, PROP_RC_MANAGER);
}
if (param_changed || plugin_changed) {
if (param_changed || plugin_changed || systemd_resolved_changed) {
_LOGI ("init: dns=%s%s rc-manager=%s%s%s%s",
mode, (systemd_resolved ? ",systemd-resolved" : ""),
mode,
(systemd_resolved ? ",systemd-resolved" : ""),
_rc_manager_to_string (rc_manager),
NM_PRINT_FMT_QUOTED (priv->plugin, ", plugin=",
nm_dns_plugin_get_name (priv->plugin), "", ""));
......
......@@ -108,9 +108,10 @@ typedef struct {
char *dns_mode;
char *rc_manager;
gboolean systemd_resolved;
NMGlobalDnsConfig *global_dns;
bool systemd_resolved:1;
} NMConfigDataPrivate;
struct _NMConfigData {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment