core: better handle DHCP expiry/nak during initial lease acquisition (bgo #739482)

When dhclient trieds to request a previous lease and the server NAKs that
lease, dhclient emits the EXPIRE state.  dhcpcd has also been known to emit
the 'nak' state for the same reason.

(systemd's DHCP client code does not push a NAK up to NetworkManager, but
jumps to the REBOOT state instead, so it is unaffected by this issue.)

NetworkManager saw the expire during IP configuration and treated that as
full activation failure.  The connection would be restarted, the same lease
requested, and the same NAK delivered, over and over.  Before a lease is
acquired, there is (by definition) no lease to expire, so these events
should be ignored.

We do, however, still want to handle abnormal failures, which is why
this patch splits the EXPIRE case from the FAIL case and handles them
separately.

https://bugzilla.gnome.org/show_bug.cgi?id=739482
This commit is contained in:
Dan Williams
2014-12-11 15:36:27 -06:00
parent 77bfcdc2e7
commit 1172178ce6
4 changed files with 25 additions and 10 deletions

View File

@@ -485,6 +485,8 @@ dhcp_event_cb (sd_dhcp_client *client, int event, gpointer user_data)
switch (event) {
case DHCP_EVENT_EXPIRED:
nm_dhcp_client_set_state (NM_DHCP_CLIENT (user_data), NM_DHCP_STATE_EXPIRE, NULL, NULL);
break;
case DHCP_EVENT_STOP:
nm_dhcp_client_set_state (NM_DHCP_CLIENT (user_data), NM_DHCP_STATE_FAIL, NULL, NULL);
break;