dhcp: set TERMINATED state when the client is stopped

NM_DHCP_STATE_DONE is for when the client reports that it is shutting
down. If we manually stop it, we should set the TERMINATED state, so
that NMDevice doesn't start a grace period waiting for a renewal.

This fixes the:

 device (enp1s0): DHCPv4: trying to acquire a new lease within 90 seconds

message printed when NM is shutting down.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/802
This commit is contained in:
Beniamino Galvani 2021-03-31 15:25:38 +02:00
parent b9e6b84cb9
commit 4784c7dccd
2 changed files with 2 additions and 2 deletions

View file

@ -749,7 +749,7 @@ nm_dhcp_client_stop(NMDhcpClient *self, gboolean release)
_LOGI("canceled DHCP transaction");
nm_assert(priv->pid == -1);
nm_dhcp_client_set_state(self, NM_DHCP_STATE_DONE, NULL, NULL);
nm_dhcp_client_set_state(self, NM_DHCP_STATE_TERMINATED, NULL, NULL);
}
/*****************************************************************************/

View file

@ -51,7 +51,7 @@ typedef enum {
NM_DHCP_STATE_BOUND, /* new lease */
NM_DHCP_STATE_EXTENDED, /* lease extended */
NM_DHCP_STATE_TIMEOUT, /* timed out contacting server */
NM_DHCP_STATE_DONE, /* client quit or stopped */
NM_DHCP_STATE_DONE, /* client reported it's stopping */
NM_DHCP_STATE_EXPIRE, /* lease expired or NAKed */
NM_DHCP_STATE_FAIL, /* failed for some reason */
NM_DHCP_STATE_TERMINATED, /* client is no longer running */