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.
This commit is contained in:
Dan Williams 2014-01-06 16:06:49 -06:00
parent a30030b82b
commit 91eafe95a3

View file

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