dhcp: fail the device if DHCP fails after having succeeded earlier (rh #1139326)

If DHCP fails to renew or rebind a lease, fail the device since the
IP config is no longer valid.  Commit e2b7c482 was actually wrong for
dhcp[4|6]_fail(), since (ip_state == IP_FAIL) will never be true if
DHCP has ever been started, as IP_FAIL is only set from
nm_device_activate_ip[4|6]_config_timeout(), which obviously will not
be called in DHCP code paths if DHCP has previously succeeded.
This commit is contained in:
Dan Williams 2014-09-23 15:38:33 -05:00
parent e2f5343b08
commit acee2eb9e4

View file

@ -2686,8 +2686,10 @@ dhcp4_fail (NMDevice *self, gboolean timeout)
dhcp4_cleanup (self, TRUE, FALSE);
if (timeout || (priv->ip4_state == IP_CONF))
nm_device_activate_schedule_ip4_config_timeout (self);
else if (priv->ip4_state == IP_FAIL)
else if (priv->ip4_state == IP_DONE)
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED);
else
g_warn_if_reached ();
}
static void
@ -3121,8 +3123,10 @@ dhcp6_fail (NMDevice *self, gboolean timeout)
if (priv->dhcp6_mode == NM_RDISC_DHCP_LEVEL_MANAGED) {
if (timeout || (priv->ip6_state == IP_CONF))
nm_device_activate_schedule_ip6_config_timeout (self);
else if (priv->ip6_state == IP_FAIL)
else if (priv->ip6_state == IP_DONE)
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED);
else
g_warn_if_reached ();
} else {
/* not a hard failure; just live with the RA info */
if (priv->ip6_state == IP_CONF)