summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-01-06 16:06:49 -0600
committerDan Williams <dcbw@redhat.com>2014-01-06 16:08:06 -0600
commit91eafe95a3bfe1971a9c309c542d0e0182fb066e (patch)
tree614d25aa0e6b58332c3062d5ec254dc4f18bfba1
parenta30030b82b158a1cc7784391c9a97ae8ea81e497 (diff)
downloadNetworkManager-91eafe95a3bfe1971a9c309c542d0e0182fb066e.tar.gz
core: fix stale DHCPv6 information for dispatcher lease-change events (bgo #721002)
dhcp6_lease_change() needs to be called *after* updating the DHCP config object to ensure that the dispatcher gets the new values.
-rw-r--r--src/devices/nm-device.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 55b4ff8ebe..bb6d177024 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3016,9 +3016,18 @@ dhcp6_state_changed (NMDHCPClient *client,
case DHC_RENEW6: /* lease renewed */
case DHC_REBOOT: /* have valid lease, but now obtained a different one */
case DHC_REBIND6: /* new, different lease */
- if (priv->dhcp6_ip6_config)
- g_object_unref (priv->dhcp6_ip6_config);
+ g_clear_object (&priv->dhcp6_ip6_config);
priv->dhcp6_ip6_config = nm_dhcp_client_get_ip6_config (priv->dhcp6_client, FALSE);
+
+ /* Update the DHCP6 config object with new DHCP options */
+ nm_dhcp6_config_reset (priv->dhcp6_config);
+ if (priv->dhcp6_ip6_config) {
+ nm_dhcp_client_foreach_option (priv->dhcp6_client,
+ dhcp6_add_option_cb,
+ priv->dhcp6_config);
+ }
+ g_object_notify (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG);
+
if (priv->ip6_state == IP_CONF) {
if (priv->dhcp6_ip6_config == NULL) {
/* FIXME: Initial DHCP failed; should we fail IPv6 entirely then? */
@@ -3028,15 +3037,6 @@ dhcp6_state_changed (NMDHCPClient *client,
nm_device_activate_schedule_ip6_config_result (device);
} else if (priv->ip6_state == IP_DONE)
dhcp6_lease_change (device);
-
- if (priv->dhcp6_ip6_config) {
- /* Update the DHCP6 config object with new DHCP options */
- nm_dhcp6_config_reset (priv->dhcp6_config);
- nm_dhcp_client_foreach_option (priv->dhcp6_client,
- dhcp6_add_option_cb,
- priv->dhcp6_config);
- g_object_notify (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG);
- }
break;
case DHC_TIMEOUT: /* timed out contacting DHCP server */
dhcp6_fail (device, TRUE);