summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-09-23 15:44:55 -0500
committerDan Williams <dcbw@redhat.com>2014-10-01 15:19:44 -0500
commit70fee662c19ec0e4af8daa16a5ac7d00baa854c6 (patch)
tree405f2a867ba3b51324d9ed85e7b05daf1bce2e2f
parent8b430c3ff44006216d06f839f014b09ae3655015 (diff)
downloadNetworkManager-dcbw/rh1139326-dhcp-expire.tar.gz
dhcp: treat lease expiry as failure (rh #1139326)dcbw/rh1139326-dhcp-expire
Lease expiry means that the DHCP configuration is no longer valid, and that all attempts to renew/rebind the lease have failed. The IP config needs to be removed. NetworkManager also sets prefered/valid lifetimes on addresses, so the kernel will remove them when the lease expires anyway. That causes removal of the default route, if the default route was through the device whose config has now expired. DHCP clients will typically move to the 'renew' or 'rebind' states when nearing lease expiry, then if no answer is received move to the 'expire' state. Eventually they move to the 'fail' state when all attempts to contact the server have failed. Previously, since NM ignored the 'expire' DHCP state it would not clear out the DHCP IP4 config immediately when the lease expired, instead waiting for the DHCP client to move to the 'fail' state. But if the DHCP server appeared between the 'expire' and 'fail' states, NM would not notice and the device's NMIP4Config would not change, and thus the Policy would not get the "ip4-config-changed" signal to re-add the default route that the kernel had previously removed due to the valid lifetime reaching zero when the lease expired. https://bugzilla.redhat.com/show_bug.cgi?id=1139326
-rw-r--r--src/dhcp-manager/nm-dhcp-client.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index 75a243649f..76700628ec 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -178,7 +178,9 @@ reason_to_state (const char *iface, const char *reason)
return NM_DHCP_STATE_DONE;
else if (g_ascii_strcasecmp (reason, "fail") == 0 ||
g_ascii_strcasecmp (reason, "abend") == 0 ||
- g_ascii_strcasecmp (reason, "nak") == 0)
+ g_ascii_strcasecmp (reason, "nak") == 0 ||
+ g_ascii_strcasecmp (reason, "expire") == 0 ||
+ g_ascii_strcasecmp (reason, "expire6") == 0)
return NM_DHCP_STATE_FAIL;
nm_log_dbg (LOGD_DHCP, "(%s): unmapped DHCP state '%s'", iface, reason);