aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/cfg.c39
-rw-r--r--net/mac80211/debugfs_netdev.c4
-rw-r--r--net/mac80211/ieee80211_i.h42
-rw-r--r--net/mac80211/iface.c2
-rw-r--r--net/mac80211/mlme.c231
5 files changed, 54 insertions, 264 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 3c9774e36a80..7606571d4581 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1194,18 +1194,14 @@ static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
1194 } 1194 }
1195 1195
1196 memcpy(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN); 1196 memcpy(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN);
1197 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
1198 sdata->u.mgd.flags |= IEEE80211_STA_BSSID_SET;
1199 1197
1200 /* TODO: req->chan */ 1198 sdata->local->oper_channel = req->chan;
1201 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_CHANNEL_SEL; 1199 ieee80211_hw_config(sdata->local, 0);
1202 1200
1203 if (req->ssid) { 1201 if (!req->ssid)
1204 sdata->u.mgd.flags |= IEEE80211_STA_SSID_SET; 1202 return -EINVAL;
1205 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len); 1203 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
1206 sdata->u.mgd.ssid_len = req->ssid_len; 1204 sdata->u.mgd.ssid_len = req->ssid_len;
1207 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
1208 }
1209 1205
1210 kfree(sdata->u.mgd.sme_auth_ie); 1206 kfree(sdata->u.mgd.sme_auth_ie);
1211 sdata->u.mgd.sme_auth_ie = NULL; 1207 sdata->u.mgd.sme_auth_ie = NULL;
@@ -1218,7 +1214,6 @@ static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
1218 sdata->u.mgd.sme_auth_ie_len = req->ie_len; 1214 sdata->u.mgd.sme_auth_ie_len = req->ie_len;
1219 } 1215 }
1220 1216
1221 sdata->u.mgd.flags |= IEEE80211_STA_EXT_SME;
1222 sdata->u.mgd.state = IEEE80211_STA_MLME_DIRECT_PROBE; 1217 sdata->u.mgd.state = IEEE80211_STA_MLME_DIRECT_PROBE;
1223 ieee80211_sta_req_auth(sdata); 1218 ieee80211_sta_req_auth(sdata);
1224 return 0; 1219 return 0;
@@ -1236,27 +1231,22 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1236 !(sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED)) 1231 !(sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED))
1237 return -ENOLINK; /* not authenticated */ 1232 return -ENOLINK; /* not authenticated */
1238 1233
1239 sdata->u.mgd.flags &= ~IEEE80211_STA_TKIP_WEP_USED; 1234 sdata->u.mgd.flags &= ~IEEE80211_STA_DISABLE_11N;
1240 1235
1241 for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) 1236 for (i = 0; i < req->crypto.n_ciphers_pairwise; i++)
1242 if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 || 1237 if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 ||
1243 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || 1238 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP ||
1244 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) 1239 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104)
1245 sdata->u.mgd.flags |= IEEE80211_STA_TKIP_WEP_USED; 1240 sdata->u.mgd.flags |= IEEE80211_STA_DISABLE_11N;
1246 1241
1247 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; 1242 sdata->local->oper_channel = req->chan;
1248 sdata->u.mgd.flags |= IEEE80211_STA_BSSID_SET; 1243 ieee80211_hw_config(sdata->local, 0);
1249 1244
1250 /* TODO: req->chan */ 1245 if (!req->ssid)
1251 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_CHANNEL_SEL; 1246 return -EINVAL;
1252 1247
1253 if (req->ssid) { 1248 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
1254 sdata->u.mgd.flags |= IEEE80211_STA_SSID_SET; 1249 sdata->u.mgd.ssid_len = req->ssid_len;
1255 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
1256 sdata->u.mgd.ssid_len = req->ssid_len;
1257 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
1258 } else
1259 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_SSID_SEL;
1260 1250
1261 ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len); 1251 ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len);
1262 if (ret && ret != -EALREADY) 1252 if (ret && ret != -EALREADY)
@@ -1275,7 +1265,6 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1275 else 1265 else
1276 sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT; 1266 sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT;
1277 1267
1278 sdata->u.mgd.flags |= IEEE80211_STA_EXT_SME;
1279 sdata->u.mgd.state = IEEE80211_STA_MLME_ASSOCIATE; 1268 sdata->u.mgd.state = IEEE80211_STA_MLME_ASSOCIATE;
1280 ieee80211_sta_req_auth(sdata); 1269 ieee80211_sta_req_auth(sdata);
1281 return 0; 1270 return 0;
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index df8c804e2d9a..ffe9add3ef42 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -111,9 +111,7 @@ IEEE80211_IF_FILE(auth_transaction, u.mgd.auth_transaction, DEC);
111static ssize_t ieee80211_if_fmt_flags( 111static ssize_t ieee80211_if_fmt_flags(
112 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) 112 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
113{ 113{
114 return scnprintf(buf, buflen, "%s%s%s%s%s%s%s\n", 114 return scnprintf(buf, buflen, "%s%s%s%s%s\n",
115 sdata->u.mgd.flags & IEEE80211_STA_SSID_SET ? "SSID\n" : "",
116 sdata->u.mgd.flags & IEEE80211_STA_BSSID_SET ? "BSSID\n" : "",
117 sdata->u.mgd.flags & IEEE80211_STA_PREV_BSSID_SET ? "prev BSSID\n" : "", 115 sdata->u.mgd.flags & IEEE80211_STA_PREV_BSSID_SET ? "prev BSSID\n" : "",
118 sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", 116 sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
119 sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", 117 sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index f7024eeba8f5..a550aeb85053 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -228,28 +228,24 @@ struct mesh_preq_queue {
228}; 228};
229 229
230/* flags used in struct ieee80211_if_managed.flags */ 230/* flags used in struct ieee80211_if_managed.flags */
231#define IEEE80211_STA_SSID_SET BIT(0) 231enum ieee80211_sta_flags {
232#define IEEE80211_STA_BSSID_SET BIT(1) 232 IEEE80211_STA_PREV_BSSID_SET = BIT(0),
233#define IEEE80211_STA_PREV_BSSID_SET BIT(2) 233 IEEE80211_STA_AUTHENTICATED = BIT(1),
234#define IEEE80211_STA_AUTHENTICATED BIT(3) 234 IEEE80211_STA_ASSOCIATED = BIT(2),
235#define IEEE80211_STA_ASSOCIATED BIT(4) 235 IEEE80211_STA_PROBEREQ_POLL = BIT(3),
236#define IEEE80211_STA_PROBEREQ_POLL BIT(5) 236 IEEE80211_STA_CONTROL_PORT = BIT(4),
237#define IEEE80211_STA_CREATE_IBSS BIT(6) 237 IEEE80211_STA_WMM_ENABLED = BIT(5),
238#define IEEE80211_STA_CONTROL_PORT BIT(7) 238 IEEE80211_STA_DISABLE_11N = BIT(6),
239#define IEEE80211_STA_WMM_ENABLED BIT(8) 239 IEEE80211_STA_CSA_RECEIVED = BIT(7),
240/* hole at 9, please re-use */ 240 IEEE80211_STA_MFP_ENABLED = BIT(8),
241#define IEEE80211_STA_AUTO_SSID_SEL BIT(10) 241};
242#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) 242
243#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
244#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
245#define IEEE80211_STA_TKIP_WEP_USED BIT(14)
246#define IEEE80211_STA_CSA_RECEIVED BIT(15)
247#define IEEE80211_STA_MFP_ENABLED BIT(16)
248#define IEEE80211_STA_EXT_SME BIT(17)
249/* flags for MLME request */ 243/* flags for MLME request */
250#define IEEE80211_STA_REQ_SCAN 0 244enum ieee80211_sta_request {
251#define IEEE80211_STA_REQ_AUTH 1 245 IEEE80211_STA_REQ_SCAN,
252#define IEEE80211_STA_REQ_RUN 2 246 IEEE80211_STA_REQ_AUTH,
247 IEEE80211_STA_REQ_RUN,
248};
253 249
254struct ieee80211_if_managed { 250struct ieee80211_if_managed {
255 struct timer_list timer; 251 struct timer_list timer;
@@ -936,10 +932,6 @@ extern const struct iw_handler_def ieee80211_iw_handler_def;
936void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 932void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
937ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, 933ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata,
938 struct sk_buff *skb); 934 struct sk_buff *skb);
939int ieee80211_sta_commit(struct ieee80211_sub_if_data *sdata);
940int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
941int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len);
942int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
943void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata); 935void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata);
944int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason); 936int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason);
945int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason); 937int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index b7c8a4484298..b87bf425f857 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -486,8 +486,6 @@ static int ieee80211_stop(struct net_device *dev)
486 synchronize_rcu(); 486 synchronize_rcu();
487 skb_queue_purge(&sdata->u.mgd.skb_queue); 487 skb_queue_purge(&sdata->u.mgd.skb_queue);
488 488
489 sdata->u.mgd.flags &= ~(IEEE80211_STA_PRIVACY_INVOKED |
490 IEEE80211_STA_TKIP_WEP_USED);
491 kfree(sdata->u.mgd.extra_ie); 489 kfree(sdata->u.mgd.extra_ie);
492 sdata->u.mgd.extra_ie = NULL; 490 sdata->u.mgd.extra_ie = NULL;
493 sdata->u.mgd.extra_ie_len = 0; 491 sdata->u.mgd.extra_ie_len = 0;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2b357c7adb8d..2d9b6663253c 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -347,7 +347,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
347 sband->ht_cap.ht_supported && 347 sband->ht_cap.ht_supported &&
348 (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) && 348 (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) &&
349 ht_ie[1] >= sizeof(struct ieee80211_ht_info) && 349 ht_ie[1] >= sizeof(struct ieee80211_ht_info) &&
350 (!(ifmgd->flags & IEEE80211_STA_TKIP_WEP_USED))) { 350 (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))) {
351 struct ieee80211_ht_info *ht_info = 351 struct ieee80211_ht_info *ht_info =
352 (struct ieee80211_ht_info *)(ht_ie + 2); 352 (struct ieee80211_ht_info *)(ht_ie + 2);
353 u16 cap = sband->ht_cap.cap; 353 u16 cap = sband->ht_cap.cap;
@@ -981,8 +981,6 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata)
981{ 981{
982 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 982 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
983 struct ieee80211_local *local = sdata->local; 983 struct ieee80211_local *local = sdata->local;
984 u8 *ies;
985 size_t ies_len;
986 984
987 ifmgd->auth_tries++; 985 ifmgd->auth_tries++;
988 if (ifmgd->auth_tries > IEEE80211_AUTH_MAX_TRIES) { 986 if (ifmgd->auth_tries > IEEE80211_AUTH_MAX_TRIES) {
@@ -1010,15 +1008,8 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata)
1010 printk(KERN_DEBUG "%s: authenticate with AP %pM\n", 1008 printk(KERN_DEBUG "%s: authenticate with AP %pM\n",
1011 sdata->dev->name, ifmgd->bssid); 1009 sdata->dev->name, ifmgd->bssid);
1012 1010
1013 if (ifmgd->flags & IEEE80211_STA_EXT_SME) { 1011 ieee80211_send_auth(sdata, 1, ifmgd->auth_alg, ifmgd->sme_auth_ie,
1014 ies = ifmgd->sme_auth_ie; 1012 ifmgd->sme_auth_ie_len, ifmgd->bssid, 0);
1015 ies_len = ifmgd->sme_auth_ie_len;
1016 } else {
1017 ies = NULL;
1018 ies_len = 0;
1019 }
1020 ieee80211_send_auth(sdata, 1, ifmgd->auth_alg, ies, ies_len,
1021 ifmgd->bssid, 0);
1022 ifmgd->auth_transaction = 2; 1013 ifmgd->auth_transaction = 2;
1023 1014
1024 mod_timer(&ifmgd->timer, jiffies + IEEE80211_AUTH_TIMEOUT); 1015 mod_timer(&ifmgd->timer, jiffies + IEEE80211_AUTH_TIMEOUT);
@@ -1128,44 +1119,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1128 sta_info_destroy(sta); 1119 sta_info_destroy(sta);
1129} 1120}
1130 1121
1131static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata)
1132{
1133 if (!sdata || !sdata->default_key ||
1134 sdata->default_key->conf.alg != ALG_WEP)
1135 return 0;
1136 return 1;
1137}
1138
1139static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata)
1140{
1141 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
1142 struct ieee80211_local *local = sdata->local;
1143 struct ieee80211_bss *bss;
1144 int bss_privacy;
1145 int wep_privacy;
1146 int privacy_invoked;
1147
1148 if (!ifmgd || (ifmgd->flags & IEEE80211_STA_EXT_SME))
1149 return 0;
1150
1151 bss = ieee80211_rx_bss_get(local, ifmgd->bssid,
1152 local->hw.conf.channel->center_freq,
1153 ifmgd->ssid, ifmgd->ssid_len);
1154 if (!bss)
1155 return 0;
1156
1157 bss_privacy = !!(bss->cbss.capability & WLAN_CAPABILITY_PRIVACY);
1158 wep_privacy = !!ieee80211_sta_wep_configured(sdata);
1159 privacy_invoked = !!(ifmgd->flags & IEEE80211_STA_PRIVACY_INVOKED);
1160
1161 ieee80211_rx_bss_put(local, bss);
1162
1163 if ((bss_privacy == wep_privacy) || (bss_privacy == privacy_invoked))
1164 return 0;
1165
1166 return 1;
1167}
1168
1169static void ieee80211_associate(struct ieee80211_sub_if_data *sdata) 1122static void ieee80211_associate(struct ieee80211_sub_if_data *sdata)
1170{ 1123{
1171 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 1124 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
@@ -1195,14 +1148,6 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata)
1195 ifmgd->state = IEEE80211_STA_MLME_ASSOCIATE; 1148 ifmgd->state = IEEE80211_STA_MLME_ASSOCIATE;
1196 printk(KERN_DEBUG "%s: associate with AP %pM\n", 1149 printk(KERN_DEBUG "%s: associate with AP %pM\n",
1197 sdata->dev->name, ifmgd->bssid); 1150 sdata->dev->name, ifmgd->bssid);
1198 if (ieee80211_privacy_mismatch(sdata)) {
1199 printk(KERN_DEBUG "%s: mismatch in privacy configuration and "
1200 "mixed-cell disabled - abort association\n", sdata->dev->name);
1201 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
1202 ieee80211_recalc_idle(local);
1203 return;
1204 }
1205
1206 ieee80211_send_assoc(sdata); 1151 ieee80211_send_assoc(sdata);
1207 1152
1208 mod_timer(&ifmgd->timer, jiffies + IEEE80211_ASSOC_TIMEOUT); 1153 mod_timer(&ifmgd->timer, jiffies + IEEE80211_ASSOC_TIMEOUT);
@@ -1360,12 +1305,9 @@ static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata)
1360 1305
1361 printk(KERN_DEBUG "%s: authenticated\n", sdata->dev->name); 1306 printk(KERN_DEBUG "%s: authenticated\n", sdata->dev->name);
1362 ifmgd->flags |= IEEE80211_STA_AUTHENTICATED; 1307 ifmgd->flags |= IEEE80211_STA_AUTHENTICATED;
1363 if (ifmgd->flags & IEEE80211_STA_EXT_SME) { 1308 /* Wait for SME to request association */
1364 /* Wait for SME to request association */ 1309 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
1365 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 1310 ieee80211_recalc_idle(sdata->local);
1366 ieee80211_recalc_idle(sdata->local);
1367 } else
1368 ieee80211_associate(sdata);
1369} 1311}
1370 1312
1371 1313
@@ -1460,15 +1402,6 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
1460 printk(KERN_DEBUG "%s: deauthenticated (Reason: %u)\n", 1402 printk(KERN_DEBUG "%s: deauthenticated (Reason: %u)\n",
1461 sdata->dev->name, reason_code); 1403 sdata->dev->name, reason_code);
1462 1404
1463 if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) &&
1464 (ifmgd->state == IEEE80211_STA_MLME_AUTHENTICATE ||
1465 ifmgd->state == IEEE80211_STA_MLME_ASSOCIATE ||
1466 ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)) {
1467 ifmgd->state = IEEE80211_STA_MLME_DIRECT_PROBE;
1468 mod_timer(&ifmgd->timer, jiffies +
1469 IEEE80211_RETRY_AUTH_INTERVAL);
1470 }
1471
1472 ieee80211_set_disassoc(sdata, true, false, 0); 1405 ieee80211_set_disassoc(sdata, true, false, 0);
1473 ifmgd->flags &= ~IEEE80211_STA_AUTHENTICATED; 1406 ifmgd->flags &= ~IEEE80211_STA_AUTHENTICATED;
1474 cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, len, GFP_KERNEL); 1407 cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, len, GFP_KERNEL);
@@ -1494,13 +1427,6 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
1494 printk(KERN_DEBUG "%s: disassociated (Reason: %u)\n", 1427 printk(KERN_DEBUG "%s: disassociated (Reason: %u)\n",
1495 sdata->dev->name, reason_code); 1428 sdata->dev->name, reason_code);
1496 1429
1497 if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) &&
1498 ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED) {
1499 ifmgd->state = IEEE80211_STA_MLME_ASSOCIATE;
1500 mod_timer(&ifmgd->timer, jiffies +
1501 IEEE80211_RETRY_AUTH_INTERVAL);
1502 }
1503
1504 ieee80211_set_disassoc(sdata, false, false, reason_code); 1430 ieee80211_set_disassoc(sdata, false, false, reason_code);
1505 cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, len, GFP_KERNEL); 1431 cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, len, GFP_KERNEL);
1506} 1432}
@@ -1573,11 +1499,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1573 ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET; 1499 ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
1574 cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, len, 1500 cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, len,
1575 GFP_KERNEL); 1501 GFP_KERNEL);
1576 if (ifmgd->flags & IEEE80211_STA_EXT_SME) { 1502 /* Wait for SME to decide what to do next */
1577 /* Wait for SME to decide what to do next */ 1503 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
1578 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 1504 ieee80211_recalc_idle(local);
1579 ieee80211_recalc_idle(local);
1580 }
1581 return; 1505 return;
1582 } 1506 }
1583 1507
@@ -1683,8 +1607,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1683 else 1607 else
1684 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; 1608 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
1685 1609
1686 /* If TKIP/WEP is used, no need to parse AP's HT capabilities */ 1610 if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
1687 if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_TKIP_WEP_USED))
1688 ieee80211_ht_cap_ie_to_sta_ht_cap(sband, 1611 ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
1689 elems.ht_cap_elem, &sta->sta.ht_cap); 1612 elems.ht_cap_elem, &sta->sta.ht_cap);
1690 1613
@@ -1718,7 +1641,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1718 1641
1719 if (elems.ht_info_elem && elems.wmm_param && 1642 if (elems.ht_info_elem && elems.wmm_param &&
1720 (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) && 1643 (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
1721 !(ifmgd->flags & IEEE80211_STA_TKIP_WEP_USED)) 1644 !(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
1722 changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem, 1645 changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem,
1723 ap_ht_cap_flags); 1646 ap_ht_cap_flags);
1724 1647
@@ -1931,7 +1854,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1931 1854
1932 1855
1933 if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param && 1856 if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param &&
1934 !(ifmgd->flags & IEEE80211_STA_TKIP_WEP_USED)) { 1857 !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) {
1935 struct sta_info *sta; 1858 struct sta_info *sta;
1936 struct ieee80211_supported_band *sband; 1859 struct ieee80211_supported_band *sband;
1937 u16 ap_ht_cap_flags; 1860 u16 ap_ht_cap_flags;
@@ -2090,26 +2013,6 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata)
2090 u16 capa_val = WLAN_CAPABILITY_ESS; 2013 u16 capa_val = WLAN_CAPABILITY_ESS;
2091 struct ieee80211_channel *chan = local->oper_channel; 2014 struct ieee80211_channel *chan = local->oper_channel;
2092 2015
2093 if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) &&
2094 ifmgd->flags & (IEEE80211_STA_AUTO_SSID_SEL |
2095 IEEE80211_STA_AUTO_BSSID_SEL |
2096 IEEE80211_STA_AUTO_CHANNEL_SEL)) {
2097 capa_mask |= WLAN_CAPABILITY_PRIVACY;
2098 if (sdata->default_key)
2099 capa_val |= WLAN_CAPABILITY_PRIVACY;
2100 }
2101
2102 if (ifmgd->flags & IEEE80211_STA_AUTO_CHANNEL_SEL)
2103 chan = NULL;
2104
2105 if (ifmgd->flags & IEEE80211_STA_AUTO_BSSID_SEL)
2106 bssid = NULL;
2107
2108 if (ifmgd->flags & IEEE80211_STA_AUTO_SSID_SEL) {
2109 ssid = NULL;
2110 ssid_len = 0;
2111 }
2112
2113 bss = (void *)cfg80211_get_bss(local->hw.wiphy, chan, 2016 bss = (void *)cfg80211_get_bss(local->hw.wiphy, chan,
2114 bssid, ssid, ssid_len, 2017 bssid, ssid, ssid_len,
2115 capa_mask, capa_val); 2018 capa_mask, capa_val);
@@ -2119,10 +2022,6 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata)
2119 local->oper_channel_type = NL80211_CHAN_NO_HT; 2022 local->oper_channel_type = NL80211_CHAN_NO_HT;
2120 ieee80211_hw_config(local, 0); 2023 ieee80211_hw_config(local, 0);
2121 2024
2122 if (!(ifmgd->flags & IEEE80211_STA_SSID_SET))
2123 ieee80211_sta_set_ssid(sdata, bss->ssid,
2124 bss->ssid_len);
2125 ieee80211_sta_set_bssid(sdata, bss->cbss.bssid);
2126 ieee80211_sta_def_wmm_params(sdata, bss->supp_rates_len, 2025 ieee80211_sta_def_wmm_params(sdata, bss->supp_rates_len,
2127 bss->supp_rates); 2026 bss->supp_rates);
2128 if (sdata->u.mgd.mfp == IEEE80211_MFP_REQUIRED) 2027 if (sdata->u.mgd.mfp == IEEE80211_MFP_REQUIRED)
@@ -2232,14 +2131,6 @@ static void ieee80211_sta_work(struct work_struct *work)
2232 WARN_ON(1); 2131 WARN_ON(1);
2233 break; 2132 break;
2234 } 2133 }
2235
2236 if (ieee80211_privacy_mismatch(sdata)) {
2237 printk(KERN_DEBUG "%s: privacy configuration mismatch and "
2238 "mixed-cell disabled - disassociate\n", sdata->dev->name);
2239
2240 ieee80211_set_disassoc(sdata, false, true,
2241 WLAN_REASON_UNSPECIFIED);
2242 }
2243} 2134}
2244 2135
2245static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) 2136static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
@@ -2306,9 +2197,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
2306 skb_queue_head_init(&ifmgd->skb_queue); 2197 skb_queue_head_init(&ifmgd->skb_queue);
2307 2198
2308 ifmgd->capab = WLAN_CAPABILITY_ESS; 2199 ifmgd->capab = WLAN_CAPABILITY_ESS;
2309 ifmgd->flags |= IEEE80211_STA_CREATE_IBSS | 2200 ifmgd->flags = 0;
2310 IEEE80211_STA_AUTO_BSSID_SEL |
2311 IEEE80211_STA_AUTO_CHANNEL_SEL;
2312 if (sdata->local->hw.queues >= 4) 2201 if (sdata->local->hw.queues >= 4)
2313 ifmgd->flags |= IEEE80211_STA_WMM_ENABLED; 2202 ifmgd->flags |= IEEE80211_STA_WMM_ENABLED;
2314 2203
@@ -2324,96 +2213,20 @@ void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata)
2324 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) 2213 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
2325 return; 2214 return;
2326 2215
2327 if ((ifmgd->flags & (IEEE80211_STA_BSSID_SET | 2216 if (WARN_ON(ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED))
2328 IEEE80211_STA_AUTO_BSSID_SEL)) &&
2329 (ifmgd->flags & (IEEE80211_STA_SSID_SET |
2330 IEEE80211_STA_AUTO_SSID_SEL))) {
2331
2332 if (ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)
2333 ieee80211_set_disassoc(sdata, true, true,
2334 WLAN_REASON_DEAUTH_LEAVING);
2335
2336 if (ifmgd->ssid_len == 0) {
2337 /*
2338 * Only allow association to be started if a valid SSID
2339 * is configured.
2340 */
2341 return;
2342 }
2343
2344 if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) ||
2345 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE)
2346 set_bit(IEEE80211_STA_REQ_AUTH, &ifmgd->request);
2347 else if (ifmgd->flags & IEEE80211_STA_EXT_SME)
2348 set_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request);
2349 queue_work(local->hw.workqueue, &ifmgd->work);
2350 }
2351}
2352
2353int ieee80211_sta_commit(struct ieee80211_sub_if_data *sdata)
2354{
2355 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2356
2357 if (ifmgd->ssid_len)
2358 ifmgd->flags |= IEEE80211_STA_SSID_SET;
2359 else
2360 ifmgd->flags &= ~IEEE80211_STA_SSID_SET;
2361
2362 return 0;
2363}
2364
2365int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len)
2366{
2367 struct ieee80211_if_managed *ifmgd;
2368
2369 if (len > IEEE80211_MAX_SSID_LEN)
2370 return -EINVAL;
2371
2372 ifmgd = &sdata->u.mgd;
2373
2374 if (ifmgd->ssid_len != len || memcmp(ifmgd->ssid, ssid, len) != 0) {
2375 if (ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)
2376 ieee80211_set_disassoc(sdata, true, true,
2377 WLAN_REASON_DEAUTH_LEAVING);
2378
2379 /*
2380 * Do not use reassociation if SSID is changed (different ESS).
2381 */
2382 ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
2383 memset(ifmgd->ssid, 0, sizeof(ifmgd->ssid));
2384 memcpy(ifmgd->ssid, ssid, len);
2385 ifmgd->ssid_len = len;
2386 }
2387
2388 return ieee80211_sta_commit(sdata);
2389}
2390
2391int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len)
2392{
2393 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2394 memcpy(ssid, ifmgd->ssid, ifmgd->ssid_len);
2395 *len = ifmgd->ssid_len;
2396 return 0;
2397}
2398
2399int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
2400{
2401 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2402
2403 if (compare_ether_addr(bssid, ifmgd->bssid) != 0 &&
2404 ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)
2405 ieee80211_set_disassoc(sdata, true, true, 2217 ieee80211_set_disassoc(sdata, true, true,
2406 WLAN_REASON_DEAUTH_LEAVING); 2218 WLAN_REASON_DEAUTH_LEAVING);
2407 2219
2408 if (is_valid_ether_addr(bssid)) { 2220 if (WARN_ON(ifmgd->ssid_len == 0)) {
2409 memcpy(ifmgd->bssid, bssid, ETH_ALEN); 2221 /*
2410 ifmgd->flags |= IEEE80211_STA_BSSID_SET; 2222 * Only allow association to be started if a valid SSID
2411 } else { 2223 * is configured.
2412 memset(ifmgd->bssid, 0, ETH_ALEN); 2224 */
2413 ifmgd->flags &= ~IEEE80211_STA_BSSID_SET; 2225 return;
2414 } 2226 }
2415 2227
2416 return ieee80211_sta_commit(sdata); 2228 set_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request);
2229 queue_work(local->hw.workqueue, &ifmgd->work);
2417} 2230}
2418 2231
2419int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, 2232int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata,