From 91eafe95a3bfe1971a9c309c542d0e0182fb066e Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 6 Jan 2014 16:06:49 -0600 Subject: 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. --- src/devices/nm-device.c | 22 +++++++++++----------- 1 file 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); -- cgit v1.2.1