diff options
author | Javier Cardona <javier@cozybit.com> | 2011-05-04 13:24:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-11 14:37:48 -0400 |
commit | 0a35d36d6f019bde6c98812456798275b02e5aee (patch) | |
tree | b2605d9a45226072c430d35f39f82082d99df8a8 | |
parent | 915b5c50f8f45e78ea96d93f1e49edb20c9470bd (diff) |
cfg80211: Use capability info to detect mesh beacons.
Mesh beacons no longer use all-zeroes BSSID. Beacon frames for MBSS,
infrastructure BSS, or IBSS are differentiated by the Capability
Information field in the Beacon frame. A mesh STA sets the ESS and IBSS
subfields to 0 in transmitted Beacon or Probe Response management
frames.
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/linux/ieee80211.h | 5 | ||||
-rw-r--r-- | net/wireless/scan.c | 14 |
2 files changed, 12 insertions, 7 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index ee1c96a866cc..d527fb7bd67a 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -1002,6 +1002,11 @@ struct ieee80211_ht_info { | |||
1002 | 1002 | ||
1003 | #define WLAN_CAPABILITY_ESS (1<<0) | 1003 | #define WLAN_CAPABILITY_ESS (1<<0) |
1004 | #define WLAN_CAPABILITY_IBSS (1<<1) | 1004 | #define WLAN_CAPABILITY_IBSS (1<<1) |
1005 | |||
1006 | /* A mesh STA sets the ESS and IBSS capability bits to zero */ | ||
1007 | #define WLAN_CAPABILITY_IS_MBSS(cap) \ | ||
1008 | (!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS))) | ||
1009 | |||
1005 | #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) | 1010 | #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) |
1006 | #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) | 1011 | #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) |
1007 | #define WLAN_CAPABILITY_PRIVACY (1<<4) | 1012 | #define WLAN_CAPABILITY_PRIVACY (1<<4) |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index fbf6f33ae4d0..62e542a2b192 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -210,7 +210,7 @@ static bool is_mesh(struct cfg80211_bss *a, | |||
210 | { | 210 | { |
211 | const u8 *ie; | 211 | const u8 *ie; |
212 | 212 | ||
213 | if (!is_zero_ether_addr(a->bssid)) | 213 | if (!WLAN_CAPABILITY_IS_MBSS(a->capability)) |
214 | return false; | 214 | return false; |
215 | 215 | ||
216 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, | 216 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, |
@@ -248,11 +248,7 @@ static int cmp_bss(struct cfg80211_bss *a, | |||
248 | if (a->channel != b->channel) | 248 | if (a->channel != b->channel) |
249 | return b->channel->center_freq - a->channel->center_freq; | 249 | return b->channel->center_freq - a->channel->center_freq; |
250 | 250 | ||
251 | r = memcmp(a->bssid, b->bssid, ETH_ALEN); | 251 | if (WLAN_CAPABILITY_IS_MBSS(a->capability | b->capability)) { |
252 | if (r) | ||
253 | return r; | ||
254 | |||
255 | if (is_zero_ether_addr(a->bssid)) { | ||
256 | r = cmp_ies(WLAN_EID_MESH_ID, | 252 | r = cmp_ies(WLAN_EID_MESH_ID, |
257 | a->information_elements, | 253 | a->information_elements, |
258 | a->len_information_elements, | 254 | a->len_information_elements, |
@@ -267,6 +263,10 @@ static int cmp_bss(struct cfg80211_bss *a, | |||
267 | b->len_information_elements); | 263 | b->len_information_elements); |
268 | } | 264 | } |
269 | 265 | ||
266 | r = memcmp(a->bssid, b->bssid, ETH_ALEN); | ||
267 | if (r) | ||
268 | return r; | ||
269 | |||
270 | return cmp_ies(WLAN_EID_SSID, | 270 | return cmp_ies(WLAN_EID_SSID, |
271 | a->information_elements, | 271 | a->information_elements, |
272 | a->len_information_elements, | 272 | a->len_information_elements, |
@@ -407,7 +407,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
407 | 407 | ||
408 | res->ts = jiffies; | 408 | res->ts = jiffies; |
409 | 409 | ||
410 | if (is_zero_ether_addr(res->pub.bssid)) { | 410 | if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) { |
411 | /* must be mesh, verify */ | 411 | /* must be mesh, verify */ |
412 | meshid = cfg80211_find_ie(WLAN_EID_MESH_ID, | 412 | meshid = cfg80211_find_ie(WLAN_EID_MESH_ID, |
413 | res->pub.information_elements, | 413 | res->pub.information_elements, |