diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-01 15:41:17 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:53 -0400 |
commit | ab1faead50d09165b58c2854997c7205ca9c0d22 (patch) | |
tree | 6eb456e24aab52cdd9ed152d09008635a1ebd555 /net/mac80211/mlme.c | |
parent | 6dc1cb0319997648f59b0f46b9e093e779f0353d (diff) |
mac80211: remove dead code, clean up
With mac80211 now always controlled by an external SME,
a lot of code is dead -- SSID, BSSID, channel selection
is always done externally, etc. Additionally, rename
IEEE80211_STA_TKIP_WEP_USED to IEEE80211_STA_DISABLE_11N
and clean up the code a bit.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 231 |
1 files changed, 22 insertions, 209 deletions
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 | ||
1131 | static 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 | |||
1139 | static 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 | |||
1169 | static void ieee80211_associate(struct ieee80211_sub_if_data *sdata) | 1122 | static 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 | ||
2245 | static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) | 2136 | static 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 | |||
2353 | int 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 | |||
2365 | int 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 | |||
2391 | int 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 | |||
2399 | int 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 | ||
2419 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, | 2232 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, |