aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-02 11:20:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:53 -0400
commit19957bb399e2722719c0e20c9ae91cf8b6aaff04 (patch)
tree9c4d53fe5938ceee41333a1afd5be0ed5c1ce313 /net/mac80211/cfg.c
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/cfg.c')
-rw-r--r--net/mac80211/cfg.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7606571d4581..0f29cd0580c9 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,
1173 struct cfg80211_auth_request *req) 1173 struct cfg80211_auth_request *req)
1174{ 1174{
1175 struct ieee80211_sub_if_data *sdata; 1175 struct ieee80211_sub_if_data *sdata;
1176 const u8 *ssid;
1176 1177
1177 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1178 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1178 1179
@@ -1193,15 +1194,16 @@ static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
1193 return -EOPNOTSUPP; 1194 return -EOPNOTSUPP;
1194 } 1195 }
1195 1196
1196 memcpy(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN); 1197 memcpy(sdata->u.mgd.bssid, req->bss->bssid, ETH_ALEN);
1197 1198
1198 sdata->local->oper_channel = req->chan; 1199 sdata->local->oper_channel = req->bss->channel;
1199 ieee80211_hw_config(sdata->local, 0); 1200 ieee80211_hw_config(sdata->local, 0);
1200 1201
1201 if (!req->ssid) 1202 ssid = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID);
1203 if (!ssid)
1202 return -EINVAL; 1204 return -EINVAL;
1203 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len); 1205 sdata->u.mgd.ssid_len = *(ssid + 1);
1204 sdata->u.mgd.ssid_len = req->ssid_len; 1206 memcpy(sdata->u.mgd.ssid, ssid + 2, sdata->u.mgd.ssid_len);
1205 1207
1206 kfree(sdata->u.mgd.sme_auth_ie); 1208 kfree(sdata->u.mgd.sme_auth_ie);
1207 sdata->u.mgd.sme_auth_ie = NULL; 1209 sdata->u.mgd.sme_auth_ie = NULL;
@@ -1227,7 +1229,7 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1227 1229
1228 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1230 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1229 1231
1230 if (memcmp(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN) != 0 || 1232 if (memcmp(sdata->u.mgd.bssid, req->bss->bssid, ETH_ALEN) != 0 ||
1231 !(sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED)) 1233 !(sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED))
1232 return -ENOLINK; /* not authenticated */ 1234 return -ENOLINK; /* not authenticated */
1233 1235
@@ -1239,15 +1241,9 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1239 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) 1241 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104)
1240 sdata->u.mgd.flags |= IEEE80211_STA_DISABLE_11N; 1242 sdata->u.mgd.flags |= IEEE80211_STA_DISABLE_11N;
1241 1243
1242 sdata->local->oper_channel = req->chan; 1244 sdata->local->oper_channel = req->bss->channel;
1243 ieee80211_hw_config(sdata->local, 0); 1245 ieee80211_hw_config(sdata->local, 0);
1244 1246
1245 if (!req->ssid)
1246 return -EINVAL;
1247
1248 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
1249 sdata->u.mgd.ssid_len = req->ssid_len;
1250
1251 ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len); 1247 ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len);
1252 if (ret && ret != -EALREADY) 1248 if (ret && ret != -EALREADY)
1253 return ret; 1249 return ret;