From 4784c7dccda24a84c0a154d38fa59feb2443cc59 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 31 Mar 2021 15:25:38 +0200 Subject: 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 --- src/core/dhcp/nm-dhcp-client.c | 2 +- src/core/dhcp/nm-dhcp-client.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/dhcp/nm-dhcp-client.c b/src/core/dhcp/nm-dhcp-client.c index c128095aba..6c5305e170 100644 --- a/src/core/dhcp/nm-dhcp-client.c +++ b/src/core/dhcp/nm-dhcp-client.c @@ -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); } /*****************************************************************************/ diff --git a/src/core/dhcp/nm-dhcp-client.h b/src/core/dhcp/nm-dhcp-client.h index 72ab477dfb..af3406ccea 100644 --- a/src/core/dhcp/nm-dhcp-client.h +++ b/src/core/dhcp/nm-dhcp-client.h @@ -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 */ -- cgit v1.2.1