aboutsummaryrefslogtreecommitdiff
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-02 17:20:43 +0200
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:53 -0400
commit19957bb399e2722719c0e20c9ae91cf8b6aaff04 (patch)
tree9c4d53fe5938ceee41333a1afd5be0ed5c1ce313 /net/mac80211
parent517357c685ccc4b5783cc7dbdae8824ada19a97f (diff)
cfg80211: keep track of BSSes
In order to avoid problems with BSS structs going away while they're in use, I've long wanted to make cfg80211 keep track of them. Without the SME, that wasn't doable but now that we have the SME we can do this too. It can keep track of up to four separate authentications and one association, regardless of whether it's controlled by the cfg80211 SME or the userspace SME. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c22
-rw-r--r--net/mac80211/mlme.c6
2 files changed, 10 insertions, 18 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7606571d458..0f29cd0580c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1173,6 +1173,7 @@ static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_auth_request *req)
{
struct ieee80211_sub_if_data *sdata;
+ const u8 *ssid;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -1193,15 +1194,16 @@ static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
return -EOPNOTSUPP;
}
- memcpy(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN);
+ memcpy(sdata->u.mgd.bssid, req->bss->bssid, ETH_ALEN);
- sdata->local->oper_channel = req->chan;
+ sdata->local->oper_channel = req->bss->channel;
ieee80211_hw_config(sdata->local, 0);
- if (!req->ssid)
+ ssid = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID);
+ if (!ssid)
return -EINVAL;
- memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
- sdata->u.mgd.ssid_len = req->ssid_len;
+ sdata->u.mgd.ssid_len = *(ssid + 1);
+ memcpy(sdata->u.mgd.ssid, ssid + 2, sdata->u.mgd.ssid_len);
kfree(sdata->u.mgd.sme_auth_ie);
sdata->u.mgd.sme_auth_ie = NULL;
@@ -1227,7 +1229,7 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- if (memcmp(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN) != 0 ||
+ if (memcmp(sdata->u.mgd.bssid, req->bss->bssid, ETH_ALEN) != 0 ||
!(sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED))
return -ENOLINK; /* not authenticated */
@@ -1239,15 +1241,9 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104)
sdata->u.mgd.flags |= IEEE80211_STA_DISABLE_11N;
- sdata->local->oper_channel = req->chan;
+ sdata->local->oper_channel = req->bss->channel;
ieee80211_hw_config(sdata->local, 0);
- if (!req->ssid)
- return -EINVAL;
-
- memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
- sdata->u.mgd.ssid_len = req->ssid_len;
-
ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len);
if (ret && ret != -EALREADY)
return ret;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 5748cda659c..aa1829ae431 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -876,8 +876,6 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
bss_info_changed |= ieee80211_handle_bss_capability(sdata,
bss->cbss.capability, bss->has_erp_value, bss->erp_value);
- cfg80211_hold_bss(&bss->cbss);
-
ieee80211_rx_bss_put(local, bss);
}
@@ -1031,10 +1029,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
conf->channel->center_freq,
ifmgd->ssid, ifmgd->ssid_len);
- if (bss) {
- cfg80211_unhold_bss(&bss->cbss);
+ if (bss)
ieee80211_rx_bss_put(local, bss);
- }
if (self_disconnected) {
if (deauth)