| 1 |
tetromino |
1.1 |
From 50435e1d5deff17233f1de73ee030a5982e9fd05 Mon Sep 17 00:00:00 2001 |
| 2 |
|
|
From: Dan Williams <dcbw@redhat.com> |
| 3 |
|
|
Date: Fri, 4 May 2012 14:26:10 -0500 |
| 4 |
|
|
Subject: [PATCH] wifi: attempt to use same kernel API wpa_supplicant does |
| 5 |
|
|
(bgo #675017) |
| 6 |
|
|
|
| 7 |
|
|
Some drivers (ipw2x00) support capabilities reporting via nl80211 but |
| 8 |
|
|
absolutely nothing else. NM was only checking for capabilities |
| 9 |
|
|
when deciding whether or not to use nl80211 to communicate with the |
| 10 |
|
|
driver for associated AP, signal strength, and channel info, and that |
| 11 |
|
|
clearly fails with half-implementations of nl80211 in the kernel. |
| 12 |
|
|
|
| 13 |
|
|
Instead, match the logic that wpa_supplicant uses to determine whether |
| 14 |
|
|
to stick with nl80211 or fall back to WEXT. For these drivers |
| 15 |
|
|
NM will now fall back to WEXT and should return to the behavior we |
| 16 |
|
|
had with 0.9.2 for these devices. |
| 17 |
|
|
--- |
| 18 |
|
|
src/wifi/wifi-utils-nl80211.c | 32 +++++++++++++++++++++++++++----- |
| 19 |
|
|
1 files changed, 27 insertions(+), 5 deletions(-) |
| 20 |
|
|
|
| 21 |
|
|
diff --git a/src/wifi/wifi-utils-nl80211.c b/src/wifi/wifi-utils-nl80211.c |
| 22 |
|
|
index 048d9d2..663cbc2 100644 |
| 23 |
|
|
--- a/src/wifi/wifi-utils-nl80211.c |
| 24 |
|
|
+++ b/src/wifi/wifi-utils-nl80211.c |
| 25 |
|
|
@@ -535,7 +535,9 @@ struct nl80211_device_info { |
| 26 |
|
|
guint32 *freqs; |
| 27 |
|
|
int num_freqs; |
| 28 |
|
|
guint32 caps; |
| 29 |
|
|
- gboolean can_scan, can_scan_ssid; |
| 30 |
|
|
+ gboolean can_scan; |
| 31 |
|
|
+ gboolean can_scan_ssid; |
| 32 |
|
|
+ gboolean supported; |
| 33 |
|
|
gboolean success; |
| 34 |
|
|
}; |
| 35 |
|
|
|
| 36 |
|
|
@@ -579,11 +581,24 @@ static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg) |
| 37 |
|
|
struct nlattr *nl_cmd; |
| 38 |
|
|
int i; |
| 39 |
|
|
|
| 40 |
|
|
- nla_for_each_nested (nl_cmd, |
| 41 |
|
|
- tb[NL80211_ATTR_SUPPORTED_COMMANDS], i) { |
| 42 |
|
|
- guint32 cmd = nla_get_u32 (nl_cmd); |
| 43 |
|
|
- if (cmd == NL80211_CMD_TRIGGER_SCAN) |
| 44 |
|
|
+ nla_for_each_nested (nl_cmd, tb[NL80211_ATTR_SUPPORTED_COMMANDS], i) { |
| 45 |
|
|
+ switch (nla_get_u32 (nl_cmd)) { |
| 46 |
|
|
+ case NL80211_CMD_TRIGGER_SCAN: |
| 47 |
|
|
info->can_scan = TRUE; |
| 48 |
|
|
+ break; |
| 49 |
|
|
+ case NL80211_CMD_CONNECT: |
| 50 |
|
|
+ case NL80211_CMD_AUTHENTICATE: |
| 51 |
|
|
+ /* Only devices that support CONNECT or AUTH actually support |
| 52 |
|
|
+ * 802.11, unlike say ipw2x00 (up to at least kernel 3.4) which |
| 53 |
|
|
+ * has minimal info support, but no actual command support. |
| 54 |
|
|
+ * This check mirrors what wpa_supplicant does to determine |
| 55 |
|
|
+ * whether or not to use the nl80211 driver. |
| 56 |
|
|
+ */ |
| 57 |
|
|
+ info->supported = TRUE; |
| 58 |
|
|
+ break; |
| 59 |
|
|
+ default: |
| 60 |
|
|
+ break; |
| 61 |
|
|
+ } |
| 62 |
|
|
} |
| 63 |
|
|
} |
| 64 |
|
|
|
| 65 |
|
|
@@ -724,6 +739,13 @@ wifi_nl80211_init (const char *iface, int ifindex) |
| 66 |
|
|
goto error; |
| 67 |
|
|
} |
| 68 |
|
|
|
| 69 |
|
|
+ if (!device_info.supported) { |
| 70 |
|
|
+ nm_log_dbg (LOGD_HW | LOGD_WIFI, |
| 71 |
|
|
+ "(%s): driver does not fully support nl80211, falling back to WEXT", |
| 72 |
|
|
+ nl80211->parent.iface); |
| 73 |
|
|
+ goto error; |
| 74 |
|
|
+ } |
| 75 |
|
|
+ |
| 76 |
|
|
if (!device_info.can_scan_ssid) { |
| 77 |
|
|
nm_log_err (LOGD_HW | LOGD_WIFI, |
| 78 |
|
|
"(%s): driver does not support SSID scans", |
| 79 |
|
|
-- |
| 80 |
|
|
1.7.8.6 |