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
This commit is contained in:
Beniamino Galvani 2017-09-27 10:23:31 +02:00
parent d2e4a2f639
commit 6a5363bc8b

View file

@ -4404,12 +4404,13 @@ nm_device_match_parent (NMDevice *self, const char *parent)
if (nm_utils_is_uuid (parent)) {
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.
*/
connection = nm_device_get_applied_connection (self);
if (!connection)
return FALSE;
return TRUE;
if (!nm_streq0 (parent, nm_connection_get_uuid (connection)))
return FALSE;