diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2022-06-20 15:55:27 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2022-06-24 12:02:45 +0200 |
commit | f8885d072472c3281ada57e5ba99fb14423a5642 (patch) | |
tree | 9e84577eaac554efbae4b1cbd247e60c3cb05f1c | |
parent | eb90ebc5307e6feb81703d81858164b899637215 (diff) | |
download | NetworkManager-f8885d072472c3281ada57e5ba99fb14423a5642.tar.gz |
core: avoid stale entries in the DNS manager for non-virtual devicesbg/cleanup-dns-for-removed
_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: b86388bef375 ('core: avoid stale entries in the DNS manager')
Fixes: 58287cbcc0c8 ('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
-rw-r--r-- | src/core/devices/nm-device.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 30055f109f..a96a9e581d 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -7975,7 +7975,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)); @@ -7993,6 +7994,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 |