From d9c1c10899a1186a28aaf2c7a7f99e54ba53a133 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 3 Feb 2022 11:28:53 +0100 Subject: [PATCH] ovs-port: always remove the OVSDB entry on slave release When the link is externally removed, the OVSDB entry will be left behind. That's not cool -- we need to remove it. https://bugzilla.redhat.com/show_bug.cgi?id=1935026 --- src/core/devices/ovs/nm-device-ovs-port.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/core/devices/ovs/nm-device-ovs-port.c b/src/core/devices/ovs/nm-device-ovs-port.c index b0a32b4771..4419cfe96f 100644 --- a/src/core/devices/ovs/nm-device-ovs-port.c +++ b/src/core/devices/ovs/nm-device-ovs-port.c @@ -146,18 +146,23 @@ release_slave(NMDevice *device, NMDevice *slave, gboolean configure) { NMDeviceOvsPort *self = NM_DEVICE_OVS_PORT(device); + _LOGI(LOGD_DEVICE, "releasing ovs interface %s", nm_device_get_ip_iface(slave)); + + /* Even if the an interface's device has gone away (e.g. externally + * removed and thus we're called with configure=FALSE), we still need + * to make sure its OVSDB entry is gone. + */ + nm_ovsdb_del_interface(nm_ovsdb_get(), + nm_device_get_iface(slave), + del_iface_cb, + g_object_ref(slave)); + if (configure) { - _LOGI(LOGD_DEVICE, "releasing ovs interface %s", nm_device_get_ip_iface(slave)); - nm_ovsdb_del_interface(nm_ovsdb_get(), - nm_device_get_iface(slave), - del_iface_cb, - g_object_ref(slave)); /* Open VSwitch is going to delete this one. We must ignore what happens * next with the interface. */ if (NM_IS_DEVICE_OVS_INTERFACE(slave)) nm_device_update_from_platform_link(slave, NULL); - } else - _LOGI(LOGD_DEVICE, "ovs interface %s was released", nm_device_get_ip_iface(slave)); + } } /*****************************************************************************/