aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-09-08 11:33:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-11 15:53:36 -0400
commitf5e5bf258b399f74b606e532ae0a2599522fd7bf (patch)
tree146b31768e646875a72753979eda3abb62cd6971 /net/mac80211
parent3b7ee69d0caefbdb85a606a98bff841b8c63b97e (diff)
mac80211: remove disassociation code from ieee80211_set_associated
This patch moves disassociation code from ieee80211_set_associated to ieee80211_set_disassoc. To reduce code duplication, it introduces the ieee80211_sta_send_apinfo function. Additionally, it fixes a lapse where BSS_CHANGED_HT wasn't set when notifying the driver of changes due to disassociation. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/mlme.c102
1 files changed, 56 insertions, 46 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index eababf320b83..0e9bd840e7dd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -352,6 +352,17 @@ int ieee80211_ht_addt_info_ie_to_ht_bss_info(
352 return 0; 352 return 0;
353} 353}
354 354
355static void ieee80211_sta_send_apinfo(struct ieee80211_sub_if_data *sdata,
356 struct ieee80211_if_sta *ifsta)
357{
358 union iwreq_data wrqu;
359 memset(&wrqu, 0, sizeof(wrqu));
360 if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
361 memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN);
362 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
363 wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL);
364}
365
355static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata, 366static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata,
356 struct ieee80211_if_sta *ifsta) 367 struct ieee80211_if_sta *ifsta)
357{ 368{
@@ -373,68 +384,53 @@ static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata,
373 384
374 385
375static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, 386static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
376 struct ieee80211_if_sta *ifsta, 387 struct ieee80211_if_sta *ifsta)
377 bool assoc)
378{ 388{
379 struct ieee80211_local *local = sdata->local; 389 struct ieee80211_local *local = sdata->local;
380 struct ieee80211_conf *conf = &local_to_hw(local)->conf; 390 struct ieee80211_conf *conf = &local_to_hw(local)->conf;
381 union iwreq_data wrqu;
382 u32 changed = BSS_CHANGED_ASSOC; 391 u32 changed = BSS_CHANGED_ASSOC;
383 392
384 if (assoc) { 393 struct ieee80211_sta_bss *bss;
385 struct ieee80211_sta_bss *bss;
386
387 ifsta->flags |= IEEE80211_STA_ASSOCIATED;
388 394
389 if (sdata->vif.type != IEEE80211_IF_TYPE_STA) 395 ifsta->flags |= IEEE80211_STA_ASSOCIATED;
390 return;
391 396
392 bss = ieee80211_rx_bss_get(local, ifsta->bssid, 397 if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
393 conf->channel->center_freq, 398 return;
394 ifsta->ssid, ifsta->ssid_len);
395 if (bss) {
396 /* set timing information */
397 sdata->bss_conf.beacon_int = bss->beacon_int;
398 sdata->bss_conf.timestamp = bss->timestamp;
399 sdata->bss_conf.dtim_period = bss->dtim_period;
400 399
401 changed |= ieee80211_handle_bss_capability(sdata, bss); 400 bss = ieee80211_rx_bss_get(local, ifsta->bssid,
401 conf->channel->center_freq,
402 ifsta->ssid, ifsta->ssid_len);
403 if (bss) {
404 /* set timing information */
405 sdata->bss_conf.beacon_int = bss->beacon_int;
406 sdata->bss_conf.timestamp = bss->timestamp;
407 sdata->bss_conf.dtim_period = bss->dtim_period;
402 408
403 ieee80211_rx_bss_put(local, bss); 409 changed |= ieee80211_handle_bss_capability(sdata, bss);
404 }
405 410
406 if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { 411 ieee80211_rx_bss_put(local, bss);
407 changed |= BSS_CHANGED_HT; 412 }
408 sdata->bss_conf.assoc_ht = 1;
409 sdata->bss_conf.ht_conf = &conf->ht_conf;
410 sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf;
411 }
412 413
413 ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; 414 if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
414 memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); 415 changed |= BSS_CHANGED_HT;
415 memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); 416 sdata->bss_conf.assoc_ht = 1;
416 ieee80211_sta_send_associnfo(sdata, ifsta); 417 sdata->bss_conf.ht_conf = &conf->ht_conf;
417 } else { 418 sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf;
418 ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; 419 }
419 changed |= ieee80211_reset_erp_info(sdata);
420 420
421 sdata->bss_conf.assoc_ht = 0; 421 ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
422 sdata->bss_conf.ht_conf = NULL; 422 memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN);
423 sdata->bss_conf.ht_bss_conf = NULL; 423 ieee80211_sta_send_associnfo(sdata, ifsta);
424 424
425 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
426 }
427 ifsta->last_probe = jiffies; 425 ifsta->last_probe = jiffies;
428 ieee80211_led_assoc(local, assoc); 426 ieee80211_led_assoc(local, 1);
429 427
430 sdata->bss_conf.assoc = assoc; 428 sdata->bss_conf.assoc = 1;
431 ieee80211_bss_info_change_notify(sdata, changed); 429 ieee80211_bss_info_change_notify(sdata, changed);
432 430
433 if (assoc) 431 netif_carrier_on(sdata->dev);
434 netif_carrier_on(sdata->dev);
435 432
436 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 433 ieee80211_sta_send_apinfo(sdata, ifsta);
437 wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL);
438} 434}
439 435
440void ieee80211_sta_tx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 436void ieee80211_sta_tx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
@@ -836,6 +832,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
836{ 832{
837 struct ieee80211_local *local = sdata->local; 833 struct ieee80211_local *local = sdata->local;
838 struct sta_info *sta; 834 struct sta_info *sta;
835 u32 changed = BSS_CHANGED_ASSOC;
839 836
840 rcu_read_lock(); 837 rcu_read_lock();
841 838
@@ -863,7 +860,20 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
863 ieee80211_send_disassoc(sdata, ifsta, reason); 860 ieee80211_send_disassoc(sdata, ifsta, reason);
864 } 861 }
865 862
866 ieee80211_set_associated(sdata, ifsta, 0); 863 ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
864 changed |= ieee80211_reset_erp_info(sdata);
865
866 if (sdata->bss_conf.assoc_ht)
867 changed |= BSS_CHANGED_HT;
868
869 sdata->bss_conf.assoc_ht = 0;
870 sdata->bss_conf.ht_conf = NULL;
871 sdata->bss_conf.ht_bss_conf = NULL;
872
873 ieee80211_led_assoc(local, 0);
874 sdata->bss_conf.assoc = 0;
875
876 ieee80211_sta_send_apinfo(sdata, ifsta);
867 877
868 if (self_disconnected) 878 if (self_disconnected)
869 ifsta->state = IEEE80211_STA_MLME_DISABLED; 879 ifsta->state = IEEE80211_STA_MLME_DISABLED;
@@ -2081,7 +2091,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2081 * ieee80211_set_associated() will tell the driver */ 2091 * ieee80211_set_associated() will tell the driver */
2082 bss_conf->aid = aid; 2092 bss_conf->aid = aid;
2083 bss_conf->assoc_capability = capab_info; 2093 bss_conf->assoc_capability = capab_info;
2084 ieee80211_set_associated(sdata, ifsta, 1); 2094 ieee80211_set_associated(sdata, ifsta);
2085 2095
2086 ieee80211_associated(sdata, ifsta); 2096 ieee80211_associated(sdata, ifsta);
2087} 2097}