diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2020-01-27 21:44:36 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2020-01-30 15:42:57 +0100 |
commit | a01198863a18466a25f5eaf97d878e9db9ed1a67 (patch) | |
tree | 1b9a8e854b0f69fb8a4b576f3f7f5868a9925c22 | |
parent | 4505c252701990cb85b6c65d2be025cc1f2685b0 (diff) | |
download | NetworkManager-a01198863a18466a25f5eaf97d878e9db9ed1a67.tar.gz |
n-dhcp4: move back to INIT after lease expires
Move back to INIT state after the lease expires, as per section 4.4.5
of RFC 2131. Previously the client just moved to EXPIRED, closed the
connection and cleared the probe, leaving to the caller of the library
the choice to create a new client instance and to start from
scratch. However, it seems more useful that the client, once
initialized, always tries to get a lease even after an expiration.
(cherry picked from commit 182a8021f39c943af87d2bfc703d09dbc7e25bf7)
-rw-r--r-- | shared/n-dhcp4/src/n-dhcp4-c-probe.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/shared/n-dhcp4/src/n-dhcp4-c-probe.c b/shared/n-dhcp4/src/n-dhcp4-c-probe.c index f4962d6995..bfead036bd 100644 --- a/shared/n-dhcp4/src/n-dhcp4-c-probe.c +++ b/shared/n-dhcp4/src/n-dhcp4-c-probe.c @@ -841,11 +841,10 @@ static int n_dhcp4_client_probe_transition_lifetime(NDhcp4ClientProbe *probe) { return r; c_assert(probe->client->current_probe == probe); - probe->client->current_probe = NULL; - - n_dhcp4_c_connection_close(&probe->connection); + probe->current_lease = n_dhcp4_client_lease_unref(probe->current_lease); - probe->state = N_DHCP4_CLIENT_PROBE_STATE_EXPIRED; + probe->state = N_DHCP4_CLIENT_PROBE_STATE_INIT; + probe->ns_deferred = n_dhcp4_gettime(CLOCK_BOOTTIME) + UINT64_C(1); break; |