[PATCH 4/4] device: match all UUIDs when no connection is active



nm_device_match_parent() is called to check whether a device is
compatible with a given parent (UUID or interface). Accept any UUID If
there is no connection active on the device.

Without this, when there is a VLAN/MACVLAN connection with a parent
UUID the manager would create the device in
system_create_virtual_device(), realize it and then at the next call
of system_create_virtual_device() it would notice that the connection
is not compatible with the device because of the parent UUID;
therefore the manager would try to create again the same device,
failing.

https://mail.gnome.org/archives/networkmanager-list/2017-September/msg00034.html
---
 src/devices/nm-device.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 6d51641f2..934d29fff 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -4405,12 +4405,13 @@ nm_device_match_parent (NMDevice *self, const char *parent)
                NMActiveConnection *ac;
                NMConnection *connection;
 
-               /* If the parent is a UUID, the connection matches if our parent
-                * device has that connection activated.
+               /* If the parent is a UUID, the connection matches when there is
+                * no connection active on the device or when a connection with
+                * that UUID is active.
                 */
                ac = (NMActiveConnection *) nm_device_get_act_request (parent_device);
                if (!ac)
-                       return FALSE;
+                       return TRUE;
 
                connection = nm_active_connection_get_applied_connection (ac);
                if (!connection)
-- 
2.13.5



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]