device: fix matching parent device by connection UUID

We must compare the UUID with the one on the *parent* device.

Also, simplify the checks to only return TRUE at the end of function.

Fixes: 27c281ac5a ('device: deduplicate match_parent()')

https://bugzilla.redhat.com/show_bug.cgi?id=1716438
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/176
(cherry picked from commit 3c54b5eb2b)
(cherry picked from commit 591837d6f5)
This commit is contained in:
Beniamino Galvani 2019-06-03 16:23:18 +02:00
parent ec6b243738
commit 3f54307650

View file

@ -5643,11 +5643,9 @@ nm_device_match_parent (NMDevice *self, const char *parent)
* 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 TRUE;
if (!nm_streq0 (parent, nm_connection_get_uuid (connection)))
connection = nm_device_get_applied_connection (parent_device);
if ( connection
&& !nm_streq0 (parent, nm_connection_get_uuid (connection)))
return FALSE;
} else {
/* Interface name */