diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2023-05-27 15:46:08 +0200 |
---|---|---|
committer | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2023-05-29 14:23:23 +0200 |
commit | 9d18510437d47fe492aa455485aa8e86e7e23dfe (patch) | |
tree | 1a2757fa6c795dabb7bbbb8a9f6fcf73c747e1a8 | |
parent | 8bdb53f7f8e3a5afeac164d73d189b19ed4b0298 (diff) |
manager: set the right reason when managing device after realizebg/rh2149012
When managing a device after it is realized, we previously always set
the NOW_MANAGED reason, that makes the device fully-managed.
This works based on the assumption that initially an external device
has unmanaged flag EXTERNAL_DOWN set, and therefore the device stays
unmanaged during realization.
It is possible that an external device appears already with addresses
(or attached to a controller); we need to set reason
CONNECTION_ASSUMED if it's an external device, so that we don't set
sys-iface-state=managed.
Reproducer:
ip link add br1 type bridge
killall -STOP NetworkManager
ip link add dummy1 type dummy
ip link set dummy1 master br1
ip link set dummy1 up
sleep .5
killall -CONT NetworkManager
After this, dummy1 is fully managed by NM while it shouldn't.
https://bugzilla.redhat.com/show_bug.cgi?id=2149012
-rw-r--r-- | src/core/nm-manager.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index 239fd7070c..323d7476e3 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -3947,7 +3947,7 @@ _device_realize_finish(NMManager *self, NMDevice *device, const NMPlatformLink * * is still unavailable. Set UNAVAILABLE state again, this time with NOW_MANAGED. */ nm_device_state_changed(device, NM_DEVICE_STATE_UNAVAILABLE, - NM_DEVICE_STATE_REASON_NOW_MANAGED); + nm_device_get_manage_reason_external(device)); nm_manager_device_recheck_auto_activate_schedule(self, device); } |