linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 05/07] mac80211: Purge cfg80211 beacon cache before authentication.
@ 2011-10-12  1:02 Dmitry Tarnyagin
  2011-10-12  8:31 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Tarnyagin @ 2011-10-12  1:02 UTC (permalink / raw)
  To: linux-wireless.vger.kernel.org; +Cc: Bartosz MARKOWSKI, Janusz DZIEDZIC

From: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
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.

Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
---
  net/mac80211/ieee80211_i.h |    1 +
  net/mac80211/mlme.c        |    1 +
  net/mac80211/work.c        |   22 ++++++++++++++++++++++
  3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 453bdb8..3dbaeb7 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -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;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 8c13619..dde286a 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -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)
diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index 8a93de7..4acf7ca 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -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);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC 05/07] mac80211: Purge cfg80211 beacon cache before authentication.
  2011-10-12  1:02 [RFC 05/07] mac80211: Purge cfg80211 beacon cache before authentication Dmitry Tarnyagin
@ 2011-10-12  8:31 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2011-10-12  8:31 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC

On Wed, 2011-10-12 at 03:02 +0200, Dmitry Tarnyagin wrote:
> From: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-12  8:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12  1:02 [RFC 05/07] mac80211: Purge cfg80211 beacon cache before authentication Dmitry Tarnyagin
2011-10-12  8:31 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).