summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-03-04 10:09:47 +0100
committerThomas Haller <thaller@redhat.com>2019-03-04 10:10:47 +0100
commit6580f2931dd76d3dd0acf574c4ae563e3875fcb5 (patch)
tree754ffc9c7124f7524241eb83840ad5864bda8928
parentda100581188f71f60f1a59f4af368c431d860298 (diff)
downloadNetworkManager-6580f2931dd76d3dd0acf574c4ae563e3875fcb5.tar.gz
ifcfg-rh: avoid duplicate cache lookup in is_wifi_device()
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index ff1fc0beed..22560027fd 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -5231,16 +5231,14 @@ is_vlan_device (const char *name, shvarFile *parsed)
static gboolean
is_wifi_device (const char *name, shvarFile *parsed)
{
- int ifindex;
+ const NMPlatformLink *pllink;
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (parsed != NULL, FALSE);
- ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, name);
- if (ifindex == 0)
- return FALSE;
-
- return nm_platform_link_get_type (NM_PLATFORM_GET, ifindex) == NM_LINK_TYPE_WIFI;
+ pllink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, name);
+ return pllink
+ && pllink->type == NM_LINK_TYPE_WIFI;
}
static void