mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
dhcp: remove l3cds when the lease expires
When the lease is lost, NM tries to get a new by restarting the DHCP transaction. However, it doesn't delete the existing l3cds (one from the DHCP client with flag ONLY_FOR_ACD, the other from NMDevice). Therefore, the l3cfg still tracks the ACD state of the address as "external-removed", and when NM gets the same address via DHCP, ACD is considered as failed; as a consequence, NM sends a DECLINE message to the server. Moreover, the l3cd added by NMDevice for DHCP has a zero ACD timeout, and so it's not possible to do ACD again on the same address. Remove those l3cds when the lease expires, so that any ACD state is cleared and DHCP can perform ACD again. Fixes:240ec7f891
('dhcp: implement ACD (address collision detection) for DHCPv4') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1853 (cherry picked from commita80fef9f37
)
This commit is contained in:
parent
8776409483
commit
fe734c5c11
|
@ -10880,7 +10880,16 @@ _dev_ipdhcpx_notify(NMDhcpClient *client, const NMDhcpClientNotifyData *notify_d
|
|||
case NM_DHCP_CLIENT_NOTIFY_TYPE_LEASE_UPDATE:
|
||||
|
||||
if (!notify_data->lease_update.l3cd) {
|
||||
const NML3ConfigData *dhcp_l3cd = priv->l3cds[L3_CONFIG_DATA_TYPE_DHCP_X(IS_IPv4)].d;
|
||||
|
||||
_LOGT_ipdhcp(addr_family, "lease lost");
|
||||
if (dhcp_l3cd
|
||||
&& nm_l3cfg_remove_config(
|
||||
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);
|
||||
}
|
||||
goto lease_update_out;
|
||||
}
|
||||
|
||||
|
|
|
@ -899,6 +899,12 @@ _nm_dhcp_client_notify(NMDhcpClient *self,
|
|||
|
||||
l3_cfg_notify_check_connected(self);
|
||||
|
||||
if (!priv->l3cd_curr) {
|
||||
/* When the lease is lost, any cached ACD information is no longer relevant.
|
||||
* Remove it so that it doesn't interfere with a new lease we might get. */
|
||||
_acd_state_reset(self, TRUE, TRUE);
|
||||
}
|
||||
|
||||
_emit_notify(self,
|
||||
NM_DHCP_CLIENT_NOTIFY_TYPE_LEASE_UPDATE,
|
||||
.lease_update = {
|
||||
|
|
Loading…
Reference in a new issue