Skip to content

Commit

Permalink
cfg80211: refuse authenticating to same BSSID twice
Browse files Browse the repository at this point in the history
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jul 10, 2009
1 parent 19957bb commit 0a9b5e1
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions net/wireless/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,21 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
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;
Expand All @@ -290,13 +305,6 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,

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;
Expand Down

0 comments on commit 0a9b5e1

Please sign in to comment.