summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-08-05 22:22:01 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-08-09 21:24:35 +0200
commitac67771bc154b996d651a3a3127b43c5bf954b27 (patch)
tree99a3db8d4942508674dc8d6200e6c8e3efbd5d76
parente4b2c989dc51818e52906b5120ea6a0659274631 (diff)
downloadNetworkManager-ac67771bc154b996d651a3a3127b43c5bf954b27.tar.gz
policy: fix hostname change when IP method ends after activation (take 2)
Commit 9446481f4cc0 ("policy: update system hostname when DHCP configuration changes") tried to fix the missing hostname change when IPv4 receives a hostname through DHCP but terminates after IPv6, by calling update_routing_and_dns() as soon as the new DHCP configuration was received. It turns out that doing so is not always effective because the device must be the "best" device (the one with default route) in order to trigger a hostname change, but the best device status is decided later. Updating the hostname in device_ipx_config_changed() should cover all cases. Fixes: 9446481f4cc06c657d9467bce0921a85bb94ae6b https://bugzilla.redhat.com/show_bug.cgi?id=1356015 https://bugzilla.redhat.com/show_bug.cgi?id=1364393
-rw-r--r--src/nm-policy.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 0a67464946..eefbf1c7eb 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1294,22 +1294,6 @@ device_state_changed (NMDevice *device,
}
static void
-device_dhcp_config_changed (NMDevice *device,
- GParamSpec *pspec,
- gpointer user_data)
-{
- NMPolicyPrivate *priv = user_data;
- NMPolicy *self = priv->self;
-
- if (nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED) {
- /* Ensure that a hostname received through DHCP4/DHCP6 is applied even
- * if the IPv4/IPv6 method completed after initial activation.
- */
- update_routing_and_dns (self, FALSE);
- }
-}
-
-static void
device_ip4_config_changed (NMDevice *device,
NMIP4Config *new_config,
NMIP4Config *old_config,
@@ -1334,6 +1318,7 @@ device_ip4_config_changed (NMDevice *device,
}
update_ip4_dns (self, priv->dns_manager);
update_ip4_routing (self, TRUE);
+ update_system_hostname (self, priv->default_device4, priv->default_device6);
} else {
/* Old configs get removed immediately */
if (old_config)
@@ -1368,6 +1353,7 @@ device_ip6_config_changed (NMDevice *device,
}
update_ip6_dns (self, priv->dns_manager);
update_ip6_routing (self, TRUE);
+ update_system_hostname (self, priv->default_device4, priv->default_device6);
} else {
/* Old configs get removed immediately */
if (old_config)
@@ -1417,8 +1403,6 @@ devices_list_register (NMPolicy *self, NMDevice *device)
g_signal_connect (device, NM_DEVICE_IP6_CONFIG_CHANGED, (GCallback) device_ip6_config_changed, priv);
g_signal_connect (device, "notify::" NM_DEVICE_AUTOCONNECT, (GCallback) device_autoconnect_changed, priv);
g_signal_connect (device, NM_DEVICE_RECHECK_AUTO_ACTIVATE, (GCallback) device_recheck_auto_activate, priv);
- g_signal_connect (device, "notify::" NM_DEVICE_DHCP4_CONFIG,(GCallback) device_dhcp_config_changed, priv);
- g_signal_connect (device, "notify::" NM_DEVICE_DHCP6_CONFIG,(GCallback) device_dhcp_config_changed, priv);
}
static void