mac80211: generalise management work a bit

As a first step of generalising management work,
this renames a few things and puts more information
directly into the struct so that auth/assoc need
not access the BSS pointer as often -- in fact it
can be removed from auth completely. Also since the
previous patch made sure a new work item is used
for association, we can make the different data a
union.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Johannes Berg 2009-12-23 13:15:34 +01:00 committed by John W. Linville
parent 63f170e0c8
commit f679f65d41
2 changed files with 172 additions and 107 deletions

View File

@ -227,31 +227,48 @@ struct mesh_preq_queue {
u8 flags;
};
enum ieee80211_mgd_state {
IEEE80211_MGD_STATE_INVALID,
IEEE80211_MGD_STATE_PROBE,
IEEE80211_MGD_STATE_AUTH,
IEEE80211_MGD_STATE_ASSOC,
enum ieee80211_work_type {
IEEE80211_WORK_AUTH_PROBE,
IEEE80211_WORK_AUTH,
IEEE80211_WORK_ASSOC,
};
struct ieee80211_mgd_work {
struct ieee80211_work {
struct list_head list;
struct ieee80211_bss *bss;
int ie_len;
u8 prev_bssid[ETH_ALEN];
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len;
struct ieee80211_channel *chan;
/* XXX: chan type? -- right now not really needed */
unsigned long timeout;
enum ieee80211_mgd_state state;
u16 auth_alg, auth_transaction;
enum ieee80211_work_type type;
int tries;
u8 key[WLAN_KEY_LEN_WEP104];
u8 key_len, key_idx;
union {
struct {
int tries;
u16 algorithm, transaction;
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len;
u8 bssid[ETH_ALEN];
u8 key[WLAN_KEY_LEN_WEP104];
u8 key_len, key_idx;
bool privacy;
} auth;
struct {
struct ieee80211_bss *bss;
const u8 *supp_rates;
const u8 *ht_information_ie;
int tries;
u16 capability;
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len;
u8 supp_rates_len;
bool wmm_used;
} assoc;
};
int ie_len;
/* must be last */
u8 ie[0]; /* for auth or assoc frame, not probe */
u8 ie[0];
};
/* flags used in struct ieee80211_if_managed.flags */

View File

@ -125,15 +125,15 @@ static int ecw2cw(int ecw)
return (1 << ecw) - 1;
}
static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
static int ieee80211_compatible_rates(const u8 *supp_rates, int supp_rates_len,
struct ieee80211_supported_band *sband,
u32 *rates)
{
int i, j, count;
*rates = 0;
count = 0;
for (i = 0; i < bss->supp_rates_len; i++) {
int rate = (bss->supp_rates[i] & 0x7F) * 5;
for (i = 0; i < supp_rates_len; i++) {
int rate = (supp_rates[i] & 0x7F) * 5;
for (j = 0; j < sband->n_bitrates; j++)
if (sband->bitrates[j].bitrate == rate) {
@ -232,7 +232,7 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
/* frame sending functions */
static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk)
struct ieee80211_work *wk)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local;
@ -248,7 +248,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
skb = dev_alloc_skb(local->hw.extra_tx_headroom +
sizeof(*mgmt) + 200 + wk->ie_len +
wk->ssid_len);
wk->assoc.ssid_len);
if (!skb) {
printk(KERN_DEBUG "%s: failed to allocate buffer for assoc "
"frame\n", sdata->name);
@ -267,35 +267,37 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
capab |= WLAN_CAPABILITY_SHORT_PREAMBLE;
}
if (wk->bss->cbss.capability & WLAN_CAPABILITY_PRIVACY)
if (wk->assoc.capability & WLAN_CAPABILITY_PRIVACY)
capab |= WLAN_CAPABILITY_PRIVACY;
if (wk->bss->wmm_used)
if (wk->assoc.wmm_used)
wmm = 1;
/* get all rates supported by the device and the AP as
* some APs don't like getting a superset of their rates
* in the association request (e.g. D-Link DAP 1353 in
* b-only mode) */
rates_len = ieee80211_compatible_rates(wk->bss, sband, &rates);
rates_len = ieee80211_compatible_rates(wk->assoc.supp_rates,
wk->assoc.supp_rates_len,
sband, &rates);
if ((wk->bss->cbss.capability & WLAN_CAPABILITY_SPECTRUM_MGMT) &&
if ((wk->assoc.capability & WLAN_CAPABILITY_SPECTRUM_MGMT) &&
(local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT))
capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
memset(mgmt, 0, 24);
memcpy(mgmt->da, wk->bss->cbss.bssid, ETH_ALEN);
memcpy(mgmt->da, wk->assoc.bssid, ETH_ALEN);
memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
memcpy(mgmt->bssid, wk->bss->cbss.bssid, ETH_ALEN);
memcpy(mgmt->bssid, wk->assoc.bssid, ETH_ALEN);
if (!is_zero_ether_addr(wk->prev_bssid)) {
if (!is_zero_ether_addr(wk->assoc.prev_bssid)) {
skb_put(skb, 10);
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_REASSOC_REQ);
mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab);
mgmt->u.reassoc_req.listen_interval =
cpu_to_le16(local->hw.conf.listen_interval);
memcpy(mgmt->u.reassoc_req.current_ap, wk->prev_bssid,
memcpy(mgmt->u.reassoc_req.current_ap, wk->assoc.prev_bssid,
ETH_ALEN);
} else {
skb_put(skb, 4);
@ -307,10 +309,10 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
}
/* SSID */
ies = pos = skb_put(skb, 2 + wk->ssid_len);
ies = pos = skb_put(skb, 2 + wk->assoc.ssid_len);
*pos++ = WLAN_EID_SSID;
*pos++ = wk->ssid_len;
memcpy(pos, wk->ssid, wk->ssid_len);
*pos++ = wk->assoc.ssid_len;
memcpy(pos, wk->assoc.ssid, wk->assoc.ssid_len);
/* add all rates which were marked to be used above */
supp_rates_len = rates_len;
@ -392,7 +394,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
*/
if (wmm && (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
sband->ht_cap.ht_supported &&
(ht_ie = ieee80211_bss_get_ie(&wk->bss->cbss, WLAN_EID_HT_INFORMATION)) &&
(ht_ie = wk->assoc.ht_information_ie) &&
ht_ie[1] >= sizeof(struct ieee80211_ht_info) &&
(!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))) {
struct ieee80211_ht_info *ht_info =
@ -1003,23 +1005,43 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
netif_carrier_on(sdata->dev);
}
static void ieee80211_remove_auth_bss(struct ieee80211_local *local,
struct ieee80211_work *wk)
{
struct cfg80211_bss *cbss;
u16 capa_val = WLAN_CAPABILITY_ESS;
if (wk->auth.privacy)
capa_val |= WLAN_CAPABILITY_PRIVACY;
cbss = cfg80211_get_bss(local->hw.wiphy, wk->chan, wk->auth.bssid,
wk->auth.ssid, wk->auth.ssid_len,
WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY,
capa_val);
if (!cbss)
return;
cfg80211_unlink_bss(local->hw.wiphy, cbss);
cfg80211_put_bss(cbss);
}
static enum rx_mgmt_action __must_check
ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk)
struct ieee80211_work *wk)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local;
wk->tries++;
if (wk->tries > IEEE80211_AUTH_MAX_TRIES) {
wk->auth.tries++;
if (wk->auth.tries > IEEE80211_AUTH_MAX_TRIES) {
printk(KERN_DEBUG "%s: direct probe to AP %pM timed out\n",
sdata->name, wk->bss->cbss.bssid);
sdata->name, wk->auth.bssid);
/*
* Most likely AP is not in the range so remove the
* bss struct for that AP.
*/
cfg80211_unlink_bss(local->hw.wiphy, &wk->bss->cbss);
ieee80211_remove_auth_bss(local, wk);
/*
* We might have a pending scan which had no chance to run yet
@ -1031,14 +1053,14 @@ ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata,
}
printk(KERN_DEBUG "%s: direct probe to AP %pM (try %d)\n",
sdata->name, wk->bss->cbss.bssid,
wk->tries);
sdata->name, wk->auth.bssid, wk->auth.tries);
/*
* Direct probe is sent to broadcast address as some APs
* will not answer to direct packet in unassociated state.
*/
ieee80211_send_probe_req(sdata, NULL, wk->ssid, wk->ssid_len, NULL, 0);
ieee80211_send_probe_req(sdata, NULL, wk->auth.ssid, wk->auth.ssid_len,
NULL, 0);
wk->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
run_again(ifmgd, wk->timeout);
@ -1049,22 +1071,21 @@ ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata,
static enum rx_mgmt_action __must_check
ieee80211_authenticate(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk)
struct ieee80211_work *wk)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local;
wk->tries++;
if (wk->tries > IEEE80211_AUTH_MAX_TRIES) {
wk->auth.tries++;
if (wk->auth.tries > IEEE80211_AUTH_MAX_TRIES) {
printk(KERN_DEBUG "%s: authentication with AP %pM"
" timed out\n",
sdata->name, wk->bss->cbss.bssid);
" timed out\n", sdata->name, wk->auth.bssid);
/*
* Most likely AP is not in the range so remove the
* bss struct for that AP.
*/
cfg80211_unlink_bss(local->hw.wiphy, &wk->bss->cbss);
ieee80211_remove_auth_bss(local, wk);
/*
* We might have a pending scan which had no chance to run yet
@ -1076,11 +1097,11 @@ ieee80211_authenticate(struct ieee80211_sub_if_data *sdata,
}
printk(KERN_DEBUG "%s: authenticate with AP %pM (try %d)\n",
sdata->name, wk->bss->cbss.bssid, wk->tries);
sdata->name, wk->auth.bssid, wk->auth.tries);
ieee80211_send_auth(sdata, 1, wk->auth_alg, wk->ie, wk->ie_len,
wk->bss->cbss.bssid, NULL, 0, 0);
wk->auth_transaction = 2;
ieee80211_send_auth(sdata, 1, wk->auth.algorithm, wk->ie, wk->ie_len,
wk->auth.bssid, NULL, 0, 0);
wk->auth.transaction = 2;
wk->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
run_again(ifmgd, wk->timeout);
@ -1176,22 +1197,22 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata)
static enum rx_mgmt_action __must_check
ieee80211_associate(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk)
struct ieee80211_work *wk)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local;
wk->tries++;
if (wk->tries > IEEE80211_ASSOC_MAX_TRIES) {
wk->assoc.tries++;
if (wk->assoc.tries > IEEE80211_ASSOC_MAX_TRIES) {
printk(KERN_DEBUG "%s: association with AP %pM"
" timed out\n",
sdata->name, wk->bss->cbss.bssid);
sdata->name, wk->assoc.bssid);
/*
* Most likely AP is not in the range so remove the
* bss struct for that AP.
*/
cfg80211_unlink_bss(local->hw.wiphy, &wk->bss->cbss);
cfg80211_unlink_bss(local->hw.wiphy, &wk->assoc.bss->cbss);
/*
* We might have a pending scan which had no chance to run yet
@ -1203,7 +1224,7 @@ ieee80211_associate(struct ieee80211_sub_if_data *sdata,
}
printk(KERN_DEBUG "%s: associate with AP %pM (try %d)\n",
sdata->name, wk->bss->cbss.bssid, wk->tries);
sdata->name, wk->assoc.bssid, wk->assoc.tries);
ieee80211_send_assoc(sdata, wk);
wk->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT;
@ -1318,7 +1339,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif)
EXPORT_SYMBOL(ieee80211_beacon_loss);
static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk)
struct ieee80211_work *wk)
{
list_del(&wk->list);
kfree(wk);
@ -1327,7 +1348,7 @@ static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata,
static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk,
struct ieee80211_work *wk,
struct ieee80211_mgmt *mgmt,
size_t len)
{
@ -1338,38 +1359,38 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
if (!elems.challenge)
return;
ieee80211_send_auth(sdata, 3, wk->auth_alg,
ieee80211_send_auth(sdata, 3, wk->auth.algorithm,
elems.challenge - 2, elems.challenge_len + 2,
wk->bss->cbss.bssid,
wk->key, wk->key_len, wk->key_idx);
wk->auth_transaction = 4;
wk->auth.bssid, wk->auth.key, wk->auth.key_len,
wk->auth.key_idx);
wk->auth.transaction = 4;
}
static enum rx_mgmt_action __must_check
ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk,
struct ieee80211_work *wk,
struct ieee80211_mgmt *mgmt, size_t len)
{
u16 auth_alg, auth_transaction, status_code;
if (wk->state != IEEE80211_MGD_STATE_AUTH)
if (wk->type != IEEE80211_WORK_AUTH)
return RX_MGMT_NONE;
if (len < 24 + 6)
return RX_MGMT_NONE;
if (memcmp(wk->bss->cbss.bssid, mgmt->sa, ETH_ALEN) != 0)
if (memcmp(wk->auth.bssid, mgmt->sa, ETH_ALEN) != 0)
return RX_MGMT_NONE;
if (memcmp(wk->bss->cbss.bssid, mgmt->bssid, ETH_ALEN) != 0)
if (memcmp(wk->auth.bssid, mgmt->bssid, ETH_ALEN) != 0)
return RX_MGMT_NONE;
auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
status_code = le16_to_cpu(mgmt->u.auth.status_code);
if (auth_alg != wk->auth_alg ||
auth_transaction != wk->auth_transaction)
if (auth_alg != wk->auth.algorithm ||
auth_transaction != wk->auth.transaction)
return RX_MGMT_NONE;
if (status_code != WLAN_STATUS_SUCCESS) {
@ -1378,14 +1399,14 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
return RX_MGMT_CFG80211_AUTH;
}
switch (wk->auth_alg) {
switch (wk->auth.algorithm) {
case WLAN_AUTH_OPEN:
case WLAN_AUTH_LEAP:
case WLAN_AUTH_FT:
ieee80211_auth_completed(sdata, wk);
return RX_MGMT_CFG80211_AUTH;
case WLAN_AUTH_SHARED_KEY:
if (wk->auth_transaction == 4) {
if (wk->auth.transaction == 4) {
ieee80211_auth_completed(sdata, wk);
return RX_MGMT_CFG80211_AUTH;
} else
@ -1455,7 +1476,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
static enum rx_mgmt_action __must_check
ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk,
struct ieee80211_work *wk,
struct ieee80211_mgmt *mgmt, size_t len,
bool reassoc)
{
@ -1463,7 +1484,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_local *local = sdata->local;
struct ieee80211_supported_band *sband;
struct sta_info *sta;
struct ieee80211_bss *bss = wk->bss;
struct ieee80211_bss *bss = wk->assoc.bss;
u32 rates, basic_rates;
u16 capab_info, status_code, aid;
struct ieee802_11_elems elems;
@ -1693,7 +1714,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk,
struct ieee80211_work *wk,
struct ieee80211_mgmt *mgmt, size_t len,
struct ieee80211_rx_status *rx_status)
{
@ -1718,11 +1739,11 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
/* direct probe may be part of the association flow */
if (wk && wk->state == IEEE80211_MGD_STATE_PROBE) {
if (wk && wk->type == IEEE80211_WORK_AUTH_PROBE) {
printk(KERN_DEBUG "%s: direct probe responded\n",
sdata->name);
wk->tries = 0;
wk->state = IEEE80211_MGD_STATE_AUTH;
wk->auth.tries = 0;
wk->type = IEEE80211_WORK_AUTH;
WARN_ON(ieee80211_authenticate(sdata, wk) != RX_MGMT_NONE);
}
@ -1959,7 +1980,7 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_rx_status *rx_status;
struct ieee80211_mgmt *mgmt;
struct ieee80211_mgd_work *wk;
struct ieee80211_work *wk;
enum rx_mgmt_action rma = RX_MGMT_NONE;
u16 fc;
@ -2013,7 +2034,20 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
}
list_for_each_entry(wk, &ifmgd->work_list, list) {
if (memcmp(wk->bss->cbss.bssid, mgmt->bssid, ETH_ALEN) != 0)
const u8 *bssid = NULL;
switch (wk->type) {
case IEEE80211_WORK_AUTH_PROBE:
case IEEE80211_WORK_AUTH:
bssid = wk->auth.bssid;
break;
case IEEE80211_WORK_ASSOC:
bssid = wk->assoc.bssid;
break;
default:
continue;
}
if (memcmp(bssid, mgmt->bssid, ETH_ALEN) != 0)
continue;
switch (fc & IEEE80211_FCTL_STYPE) {
@ -2108,7 +2142,7 @@ static void ieee80211_sta_work(struct work_struct *work)
struct ieee80211_local *local = sdata->local;
struct ieee80211_if_managed *ifmgd;
struct sk_buff *skb;
struct ieee80211_mgd_work *wk, *tmp;
struct ieee80211_work *wk, *tmp;
LIST_HEAD(free_work);
enum rx_mgmt_action rma;
@ -2194,19 +2228,19 @@ static void ieee80211_sta_work(struct work_struct *work)
continue;
}
switch (wk->state) {
switch (wk->type) {
default:
WARN_ON(1);
/* nothing */
rma = RX_MGMT_NONE;
break;
case IEEE80211_MGD_STATE_PROBE:
case IEEE80211_WORK_AUTH_PROBE:
rma = ieee80211_direct_probe(sdata, wk);
break;
case IEEE80211_MGD_STATE_AUTH:
case IEEE80211_WORK_AUTH:
rma = ieee80211_authenticate(sdata, wk);
break;
case IEEE80211_MGD_STATE_ASSOC:
case IEEE80211_WORK_ASSOC:
rma = ieee80211_associate(sdata, wk);
break;
}
@ -2243,12 +2277,11 @@ static void ieee80211_sta_work(struct work_struct *work)
/* see above how we're using wk->timeout */
switch (wk->timeout) {
case RX_MGMT_CFG80211_AUTH_TO:
cfg80211_send_auth_timeout(sdata->dev,
wk->bss->cbss.bssid);
cfg80211_send_auth_timeout(sdata->dev, wk->auth.bssid);
break;
case RX_MGMT_CFG80211_ASSOC_TO:
cfg80211_send_assoc_timeout(sdata->dev,
wk->bss->cbss.bssid);
wk->assoc.bssid);
break;
default:
WARN(1, "unexpected: %lu", wk->timeout);
@ -2415,7 +2448,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
const u8 *ssid;
struct ieee80211_mgd_work *wk;
struct ieee80211_work *wk;
u16 auth_alg;
switch (req->auth_type) {
@ -2439,7 +2472,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
if (!wk)
return -ENOMEM;
wk->bss = (void *)req->bss;
memcpy(wk->auth.bssid, req->bss->bssid, ETH_ALEN);;
if (req->ie && req->ie_len) {
memcpy(wk->ie, req->ie, req->ie_len);
@ -2447,22 +2480,27 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
}
if (req->key && req->key_len) {
wk->key_len = req->key_len;
wk->key_idx = req->key_idx;
memcpy(wk->key, req->key, req->key_len);
wk->auth.key_len = req->key_len;
wk->auth.key_idx = req->key_idx;
memcpy(wk->auth.key, req->key, req->key_len);
}
ssid = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID);
memcpy(wk->ssid, ssid + 2, ssid[1]);
wk->ssid_len = ssid[1];
memcpy(wk->auth.ssid, ssid + 2, ssid[1]);
wk->auth.ssid_len = ssid[1];
wk->state = IEEE80211_MGD_STATE_PROBE;
wk->auth_alg = auth_alg;
wk->auth.algorithm = auth_alg;
wk->auth.privacy = req->bss->capability & WLAN_CAPABILITY_PRIVACY;
wk->type = IEEE80211_WORK_AUTH_PROBE;
wk->timeout = jiffies; /* run right away */
wk->chan = req->bss->channel;
/*
* XXX: if still associated need to tell AP that we're going
* to sleep and then change channel etc.
* For now switch channel here, later will be handled
* by submitting this as an off-channel work item.
*/
sdata->local->oper_channel = req->bss->channel;
ieee80211_hw_config(sdata->local, 0);
@ -2479,7 +2517,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
struct cfg80211_assoc_request *req)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_mgd_work *wk;
struct ieee80211_work *wk;
const u8 *ssid;
int i, err;
@ -2506,17 +2544,27 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
} else
wk->ie_len = 0;
wk->bss = (void *)req->bss;
wk->assoc.bss = (void *)req->bss;
memcpy(wk->assoc.bssid, req->bss->bssid, ETH_ALEN);
wk->assoc.capability = req->bss->capability;
wk->assoc.wmm_used = wk->assoc.bss->wmm_used;
wk->assoc.supp_rates = wk->assoc.bss->supp_rates;
wk->assoc.supp_rates_len = wk->assoc.bss->supp_rates_len;
wk->assoc.ht_information_ie =
ieee80211_bss_get_ie(req->bss, WLAN_EID_HT_INFORMATION);
ssid = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID);
memcpy(wk->ssid, ssid + 2, ssid[1]);
wk->ssid_len = ssid[1];
memcpy(wk->assoc.ssid, ssid + 2, ssid[1]);
wk->assoc.ssid_len = ssid[1];
if (req->prev_bssid)
memcpy(wk->prev_bssid, req->prev_bssid, ETH_ALEN);
memcpy(wk->assoc.prev_bssid, req->prev_bssid, ETH_ALEN);
wk->state = IEEE80211_MGD_STATE_ASSOC;
wk->type = IEEE80211_WORK_ASSOC;
wk->timeout = jiffies; /* run right away */
wk->chan = req->bss->channel;
if (req->use_mfp) {
ifmgd->mfp = IEEE80211_MFP_REQUIRED;
@ -2549,7 +2597,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
void *cookie)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_mgd_work *wk;
struct ieee80211_work *wk;
const u8 *bssid = req->bss->bssid;
bool not_auth_yet = false;
@ -2559,9 +2607,9 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
bssid = req->bss->bssid;
ieee80211_set_disassoc(sdata);
} else list_for_each_entry(wk, &ifmgd->work_list, list) {
if (wk->state != IEEE80211_MGD_STATE_PROBE)
if (wk->type != IEEE80211_WORK_AUTH_PROBE)
continue;
if (req->bss != &wk->bss->cbss)
if (memcmp(req->bss->bssid, wk->auth.bssid, ETH_ALEN))
continue;
not_auth_yet = true;
list_del(&wk->list);