aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-05-14 07:10:14 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-20 14:46:37 -0400
commit9cef873798dfcdc10ff40b02abf1de935ceeba85 (patch)
treebf44fb189c0db0b5b68a62006d82c242146fdd72 /net
parentbbcf3f02771e069d0e113fe9bb62c27b671abf97 (diff)
mac80211: fix managed mode BSSID handling
Currently, we will ask the driver to configure right away when somebody changes the desired BSSID. That's totally strange because then we will configure the driver without even knowing whether the BSS exists. Change this to only configure the BSSID when associated, and configure a zero BSSID when not associated. As a side effect, this fixes an issue with the iwlwifi driver which doesn't implement sta_notify properly and uses the BSSID instead and gets very confused if the BSSID is cleared before we disassociate, which results in the warning Marcel posted [1] and iwlwifi bug 1995 [2]. [1] http://thread.gmane.org/gmane.linux.kernel.wireless.general/32598 [2] http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=1995 Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/main.c16
-rw-r--r--net/mac80211/mlme.c10
2 files changed, 19 insertions, 7 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 76df5eabf268..6b7e92eaab47 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -219,18 +219,26 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
219 u32 changed) 219 u32 changed)
220{ 220{
221 struct ieee80211_local *local = sdata->local; 221 struct ieee80211_local *local = sdata->local;
222 static const u8 zero[ETH_ALEN] = { 0 };
222 223
223 if (!changed) 224 if (!changed)
224 return; 225 return;
225 226
226 if (sdata->vif.type == NL80211_IFTYPE_STATION) 227 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
227 sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid; 228 /*
228 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) 229 * While not associated, claim a BSSID of all-zeroes
230 * so that drivers don't do any weird things with the
231 * BSSID at that time.
232 */
233 if (sdata->vif.bss_conf.assoc)
234 sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
235 else
236 sdata->vif.bss_conf.bssid = zero;
237 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
229 sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid; 238 sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid;
230 else if (sdata->vif.type == NL80211_IFTYPE_AP) 239 else if (sdata->vif.type == NL80211_IFTYPE_AP)
231 sdata->vif.bss_conf.bssid = sdata->dev->dev_addr; 240 sdata->vif.bss_conf.bssid = sdata->dev->dev_addr;
232 else if (ieee80211_vif_is_mesh(&sdata->vif)) { 241 else if (ieee80211_vif_is_mesh(&sdata->vif)) {
233 static const u8 zero[ETH_ALEN] = { 0 };
234 sdata->vif.bss_conf.bssid = zero; 242 sdata->vif.bss_conf.bssid = zero;
235 } else { 243 } else {
236 WARN_ON(1); 244 WARN_ON(1);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 87743e47a05f..b7f9c60793dd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -977,6 +977,10 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
977 * changed or not. 977 * changed or not.
978 */ 978 */
979 bss_info_changed |= BSS_CHANGED_BASIC_RATES; 979 bss_info_changed |= BSS_CHANGED_BASIC_RATES;
980
981 /* And the BSSID changed - we're associated now */
982 bss_info_changed |= BSS_CHANGED_BSSID;
983
980 ieee80211_bss_info_change_notify(sdata, bss_info_changed); 984 ieee80211_bss_info_change_notify(sdata, bss_info_changed);
981 985
982 /* will be same as sdata */ 986 /* will be same as sdata */
@@ -1176,6 +1180,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1176 } 1180 }
1177 1181
1178 ieee80211_hw_config(local, config_changed); 1182 ieee80211_hw_config(local, config_changed);
1183
1184 /* And the BSSID changed -- not very interesting here */
1185 changed |= BSS_CHANGED_BSSID;
1179 ieee80211_bss_info_change_notify(sdata, changed); 1186 ieee80211_bss_info_change_notify(sdata, changed);
1180 1187
1181 rcu_read_lock(); 1188 rcu_read_lock();
@@ -2481,9 +2488,6 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
2481 ifmgd->flags &= ~IEEE80211_STA_BSSID_SET; 2488 ifmgd->flags &= ~IEEE80211_STA_BSSID_SET;
2482 } 2489 }
2483 2490
2484 if (netif_running(sdata->dev))
2485 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID);
2486
2487 return ieee80211_sta_commit(sdata); 2491 return ieee80211_sta_commit(sdata);
2488} 2492}
2489 2493