summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-09-23 15:38:33 -0500
committerDan Williams <dcbw@redhat.com>2014-10-02 15:02:43 -0500
commitacee2eb9e4954eb33b85fa10a3522b8253271126 (patch)
tree6da349727341eca984c10c95e9a54d13ca92f0c2
parente2f5343b0853afe14487dbfaa8d86beebc932363 (diff)
downloadNetworkManager-acee2eb9e4954eb33b85fa10a3522b8253271126.tar.gz
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.
-rw-r--r--src/devices/nm-device.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 75b07d2f03..21f50b0274 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -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)