linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry Tarnyagin" <abi.dmitryt@gmail.com>
To: "linux-wireless.vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: "Bartosz MARKOWSKI" <bartosz.markowski@tieto.com>,
	"Janusz DZIEDZIC" <janusz.dziedzic@tieto.com>
Subject: [RFC 05/07] mac80211: Purge cfg80211 beacon cache before authentication.
Date: Wed, 12 Oct 2011 03:02:48 +0200	[thread overview]
Message-ID: <op.v27ruyliya27un@edmitar> (raw)

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

             reply	other threads:[~2011-10-12  1:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-12  1:02 Dmitry Tarnyagin [this message]
2011-10-12  8:31 ` [RFC 05/07] mac80211: Purge cfg80211 beacon cache before authentication Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.v27ruyliya27un@edmitar \
    --to=abi.dmitryt@gmail.com \
    --cc=bartosz.markowski@tieto.com \
    --cc=janusz.dziedzic@tieto.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).