Package: network-manager / 0.9.4.0-10

14-use-same-kernel-API-as-wpa_supplicant.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
commit 50435e1d5deff17233f1de73ee030a5982e9fd05 (origin/wifi-fallback)
Author: Dan Williams <dcbw@redhat.com>
Date:   Fri May 4 14:26:10 2012 -0500

    wifi: attempt to use same kernel API wpa_supplicant does (bgo #675017)
    
    Some drivers (ipw2x00) support capabilities reporting via nl80211 but
    absolutely nothing else.  NM was only checking for capabilities
    when deciding whether or not to use nl80211 to communicate with the
    driver for associated AP, signal strength, and channel info, and that
    clearly fails with half-implementations of nl80211 in the kernel.
    
    Instead, match the logic that wpa_supplicant uses to determine whether
    to stick with nl80211 or fall back to WEXT.  For these drivers
    NM will now fall back to WEXT and should return to the behavior we
    had with 0.9.2 for these devices.

Index: network-manager/src/wifi/wifi-utils-nl80211.c
===================================================================
--- network-manager.orig/src/wifi/wifi-utils-nl80211.c	2012-05-15 02:00:59.049491794 +0200
+++ network-manager/src/wifi/wifi-utils-nl80211.c	2012-05-29 12:20:15.653087949 +0200
@@ -535,7 +535,9 @@
 	guint32 *freqs;
 	int num_freqs;
 	guint32 caps;
-	gboolean can_scan, can_scan_ssid;
+	gboolean can_scan;
+	gboolean can_scan_ssid;
+	gboolean supported;
 	gboolean success;
 };
 
@@ -579,11 +581,24 @@
 		struct nlattr *nl_cmd;
 		int i;
 
-		nla_for_each_nested (nl_cmd,
-				     tb[NL80211_ATTR_SUPPORTED_COMMANDS], i) {
-			guint32 cmd = nla_get_u32 (nl_cmd);
-			if (cmd == NL80211_CMD_TRIGGER_SCAN)
+		nla_for_each_nested (nl_cmd, tb[NL80211_ATTR_SUPPORTED_COMMANDS], i) {
+			switch (nla_get_u32 (nl_cmd)) {
+			case NL80211_CMD_TRIGGER_SCAN:
 				info->can_scan = TRUE;
+				break;
+			case NL80211_CMD_CONNECT:
+			case NL80211_CMD_AUTHENTICATE:
+				/* Only devices that support CONNECT or AUTH actually support
+				 * 802.11, unlike say ipw2x00 (up to at least kernel 3.4) which
+				 * has minimal info support, but no actual command support.
+				 * This check mirrors what wpa_supplicant does to determine
+				 * whether or not to use the nl80211 driver.
+				 */
+				info->supported = TRUE;
+				break;
+			default:
+				break;
+			}
 		}
 	}
 
@@ -720,6 +735,13 @@
 				    nl80211->parent.iface);
 		goto error;
 	}
+
+	if (!device_info.supported) {
+		nm_log_dbg (LOGD_HW | LOGD_WIFI,
+				    "(%s): driver does not fully support nl80211, falling back to WEXT",
+				    nl80211->parent.iface);
+		goto error;
+	}
 
 	if (!device_info.can_scan_ssid) {
 		nm_log_err (LOGD_HW | LOGD_WIFI,