summaryrefslogtreecommitdiff
path: root/src/devices/nm-device-macvlan.c
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-09-27 09:40:45 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2017-09-28 10:54:01 +0200
commit27c281ac5a5c786f996230926ba40e2026ce4d4f (patch)
treeb946a982c1b5b5d36db83ed8bed3ea110fa090ea /src/devices/nm-device-macvlan.c
parented640f857a1a1eae45d92cce35ea8dcfd8aba08d (diff)
downloadNetworkManager-27c281ac5a5c786f996230926ba40e2026ce4d4f.tar.gz
device: deduplicate match_parent()
Diffstat (limited to 'src/devices/nm-device-macvlan.c')
-rw-r--r--src/devices/nm-device-macvlan.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c
index 8803beb524..ffaa094cb9 100644
--- a/src/devices/nm-device-macvlan.c
+++ b/src/devices/nm-device-macvlan.c
@@ -286,45 +286,6 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
/*****************************************************************************/
-
-static gboolean
-match_parent (NMDeviceMacvlan *self, const char *parent)
-{
- NMDevice *parent_device;
-
- g_return_val_if_fail (parent != NULL, FALSE);
-
- parent_device = nm_device_parent_get_device (NM_DEVICE (self));
- if (!parent_device)
- return FALSE;
-
- if (nm_utils_is_uuid (parent)) {
- NMActRequest *parent_req;
- NMConnection *parent_connection;
-
- /* If the parent is a UUID, the connection matches if our parent
- * device has that connection activated.
- */
-
- parent_req = nm_device_get_act_request (parent_device);
- if (!parent_req)
- return FALSE;
-
- parent_connection = nm_active_connection_get_applied_connection (NM_ACTIVE_CONNECTION (parent_req));
- if (!parent_connection)
- return FALSE;
-
- if (g_strcmp0 (parent, nm_connection_get_uuid (parent_connection)) != 0)
- return FALSE;
- } else {
- /* interface name */
- if (g_strcmp0 (parent, nm_device_get_ip_iface (parent_device)) != 0)
- return FALSE;
- }
-
- return TRUE;
-}
-
static gboolean
match_hwaddr (NMDevice *device, NMConnection *connection, gboolean fail_if_no_hwaddr)
{
@@ -378,7 +339,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
/* Check parent interface; could be an interface name or a UUID */
parent = nm_setting_macvlan_get_parent (s_macvlan);
if (parent) {
- if (!match_parent (NM_DEVICE_MACVLAN (device), parent))
+ if (!nm_device_match_parent (device, parent))
return FALSE;
} else {
/* Parent could be a MAC address in an NMSettingWired */