From 3f54307650ee7434dfef63fdc83051aba2f94f8c Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 3 Jun 2019 16:23:18 +0200 Subject: [PATCH] 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: 27c281ac5a5c ('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 3c54b5eb2b6d24fe39b581f9d606b4a54600f8e8) (cherry picked from commit 591837d6f54e37b01daa98a9cd53682a4333f1d2) --- src/devices/nm-device.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 8b22ccc378..268b679d63 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -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 */