core: avoid stale entries in the DNS manager for non-virtual devices

_dev_l3_register_l3cds() schedules a commit, but if the device has
commit type NONE, that doesn't emit a l3cd-changed. Do it manually,
to ensure that entries are removed from the DNS manager.

Related: b86388bef3 ('core: avoid stale entries in the DNS manager')
Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/995
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1268
(cherry picked from commit f8885d0724)
This commit is contained in:
Beniamino Galvani 2022-06-20 15:55:27 +02:00
parent 7368f322f8
commit 4baec297f4

View file

@ -7857,7 +7857,8 @@ nm_device_slave_notify_release(NMDevice *self, NMDeviceStateReason reason)
void
nm_device_removed(NMDevice *self, gboolean unconfigure_ip_config)
{
NMDevicePrivate *priv;
NMDevicePrivate *priv;
const NML3ConfigData *l3cd_old;
g_return_if_fail(NM_IS_DEVICE(self));
@ -7875,6 +7876,18 @@ nm_device_removed(NMDevice *self, gboolean unconfigure_ip_config)
}
_dev_l3_register_l3cds(self, priv->l3cfg, FALSE, unconfigure_ip_config);
/* _dev_l3_register_l3cds() schedules a commit, but if the device has
* commit type NONE, that doesn't emit a l3cd-changed. Do it manually,
* to ensure that entries are removed from the DNS manager. */
if (priv->l3cfg
&& NM_IN_SET(priv->sys_iface_state,
NM_DEVICE_SYS_IFACE_STATE_REMOVED,
NM_DEVICE_SYS_IFACE_STATE_EXTERNAL)) {
l3cd_old = nm_l3cfg_get_combined_l3cd(priv->l3cfg, TRUE);
if (l3cd_old)
g_signal_emit(self, signals[L3CD_CHANGED], 0, l3cd_old, NULL);
}
}
static gboolean