From 33ce44002c27b03d29e3e9a890f665354d2d154c Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Mon, 24 Jul 2023 12:45:02 +0200 Subject: device: delete software device when lose carrier and is controller Software devices that are controllers like bond/bridge/team when configured to not ignore carrier are being deleted when deactivating the device. Software devices that are not controllers, shouldn't be deleted. Otherwise, if a VLAN link is deleted because the ethernet carrier-change then NetworkManager won't be able to reactivate the VLAN once the ethernet gets carrier because the link is not present. This is restoring the previous behaviour and it's know to be relied on by users. https://bugzilla.redhat.com/show_bug.cgi?id=2224479 Fixes: efa63aef3aeb ('device: delete software device when software devices lose carrier') --- src/core/devices/nm-device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 10df06ae7e..2038e2f205 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -15769,7 +15769,11 @@ _cleanup_generic_post(NMDevice *self, NMDeviceStateReason reason, CleanupType cl act_request_set(self, NULL); } - if (cleanup_type == CLEANUP_TYPE_DECONFIGURE && reason != NM_DEVICE_STATE_REASON_NOW_MANAGED) { + if (cleanup_type == CLEANUP_TYPE_DECONFIGURE + && ((reason == NM_DEVICE_STATE_REASON_CARRIER && nm_device_is_master(self)) + || !NM_IN_SET(reason, + NM_DEVICE_STATE_REASON_NOW_MANAGED, + NM_DEVICE_STATE_REASON_CARRIER))) { /* Check if the device was deactivated, and if so, delete_link. * Don't call delete_link synchronously because we are currently * handling a state change -- which is not reentrant. */ -- cgit v1.2.3