public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cfg80211: refuse authenticating to same BSSID twice
@ 2009-07-02 16:26 Johannes Berg
  0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2009-07-02 16:26 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

It is possible that there are different BSS structs with
the same BSSID, but we cannot authenticate with multiple
of them them because we need the BSSID to be unique for
deauthenticating/disassociating.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/wireless/mlme.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

--- wireless-testing.orig/net/wireless/mlme.c	2009-07-02 18:18:51.000000000 +0200
+++ wireless-testing/net/wireless/mlme.c	2009-07-02 18:24:03.000000000 +0200
@@ -278,6 +278,21 @@ int cfg80211_mlme_auth(struct cfg80211_r
 	struct cfg80211_internal_bss *bss;
 	int i, err, slot = -1, nfree = 0;
 
+	if (wdev->current_bss &&
+	    memcmp(bssid, wdev->current_bss->pub.bssid, ETH_ALEN) == 0)
+		return -EALREADY;
+
+	for (i = 0; i < MAX_AUTH_BSSES; i++) {
+		if (wdev->authtry_bsses[i] &&
+		    memcmp(bssid, wdev->authtry_bsses[i]->pub.bssid,
+		    				ETH_ALEN) == 0)
+			return -EALREADY;
+		if (wdev->auth_bsses[i] &&
+		    memcmp(bssid, wdev->auth_bsses[i]->pub.bssid,
+		    				ETH_ALEN) == 0)
+			return -EALREADY;
+	}
+
 	memset(&req, 0, sizeof(req));
 
 	req.ie = ie;
@@ -291,13 +306,6 @@ int cfg80211_mlme_auth(struct cfg80211_r
 	bss = bss_from_pub(req.bss);
 
 	for (i = 0; i < MAX_AUTH_BSSES; i++) {
-		if (bss == wdev->auth_bsses[i]) {
-			err = -EALREADY;
-			goto out;
-		}
-	}
-
-	for (i = 0; i < MAX_AUTH_BSSES; i++) {
 		if (!wdev->auth_bsses[i] && !wdev->authtry_bsses[i]) {
 			slot = i;
 			nfree++;



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-02 16:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-02 16:26 [PATCH] cfg80211: refuse authenticating to same BSSID twice Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox