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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1701

Fixes: efa63aef3a ('device: delete software device when software devices lose carrier')
This commit is contained in:
Fernando Fernandez Mancera 2023-07-24 12:45:02 +02:00
parent 9f01cff04f
commit 7b33aa15d5

View file

@ -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. */