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
This commit is contained in:
Beniamino Galvani 2024-05-10 16:57:40 +02:00
parent 593b4e01a4
commit 514a3cb610

View file

@ -11053,7 +11053,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;
}