Skip to contentSkip to conversation

mac80211: Purge cfg80211 beacon cache before authentication.

RFC In review Dmitry Tarnyagin 2 participants 2 messages Oct 12, 2011 mac80211

lore
Share & tools
lore
#0 lore raw

RFC 5/7 mac80211: Purge cfg80211 beacon cache before authentication.

From: Dmitry Tarnyagin <[email protected]>
Date: Wed, 10 Aug 2011 19:15:13 +0200

cw1200 device requires SSID to be available at AUTH stage. cfg80211 beacon cache is designed to handle multi-SSID BSSes, so bss struct returned by cfg80211_get_bss() has random SSID if BSS just changed SSID before authentication (typical for p2p).

As a workaround cfg80211 beacon cache is purged to make sure target BSS is searchable in rb-tree at the AUTH stage.

---
 net/mac80211/ieee80211_i.h |    1 +
 net/mac80211/mlme.c        |    1 +
 net/mac80211/work.c        |   22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)
net/mac80211/ieee80211_i.h +1 -0
index 453bdb8..3dbaeb7 100644
@@ -325,6 +325,7 @@ struct ieee80211_work {
 			u8 key_len, key_idx;
 			bool privacy;
 			bool synced;
+			struct cfg80211_bss *bss;
 		} probe_auth;
 		struct {
 			struct cfg80211_bss *bss;
net/mac80211/mlme.c +1 -0
index 8c13619..dde286a 100644
@@ -2562,6 +2562,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
 
 	wk->probe_auth.algorithm = auth_alg;
 	wk->probe_auth.privacy = req->bss->capability & WLAN_CAPABILITY_PRIVACY;
+	wk->probe_auth.bss = req->bss;
 
 	/* if we already have a probe, don't probe again */
 	if (req->bss->proberesp_ies)
net/mac80211/work.c +22 -0
index 8a93de7..4acf7ca 100644
@@ -488,6 +488,28 @@ ieee80211_authenticate(struct ieee80211_work *wk)
 	struct ieee80211_sub_if_data *sdata = wk->sdata;
 	struct ieee80211_local *local = sdata->local;
 
+	/* At least one device requires SSID to be available at AUTH stage.
+	 * cfg80211 beacon cache is designed to handle multi-SSID BSSes, so
+	 * bss struct returned by cfg80211_get_bss() has random SSID if BSS
+	 * just changed SSID before authentication (it's typical for p2p).
+	 * As a workaround cfg80211 beacon cache is purged to make sure target
+	 * BSS is searchable in rb-tree at the AUTH stage.
+	 */
+	struct cfg80211_bss *bss;
+	while (true) {
+		bss = cfg80211_get_bss(local->hw.wiphy,
+				wk->probe_auth.bss->channel,
+				wk->probe_auth.bss->bssid,
+				NULL, 0, 0, 0);
+		if (WARN_ON(!bss))
+			break;
+		if (bss == wk->probe_auth.bss) {
+			cfg80211_put_bss(bss);
+			break;
+		}
+		cfg80211_unlink_bss(local->hw.wiphy, bss);
+	}
+
 	if (!wk->probe_auth.synced) {
 		int ret = drv_tx_sync(local, sdata, wk->filter_ta,
 				      IEEE80211_TX_SYNC_AUTH);
Signature · 1 line
1.7.1
maintainer
#1 lore raw
Quoted 10 lines · Dmitry Tarnyagin

From: Dmitry Tarnyagin <[email protected]>
Date: Wed, 10 Aug 2011 19:15:13 +0200

cw1200 device requires SSID to be available at AUTH stage. cfg80211 beacon cache is designed to handle multi-SSID BSSes, so bss struct returned by cfg80211_get_bss() has random SSID if BSS just changed SSID before authentication (typical for p2p).

As a workaround cfg80211 beacon cache is purged to make sure target BSS is searchable in rb-tree at the AUTH stage.

Funny, but hell no.

johannes