Commit 0a35d36d6f019bde6c98812456798275b02e5aee
Committed by
John W. Linville
1 parent
915b5c50f8
Exists in
master
and in
7 other branches
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>
Showing 2 changed files with 12 additions and 7 deletions Side-by-side Diff
include/linux/ieee80211.h
... | ... | @@ -1002,6 +1002,11 @@ |
1002 | 1002 | |
1003 | 1003 | #define WLAN_CAPABILITY_ESS (1<<0) |
1004 | 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 | 1010 | #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) |
1006 | 1011 | #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) |
1007 | 1012 | #define WLAN_CAPABILITY_PRIVACY (1<<4) |
net/wireless/scan.c
... | ... | @@ -210,7 +210,7 @@ |
210 | 210 | { |
211 | 211 | const u8 *ie; |
212 | 212 | |
213 | - if (!is_zero_ether_addr(a->bssid)) | |
213 | + if (!WLAN_CAPABILITY_IS_MBSS(a->capability)) | |
214 | 214 | return false; |
215 | 215 | |
216 | 216 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, |
... | ... | @@ -248,11 +248,7 @@ |
248 | 248 | if (a->channel != b->channel) |
249 | 249 | return b->channel->center_freq - a->channel->center_freq; |
250 | 250 | |
251 | - r = memcmp(a->bssid, b->bssid, ETH_ALEN); | |
252 | - if (r) | |
253 | - return r; | |
254 | - | |
255 | - if (is_zero_ether_addr(a->bssid)) { | |
251 | + if (WLAN_CAPABILITY_IS_MBSS(a->capability | b->capability)) { | |
256 | 252 | r = cmp_ies(WLAN_EID_MESH_ID, |
257 | 253 | a->information_elements, |
258 | 254 | a->len_information_elements, |
... | ... | @@ -267,6 +263,10 @@ |
267 | 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 | 270 | return cmp_ies(WLAN_EID_SSID, |
271 | 271 | a->information_elements, |
272 | 272 | a->len_information_elements, |
... | ... | @@ -407,7 +407,7 @@ |
407 | 407 | |
408 | 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 | 411 | /* must be mesh, verify */ |
412 | 412 | meshid = cfg80211_find_ie(WLAN_EID_MESH_ID, |
413 | 413 | res->pub.information_elements, |