diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-06-15 12:13:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-06-15 15:05:59 -0400 |
commit | 1fa6f4af9f55bc1b753af04276984429d6b5a613 (patch) | |
tree | a743772fd520d8a2e1ac8cd4fb088de69494beb2 /net/mac80211/mlme.c | |
parent | f0e9a8606ce60880249fd570fbebf4472c3d37c0 (diff) |
mac80211: fix wext bssid/ssid setting
When changing to a new BSSID or SSID, the code in
ieee80211_set_disassoc() needs to have the old data
still valid to be able to disconnect and clean up
properly. Currently, however, the old data is thrown
away before ieee80211_set_disassoc() is ever called,
so fix that by calling the function _before_ the old
data is overwritten.
This is (one of) the issue(s) causing mac80211 to hold
cfg80211's BSS structs forever, and them thus being
returned in scan results after they're long gone.
http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=2015
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 | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 84e59b9b493a..aca22b00b6a3 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1102,14 +1102,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1102 | struct sta_info *sta; | 1102 | struct sta_info *sta; |
1103 | u32 changed = 0, config_changed = 0; | 1103 | u32 changed = 0, config_changed = 0; |
1104 | 1104 | ||
1105 | rcu_read_lock(); | ||
1106 | |||
1107 | sta = sta_info_get(local, ifmgd->bssid); | ||
1108 | if (!sta) { | ||
1109 | rcu_read_unlock(); | ||
1110 | return; | ||
1111 | } | ||
1112 | |||
1113 | if (deauth) { | 1105 | if (deauth) { |
1114 | ifmgd->direct_probe_tries = 0; | 1106 | ifmgd->direct_probe_tries = 0; |
1115 | ifmgd->auth_tries = 0; | 1107 | ifmgd->auth_tries = 0; |
@@ -1120,7 +1112,11 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1120 | netif_tx_stop_all_queues(sdata->dev); | 1112 | netif_tx_stop_all_queues(sdata->dev); |
1121 | netif_carrier_off(sdata->dev); | 1113 | netif_carrier_off(sdata->dev); |
1122 | 1114 | ||
1123 | ieee80211_sta_tear_down_BA_sessions(sta); | 1115 | rcu_read_lock(); |
1116 | sta = sta_info_get(local, ifmgd->bssid); | ||
1117 | if (sta) | ||
1118 | ieee80211_sta_tear_down_BA_sessions(sta); | ||
1119 | rcu_read_unlock(); | ||
1124 | 1120 | ||
1125 | bss = ieee80211_rx_bss_get(local, ifmgd->bssid, | 1121 | bss = ieee80211_rx_bss_get(local, ifmgd->bssid, |
1126 | conf->channel->center_freq, | 1122 | conf->channel->center_freq, |
@@ -1156,8 +1152,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1156 | ifmgd->ssid, ifmgd->ssid_len); | 1152 | ifmgd->ssid, ifmgd->ssid_len); |
1157 | } | 1153 | } |
1158 | 1154 | ||
1159 | rcu_read_unlock(); | ||
1160 | |||
1161 | ieee80211_set_wmm_default(sdata); | 1155 | ieee80211_set_wmm_default(sdata); |
1162 | 1156 | ||
1163 | ieee80211_recalc_idle(local); | 1157 | ieee80211_recalc_idle(local); |
@@ -2487,6 +2481,10 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size | |||
2487 | ifmgd = &sdata->u.mgd; | 2481 | ifmgd = &sdata->u.mgd; |
2488 | 2482 | ||
2489 | if (ifmgd->ssid_len != len || memcmp(ifmgd->ssid, ssid, len) != 0) { | 2483 | if (ifmgd->ssid_len != len || memcmp(ifmgd->ssid, ssid, len) != 0) { |
2484 | if (ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED) | ||
2485 | ieee80211_set_disassoc(sdata, true, true, | ||
2486 | WLAN_REASON_DEAUTH_LEAVING); | ||
2487 | |||
2490 | /* | 2488 | /* |
2491 | * Do not use reassociation if SSID is changed (different ESS). | 2489 | * Do not use reassociation if SSID is changed (different ESS). |
2492 | */ | 2490 | */ |
@@ -2511,6 +2509,11 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid) | |||
2511 | { | 2509 | { |
2512 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 2510 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
2513 | 2511 | ||
2512 | if (compare_ether_addr(bssid, ifmgd->bssid) != 0 && | ||
2513 | ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED) | ||
2514 | ieee80211_set_disassoc(sdata, true, true, | ||
2515 | WLAN_REASON_DEAUTH_LEAVING); | ||
2516 | |||
2514 | if (is_valid_ether_addr(bssid)) { | 2517 | if (is_valid_ether_addr(bssid)) { |
2515 | memcpy(ifmgd->bssid, bssid, ETH_ALEN); | 2518 | memcpy(ifmgd->bssid, bssid, ETH_ALEN); |
2516 | ifmgd->flags |= IEEE80211_STA_BSSID_SET; | 2519 | ifmgd->flags |= IEEE80211_STA_BSSID_SET; |