From 732b63ffb7d9c4cc8f3ec04a89a02d0ab3ae5aad Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 24 May 2018 15:03:40 +0200 Subject: [PATCH] paltform: add type argument to nm_platform_link_get_by_address() Devices of different link types can actually have the same MAC address. We'll want to use this to find a device of a particular type by its hardware address. --- src/platform/nm-platform.c | 5 +++-- src/platform/nm-platform.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 96bb2928e..3fc3ee247 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2012 - 2017 Red Hat, Inc. + * Copyright (C) 2012 - 2018 Red Hat, Inc. */ #include "nm-default.h" @@ -807,6 +807,7 @@ _nm_platform_link_get_by_address_match_link (const NMPObject *obj, struct _nm_pl **/ const NMPlatformLink * nm_platform_link_get_by_address (NMPlatform *self, + NMLinkType link_type, gconstpointer address, size_t length) { @@ -827,7 +828,7 @@ nm_platform_link_get_by_address (NMPlatform *self, g_return_val_if_reached (NULL); obj = nmp_cache_lookup_link_full (nm_platform_get_cache (self), - 0, NULL, TRUE, NM_LINK_TYPE_NONE, + 0, NULL, TRUE, link_type, (NMPObjectMatchFn) _nm_platform_link_get_by_address_match_link, &d); return NMP_OBJECT_CAST_LINK (obj); } diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 84d10d2af..a19c3289d 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2009 - 2017 Red Hat, Inc. + * Copyright (C) 2009 - 2018 Red Hat, Inc. */ #ifndef __NETWORKMANAGER_PLATFORM_H__ @@ -1079,7 +1079,7 @@ const NMPObject *nm_platform_link_get_obj (NMPlatform *self, gboolean visible_only); const NMPlatformLink *nm_platform_link_get (NMPlatform *self, int ifindex); const NMPlatformLink *nm_platform_link_get_by_ifname (NMPlatform *self, const char *ifname); -const NMPlatformLink *nm_platform_link_get_by_address (NMPlatform *self, gconstpointer address, size_t length); +const NMPlatformLink *nm_platform_link_get_by_address (NMPlatform *self, NMLinkType link_type, gconstpointer address, size_t length); GPtrArray *nm_platform_link_get_all (NMPlatform *self, gboolean sort_by_name); NMPlatformError nm_platform_link_dummy_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);