core: fix detection of non-mac80211 devices that do not set DEVTYPE (rh #1015598)

This commit is contained in:
Dan Williams 2013-11-14 11:02:45 -06:00 committed by Dan Winship
parent 9e072a43ad
commit bc22bc29b3
2 changed files with 80 additions and 1 deletions

View File

@ -19,7 +19,7 @@ Name: NetworkManager
Summary: Network connection manager and user applications
Epoch: 1
Version: 0.9.9.0
Release: 16%{snapshot}%{?dist}
Release: 17%{snapshot}%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
@ -34,6 +34,7 @@ Patch4: rh1019021-fix-crash-ip6-routing.patch
Patch5: rh1025007-fix-crash-ifcfg-rh.patch
Patch6: rh1012151-ipv6-disable.patch
Patch7: rh1029213-debug-netlink-add-errors.patch
Patch8: rh1015598-wifi-detect.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -164,6 +165,7 @@ deployments.
%patch5 -p1 -b .patch5
%patch6 -p1 -b .patch6
%patch7 -p1 -b .patch7
%patch8 -p1 -b .patch8
%build
@ -362,6 +364,9 @@ fi
%config %{_sysconfdir}/%{name}/conf.d/00-server.conf
%changelog
* Thu Nov 14 2013 Dan Williams <dcbw@redhat.com> - 0.9.9.0-17.git20131003
- core: fix detection of non-mac80211 devices that do not set DEVTYPE (rh #1015598)
* Wed Nov 13 2013 Dan Williams <dcbw@redhat.com> - 0.9.9.0-16.git20131003
- core: add some debugging to help diagnose netlink errors (rh #1029213)

View File

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