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 514a3cb610)
(cherry picked from commit f2e61addc4)
This commit is contained in:
Beniamino Galvani 2024-05-10 16:57:40 +02:00
parent 55812963fd
commit a0825a8fd5

View file

@ -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;
}