Commit b86388be authored by Beniamino Galvani's avatar Beniamino Galvani
Browse files

core: avoid stale entries in the DNS manager

When a virtual interface is removed externally, the device is
unrealized and the ifindex is cleared; this also detaches the existing
l3cfg from the device. At this point the l3cd entry for the device
lingers forever in the DNS manager.

Emit a last L3CD_CHANGED so that the old entry gets removed.

Fixes-test: @disconnect_from_pppoe
parent 443c380f
......@@ -3980,6 +3980,18 @@ _set_ifindex(NMDevice *self, int ifindex, gboolean is_ip_ifindex)
 
if (priv->l3cfg) {
if (ip_ifindex_new <= 0 || ip_ifindex_new != nm_l3cfg_get_ifindex(priv->l3cfg)) {
const NML3ConfigData *l3cd_old;
if (ip_ifindex_new <= 0) {
/* The ifindex was reset. Send a last L3CD_CHANGED
* signal with a NULL l3cd so that the old one can
* be removed from the DNS manager.
*/
l3cd_old = nm_l3cfg_get_combined_l3cd(priv->l3cfg, TRUE);
if (l3cd_old)
g_signal_emit(self, signals[L3CD_CHANGED], 0, l3cd_old, NULL);
}
g_signal_handlers_disconnect_by_func(priv->l3cfg,
G_CALLBACK(_dev_l3_cfg_notify_cb),
self);
......
......@@ -2120,7 +2120,7 @@ device_l3cd_changed(NMDevice * device,
* now.
*/
state = nm_device_get_state(device);
if (state > NM_DEVICE_STATE_DISCONNECTED && state < NM_DEVICE_STATE_DEACTIVATING) {
if (l3cd_new && state > NM_DEVICE_STATE_DISCONNECTED && state < NM_DEVICE_STATE_DEACTIVATING) {
nm_dns_manager_set_ip_config(priv->dns_manager,
AF_UNSPEC,
device,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment