2007-04-14 01:42:06

by Michael Wu

[permalink] [raw]
Subject: [PATCH] mac80211: Always report supported rates in scan results

mac80211: Always report supported rates in scan results

From: Michael Wu <[email protected]>

This makes mac80211 always report supported rates in the scan results.

Signed-off-by: Michael Wu <[email protected]>
---

net/mac80211/ieee80211_sta.c | 38 ++++++++++++++++++++------------------
1 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 1648c76..fc43b24 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -3013,6 +3013,25 @@ ieee80211_sta_scan_result(struct net_device *dev,
bss->rsn_ie);
}

+ if (bss && bss->supp_rates_len > 0) {
+ /* display all supported rates in readable format */
+ char *p = current_ev + IW_EV_LCP_LEN;
+ int i;
+
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWRATE;
+ /* Those two flags are ignored... */
+ iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+
+ for (i = 0; i < bss->supp_rates_len; i++) {
+ iwe.u.bitrate.value = ((bss->supp_rates[i] &
+ 0x7f) * 500000);
+ p = iwe_stream_add_value(current_ev, p,
+ end_buf, &iwe, IW_EV_PARAM_LEN);
+ }
+ current_ev = p;
+ }
+
if (bss) {
char *buf;
buf = kmalloc(30, GFP_ATOMIC);
@@ -3028,8 +3047,7 @@ ieee80211_sta_scan_result(struct net_device *dev,
}

do {
- char *buf, *p;
- int i;
+ char *buf;

if (!(local->scan_flags & IEEE80211_SCAN_EXTRA_INFO))
break;
@@ -3052,22 +3070,6 @@ ieee80211_sta_scan_result(struct net_device *dev,
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
buf);

- /* dispaly all support rates in readable format */
- p = current_ev + IW_EV_LCP_LEN;
- iwe.cmd = SIOCGIWRATE;
- /* Those two flags are ignored... */
- iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
-
- for (i = 0; i < bss->supp_rates_len; i++) {
- iwe.u.bitrate.value = ((bss->supp_rates[i] &
- 0x7f) * 500000);
- p = iwe_stream_add_value(current_ev, p,
- end_buf, &iwe, IW_EV_PARAM_LEN);
- }
- /* Check if we added any rate */
- if((p - current_ev) > IW_EV_LCP_LEN)
- current_ev = p;
-
kfree(buf);
break;
} while (0);


Attachments:
(No filename) (2.09 kB)
(No filename) (189.00 B)
Download all attachments