c995aec
From 473018d8b2628ce946cc35db432ac2bc68f6f912 Mon Sep 17 00:00:00 2001
c995aec
From: Dan Williams <dcbw@redhat.com>
c995aec
Date: Wed, 16 Oct 2013 12:29:13 -0500
c995aec
Subject: [PATCH] platform: detect non-mac80211 WiFi devices as WiFi (rh
c995aec
 #1015598)
c995aec
c995aec
Before NMPlatform landed, the old NMManager code looked at either
c995aec
DEVTYPE=wlan or asked the internal wifi utilities whether the
c995aec
device was WiFi or not.  This got lost when moving to NMPlatform.
c995aec
c995aec
It turns out that only mac80211-based drivers set the DEVTYPE=wlan
c995aec
flag in sysfs, while older WEXT, out-of-tree, and staging drivers
c995aec
often do not (though they should).
c995aec
c995aec
To avoid breaking recognition of these crappy drivers that used
c995aec
to work, re-add the wifi utils checks.
c995aec
---
c995aec
 src/platform/nm-linux-platform.c | 7 +++++--
c995aec
 1 file changed, 5 insertions(+), 2 deletions(-)
c995aec
c995aec
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
c995aec
index 0bea01b..82286ec 100644
c995aec
--- a/src/platform/nm-linux-platform.c
c995aec
+++ b/src/platform/nm-linux-platform.c
c995aec
@@ -41,14 +41,15 @@
c995aec
 #include <netlink/route/link/vlan.h>
c995aec
 #include <netlink/route/addr.h>
c995aec
 #include <netlink/route/route.h>
c995aec
 #include <gudev/gudev.h>
c995aec
 
c995aec
 #include "nm-linux-platform.h"
c995aec
 #include "nm-logging.h"
c995aec
+#include "wifi/wifi-utils.h"
c995aec
 
c995aec
 /* This is only included for the translation of VLAN flags */
c995aec
 #include "nm-setting-vlan.h"
c995aec
 
c995aec
 #define debug(...) nm_log_dbg (LOGD_PLATFORM, __VA_ARGS__)
c995aec
 #define warning(...) nm_log_warn (LOGD_PLATFORM, __VA_ARGS__)
c995aec
 #define error(...) nm_log_err (LOGD_PLATFORM, __VA_ARGS__)
c995aec
@@ -473,26 +474,28 @@ type_to_string (NMLinkType type)
c995aec
 	} G_STMT_END
c995aec
 
c995aec
 static NMLinkType
c995aec
 link_type_from_udev (NMPlatform *platform, int ifindex, int arptype, const char **out_name)
c995aec
 {
c995aec
 	NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
c995aec
 	GUdevDevice *udev_device;
c995aec
-	const char *prop;
c995aec
+	const char *prop, *name, *sysfs_path;
c995aec
 
c995aec
 	udev_device = g_hash_table_lookup (priv->udev_devices, GINT_TO_POINTER (ifindex));
c995aec
 	if (!udev_device)
c995aec
 		return_type (NM_LINK_TYPE_UNKNOWN, "unknown");
c995aec
 
c995aec
 	prop = g_udev_device_get_property (udev_device, "ID_NM_OLPC_MESH");
c995aec
 	if (prop)
c995aec
 		return_type (NM_LINK_TYPE_OLPC_MESH, "olpc-mesh");
c995aec
 
c995aec
 	prop = g_udev_device_get_property (udev_device, "DEVTYPE");
c995aec
-	if (g_strcmp0 (prop, "wlan") == 0)
c995aec
+	name = g_udev_device_get_name (udev_device);
c995aec
+	sysfs_path = g_udev_device_get_sysfs_path (udev_device);
c995aec
+	if (g_strcmp0 (prop, "wlan") == 0 || wifi_utils_is_wifi (name, sysfs_path))
c995aec
 		return_type (NM_LINK_TYPE_WIFI, "wifi");
c995aec
 	else if (g_strcmp0 (prop, "wwan") == 0)
c995aec
 		return_type (NM_LINK_TYPE_WWAN_ETHERNET, "wwan");
c995aec
 
c995aec
 	if (arptype == ARPHRD_ETHER)
c995aec
 		return_type (NM_LINK_TYPE_ETHERNET, "ethernet");
c995aec
 
c995aec
-- 
c995aec
1.8.3.1
c995aec