Commit f5e5bf25 authored by Tomas Winkler's avatar Tomas Winkler Committed by John W. Linville

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: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3b7ee69d
...@@ -352,6 +352,17 @@ int ieee80211_ht_addt_info_ie_to_ht_bss_info( ...@@ -352,6 +352,17 @@ int ieee80211_ht_addt_info_ie_to_ht_bss_info(
return 0; return 0;
} }
static void ieee80211_sta_send_apinfo(struct ieee80211_sub_if_data *sdata,
struct ieee80211_if_sta *ifsta)
{
union iwreq_data wrqu;
memset(&wrqu, 0, sizeof(wrqu));
if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL);
}
static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata, static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata,
struct ieee80211_if_sta *ifsta) struct ieee80211_if_sta *ifsta)
{ {
...@@ -373,68 +384,53 @@ static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata, ...@@ -373,68 +384,53 @@ static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata,
static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
struct ieee80211_if_sta *ifsta, struct ieee80211_if_sta *ifsta)
bool assoc)
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct ieee80211_conf *conf = &local_to_hw(local)->conf; struct ieee80211_conf *conf = &local_to_hw(local)->conf;
union iwreq_data wrqu;
u32 changed = BSS_CHANGED_ASSOC; u32 changed = BSS_CHANGED_ASSOC;
if (assoc) { struct ieee80211_sta_bss *bss;
struct ieee80211_sta_bss *bss;
ifsta->flags |= IEEE80211_STA_ASSOCIATED;
if (sdata->vif.type != IEEE80211_IF_TYPE_STA) ifsta->flags |= IEEE80211_STA_ASSOCIATED;
return;
bss = ieee80211_rx_bss_get(local, ifsta->bssid, if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
conf->channel->center_freq, return;
ifsta->ssid, ifsta->ssid_len);
if (bss) {
/* set timing information */
sdata->bss_conf.beacon_int = bss->beacon_int;
sdata->bss_conf.timestamp = bss->timestamp;
sdata->bss_conf.dtim_period = bss->dtim_period;
changed |= ieee80211_handle_bss_capability(sdata, bss); bss = ieee80211_rx_bss_get(local, ifsta->bssid,
conf->channel->center_freq,
ifsta->ssid, ifsta->ssid_len);
if (bss) {
/* set timing information */
sdata->bss_conf.beacon_int = bss->beacon_int;
sdata->bss_conf.timestamp = bss->timestamp;
sdata->bss_conf.dtim_period = bss->dtim_period;
ieee80211_rx_bss_put(local, bss); changed |= ieee80211_handle_bss_capability(sdata, bss);
}
if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { ieee80211_rx_bss_put(local, bss);
changed |= BSS_CHANGED_HT; }
sdata->bss_conf.assoc_ht = 1;
sdata->bss_conf.ht_conf = &conf->ht_conf;
sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf;
}
ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); changed |= BSS_CHANGED_HT;
memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); sdata->bss_conf.assoc_ht = 1;
ieee80211_sta_send_associnfo(sdata, ifsta); sdata->bss_conf.ht_conf = &conf->ht_conf;
} else { sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf;
ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; }
changed |= ieee80211_reset_erp_info(sdata);
sdata->bss_conf.assoc_ht = 0; ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
sdata->bss_conf.ht_conf = NULL; memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN);
sdata->bss_conf.ht_bss_conf = NULL; ieee80211_sta_send_associnfo(sdata, ifsta);
memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
}
ifsta->last_probe = jiffies; ifsta->last_probe = jiffies;
ieee80211_led_assoc(local, assoc); ieee80211_led_assoc(local, 1);
sdata->bss_conf.assoc = assoc; sdata->bss_conf.assoc = 1;
ieee80211_bss_info_change_notify(sdata, changed); ieee80211_bss_info_change_notify(sdata, changed);
if (assoc) netif_carrier_on(sdata->dev);
netif_carrier_on(sdata->dev);
wrqu.ap_addr.sa_family = ARPHRD_ETHER; ieee80211_sta_send_apinfo(sdata, ifsta);
wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL);
} }
void ieee80211_sta_tx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, void 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,6 +832,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct sta_info *sta; struct sta_info *sta;
u32 changed = BSS_CHANGED_ASSOC;
rcu_read_lock(); rcu_read_lock();
...@@ -863,7 +860,20 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -863,7 +860,20 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
ieee80211_send_disassoc(sdata, ifsta, reason); ieee80211_send_disassoc(sdata, ifsta, reason);
} }
ieee80211_set_associated(sdata, ifsta, 0); ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
changed |= ieee80211_reset_erp_info(sdata);
if (sdata->bss_conf.assoc_ht)
changed |= BSS_CHANGED_HT;
sdata->bss_conf.assoc_ht = 0;
sdata->bss_conf.ht_conf = NULL;
sdata->bss_conf.ht_bss_conf = NULL;
ieee80211_led_assoc(local, 0);
sdata->bss_conf.assoc = 0;
ieee80211_sta_send_apinfo(sdata, ifsta);
if (self_disconnected) if (self_disconnected)
ifsta->state = IEEE80211_STA_MLME_DISABLED; ifsta->state = IEEE80211_STA_MLME_DISABLED;
...@@ -2081,7 +2091,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -2081,7 +2091,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
* ieee80211_set_associated() will tell the driver */ * ieee80211_set_associated() will tell the driver */
bss_conf->aid = aid; bss_conf->aid = aid;
bss_conf->assoc_capability = capab_info; bss_conf->assoc_capability = capab_info;
ieee80211_set_associated(sdata, ifsta, 1); ieee80211_set_associated(sdata, ifsta);
ieee80211_associated(sdata, ifsta); ieee80211_associated(sdata, ifsta);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment