From a0825a8fd5cb82004de0a4aca2d88ce35bb2a00d Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 10 May 2024 16:57:40 +0200 Subject: [PATCH] dhcp: remove the address synchronously on lease expiry When the lease expires, the DHCP client emits a LEASE_UPDATE event with a NULL l3cd. After returning from the handler, it sends immediately a DHCP DISCOVER message to try to get a new lease. It is important that when the DISCOVER gets sent the address is no longer configured on the interface. Otherwise, the server could see that it is already in use and assign a different one. Therefore, remove the address synchronously when handling the event. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1532 (cherry picked from commit 514a3cb6100a1b9dc748f6a3f755dc64735255e1) (cherry picked from commit f2e61addc47e071654cc882f923b40cefbf0a400) --- src/core/devices/nm-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index a28ae7fc11..575dd2a8ff 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -10927,7 +10927,7 @@ _dev_ipdhcpx_notify(NMDhcpClient *client, const NMDhcpClientNotifyData *notify_d priv->l3cfg, _dev_l3_config_data_tag_get(priv, L3_CONFIG_DATA_TYPE_DHCP_X(IS_IPv4)), dhcp_l3cd)) { - _dev_l3_cfg_commit(self, FALSE); + _dev_l3_cfg_commit(self, TRUE); } goto lease_update_out; }