Commit 0a9b5e17 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

cfg80211: refuse authenticating to same BSSID twice

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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 19957bb3
...@@ -278,6 +278,21 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, ...@@ -278,6 +278,21 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
int i, err, slot = -1, nfree = 0; 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)); memset(&req, 0, sizeof(req));
req.ie = ie; req.ie = ie;
...@@ -290,13 +305,6 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, ...@@ -290,13 +305,6 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
bss = bss_from_pub(req.bss); 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++) { for (i = 0; i < MAX_AUTH_BSSES; i++) {
if (!wdev->auth_bsses[i] && !wdev->authtry_bsses[i]) { if (!wdev->auth_bsses[i] && !wdev->authtry_bsses[i]) {
slot = i; slot = i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment