aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerton Ronaldo Krzesinski <herton@mandriva.com.br>2009-03-10 09:11:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-03-16 18:09:39 -0400
commit1a28c78b46caec7628985728e7f0c4aef68e33e7 (patch)
treeca2c3dc7e5bf426c579b4d363db769545a57865f
parentaf88b9078d4aa31d667d2d82601ede9cae3bac37 (diff)
mac80211: deauth before flushing STA information
Even after commit "mac80211: deauth when interface is marked down" (e327b847 on Linus tree), userspace still isn't notified when interface goes down. There isn't a problem with this commit, but because of other code changes it doesn't work on kernels >= 2.6.28 (works if same/similar change applied on 2.6.27 for example). The issue is as follows: after commit "mac80211: restructure disassoc/deauth flows" in 2.6.28, the call to ieee80211_sta_deauthenticate added by commit e327b847 will not work: because we do sta_info_flush(local, sdata) inside ieee80211_stop (iface.c), all stations in interface are cleared, so when calling ieee80211_sta_deauthenticate->ieee80211_set_disassoc (mlme.c), inside ieee80211_set_disassoc we have this in the beginning: sta = sta_info_get(local, ifsta->bssid); if (!sta) { The !sta check triggers, thus the function returns early and ieee80211_sta_send_apinfo(sdata, ifsta) later isn't called, so wpa_supplicant/userspace isn't notified with SIOCGIWAP. This commit moves deauthentication to before flushing STA info (sta_info_flush), thus the above can't happen and userspace is really notified when interface goes down. Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/mac80211/iface.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 2acc416e77e1..f9f27b9cadbe 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -370,6 +370,18 @@ static int ieee80211_stop(struct net_device *dev)
370 rcu_read_unlock(); 370 rcu_read_unlock();
371 371
372 /* 372 /*
373 * Announce that we are leaving the network, in case we are a
374 * station interface type. This must be done before removing
375 * all stations associated with sta_info_flush, otherwise STA
376 * information will be gone and no announce being done.
377 */
378 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
379 if (sdata->u.mgd.state != IEEE80211_STA_MLME_DISABLED)
380 ieee80211_sta_deauthenticate(sdata,
381 WLAN_REASON_DEAUTH_LEAVING);
382 }
383
384 /*
373 * Remove all stations associated with this interface. 385 * Remove all stations associated with this interface.
374 * 386 *
375 * This must be done before calling ops->remove_interface() 387 * This must be done before calling ops->remove_interface()
@@ -454,10 +466,6 @@ static int ieee80211_stop(struct net_device *dev)
454 netif_addr_unlock_bh(local->mdev); 466 netif_addr_unlock_bh(local->mdev);
455 break; 467 break;
456 case NL80211_IFTYPE_STATION: 468 case NL80211_IFTYPE_STATION:
457 /* Announce that we are leaving the network. */
458 if (sdata->u.mgd.state != IEEE80211_STA_MLME_DISABLED)
459 ieee80211_sta_deauthenticate(sdata,
460 WLAN_REASON_DEAUTH_LEAVING);
461 memset(sdata->u.mgd.bssid, 0, ETH_ALEN); 469 memset(sdata->u.mgd.bssid, 0, ETH_ALEN);
462 del_timer_sync(&sdata->u.mgd.chswitch_timer); 470 del_timer_sync(&sdata->u.mgd.chswitch_timer);
463 del_timer_sync(&sdata->u.mgd.timer); 471 del_timer_sync(&sdata->u.mgd.timer);