Commit f679f65d authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 63f170e0
...@@ -227,31 +227,48 @@ struct mesh_preq_queue { ...@@ -227,31 +227,48 @@ struct mesh_preq_queue {
u8 flags; u8 flags;
}; };
enum ieee80211_mgd_state { enum ieee80211_work_type {
IEEE80211_MGD_STATE_INVALID, IEEE80211_WORK_AUTH_PROBE,
IEEE80211_MGD_STATE_PROBE, IEEE80211_WORK_AUTH,
IEEE80211_MGD_STATE_AUTH, IEEE80211_WORK_ASSOC,
IEEE80211_MGD_STATE_ASSOC,
}; };
struct ieee80211_mgd_work { struct ieee80211_work {
struct list_head list; 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;
unsigned long timeout;
enum ieee80211_mgd_state state;
u16 auth_alg, auth_transaction;
int tries; struct ieee80211_channel *chan;
/* XXX: chan type? -- right now not really needed */
unsigned long timeout;
enum ieee80211_work_type type;
u8 key[WLAN_KEY_LEN_WEP104]; union {
u8 key_len, key_idx; 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 */ /* must be last */
u8 ie[0]; /* for auth or assoc frame, not probe */ u8 ie[0];
}; };
/* flags used in struct ieee80211_if_managed.flags */ /* flags used in struct ieee80211_if_managed.flags */
......
...@@ -125,15 +125,15 @@ static int ecw2cw(int ecw) ...@@ -125,15 +125,15 @@ static int ecw2cw(int ecw)
return (1 << ecw) - 1; 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, struct ieee80211_supported_band *sband,
u32 *rates) u32 *rates)
{ {
int i, j, count; int i, j, count;
*rates = 0; *rates = 0;
count = 0; count = 0;
for (i = 0; i < bss->supp_rates_len; i++) { for (i = 0; i < supp_rates_len; i++) {
int rate = (bss->supp_rates[i] & 0x7F) * 5; int rate = (supp_rates[i] & 0x7F) * 5;
for (j = 0; j < sband->n_bitrates; j++) for (j = 0; j < sband->n_bitrates; j++)
if (sband->bitrates[j].bitrate == rate) { if (sband->bitrates[j].bitrate == rate) {
...@@ -232,7 +232,7 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, ...@@ -232,7 +232,7 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
/* frame sending functions */ /* frame sending functions */
static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, 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_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
...@@ -248,7 +248,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, ...@@ -248,7 +248,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
skb = dev_alloc_skb(local->hw.extra_tx_headroom + skb = dev_alloc_skb(local->hw.extra_tx_headroom +
sizeof(*mgmt) + 200 + wk->ie_len + sizeof(*mgmt) + 200 + wk->ie_len +
wk->ssid_len); wk->assoc.ssid_len);
if (!skb) { if (!skb) {
printk(KERN_DEBUG "%s: failed to allocate buffer for assoc " printk(KERN_DEBUG "%s: failed to allocate buffer for assoc "
"frame\n", sdata->name); "frame\n", sdata->name);
...@@ -267,35 +267,37 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, ...@@ -267,35 +267,37 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; capab |= WLAN_CAPABILITY_SHORT_PREAMBLE;
} }
if (wk->bss->cbss.capability & WLAN_CAPABILITY_PRIVACY) if (wk->assoc.capability & WLAN_CAPABILITY_PRIVACY)
capab |= WLAN_CAPABILITY_PRIVACY; capab |= WLAN_CAPABILITY_PRIVACY;
if (wk->bss->wmm_used) if (wk->assoc.wmm_used)
wmm = 1; wmm = 1;
/* get all rates supported by the device and the AP as /* get all rates supported by the device and the AP as
* some APs don't like getting a superset of their rates * some APs don't like getting a superset of their rates
* in the association request (e.g. D-Link DAP 1353 in * in the association request (e.g. D-Link DAP 1353 in
* b-only mode) */ * 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)) (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT))
capab |= WLAN_CAPABILITY_SPECTRUM_MGMT; capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
memset(mgmt, 0, 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->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); skb_put(skb, 10);
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_REASSOC_REQ); IEEE80211_STYPE_REASSOC_REQ);
mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab);
mgmt->u.reassoc_req.listen_interval = mgmt->u.reassoc_req.listen_interval =
cpu_to_le16(local->hw.conf.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); ETH_ALEN);
} else { } else {
skb_put(skb, 4); skb_put(skb, 4);
...@@ -307,10 +309,10 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, ...@@ -307,10 +309,10 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
} }
/* SSID */ /* 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++ = WLAN_EID_SSID;
*pos++ = wk->ssid_len; *pos++ = wk->assoc.ssid_len;
memcpy(pos, wk->ssid, wk->ssid_len); memcpy(pos, wk->assoc.ssid, wk->assoc.ssid_len);
/* add all rates which were marked to be used above */ /* add all rates which were marked to be used above */
supp_rates_len = rates_len; supp_rates_len = rates_len;
...@@ -392,7 +394,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, ...@@ -392,7 +394,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
*/ */
if (wmm && (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) && if (wmm && (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
sband->ht_cap.ht_supported && 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) && ht_ie[1] >= sizeof(struct ieee80211_ht_info) &&
(!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))) { (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))) {
struct ieee80211_ht_info *ht_info = struct ieee80211_ht_info *ht_info =
...@@ -1003,23 +1005,43 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, ...@@ -1003,23 +1005,43 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
netif_carrier_on(sdata->dev); 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 static enum rx_mgmt_action __must_check
ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, 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_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
wk->tries++; wk->auth.tries++;
if (wk->tries > IEEE80211_AUTH_MAX_TRIES) { if (wk->auth.tries > IEEE80211_AUTH_MAX_TRIES) {
printk(KERN_DEBUG "%s: direct probe to AP %pM timed out\n", 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 * Most likely AP is not in the range so remove the
* bss struct for that AP. * 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 * 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, ...@@ -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", printk(KERN_DEBUG "%s: direct probe to AP %pM (try %d)\n",
sdata->name, wk->bss->cbss.bssid, sdata->name, wk->auth.bssid, wk->auth.tries);
wk->tries);
/* /*
* Direct probe is sent to broadcast address as some APs * Direct probe is sent to broadcast address as some APs
* will not answer to direct packet in unassociated state. * 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; wk->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
run_again(ifmgd, wk->timeout); run_again(ifmgd, wk->timeout);
...@@ -1049,22 +1071,21 @@ ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, ...@@ -1049,22 +1071,21 @@ ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata,
static enum rx_mgmt_action __must_check static enum rx_mgmt_action __must_check
ieee80211_authenticate(struct ieee80211_sub_if_data *sdata, 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_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
wk->tries++; wk->auth.tries++;
if (wk->tries > IEEE80211_AUTH_MAX_TRIES) { if (wk->auth.tries > IEEE80211_AUTH_MAX_TRIES) {
printk(KERN_DEBUG "%s: authentication with AP %pM" printk(KERN_DEBUG "%s: authentication with AP %pM"
" timed out\n", " timed out\n", sdata->name, wk->auth.bssid);
sdata->name, wk->bss->cbss.bssid);
/* /*
* Most likely AP is not in the range so remove the * Most likely AP is not in the range so remove the
* bss struct for that AP. * 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 * 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, ...@@ -1076,11 +1097,11 @@ ieee80211_authenticate(struct ieee80211_sub_if_data *sdata,
} }
printk(KERN_DEBUG "%s: authenticate with AP %pM (try %d)\n", 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, ieee80211_send_auth(sdata, 1, wk->auth.algorithm, wk->ie, wk->ie_len,
wk->bss->cbss.bssid, NULL, 0, 0); wk->auth.bssid, NULL, 0, 0);
wk->auth_transaction = 2; wk->auth.transaction = 2;
wk->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; wk->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
run_again(ifmgd, wk->timeout); run_again(ifmgd, wk->timeout);
...@@ -1176,22 +1197,22 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata) ...@@ -1176,22 +1197,22 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata)
static enum rx_mgmt_action __must_check static enum rx_mgmt_action __must_check
ieee80211_associate(struct ieee80211_sub_if_data *sdata, 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_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
wk->tries++; wk->assoc.tries++;
if (wk->tries > IEEE80211_ASSOC_MAX_TRIES) { if (wk->assoc.tries > IEEE80211_ASSOC_MAX_TRIES) {
printk(KERN_DEBUG "%s: association with AP %pM" printk(KERN_DEBUG "%s: association with AP %pM"
" timed out\n", " 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 * Most likely AP is not in the range so remove the
* bss struct for that AP. * 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 * 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, ...@@ -1203,7 +1224,7 @@ ieee80211_associate(struct ieee80211_sub_if_data *sdata,
} }
printk(KERN_DEBUG "%s: associate with AP %pM (try %d)\n", 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); ieee80211_send_assoc(sdata, wk);
wk->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; wk->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT;
...@@ -1318,7 +1339,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif) ...@@ -1318,7 +1339,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif)
EXPORT_SYMBOL(ieee80211_beacon_loss); EXPORT_SYMBOL(ieee80211_beacon_loss);
static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata, static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk) struct ieee80211_work *wk)
{ {
list_del(&wk->list); list_del(&wk->list);
kfree(wk); kfree(wk);
...@@ -1327,7 +1348,7 @@ static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata, ...@@ -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, static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_work *wk, struct ieee80211_work *wk,
struct ieee80211_mgmt *mgmt, struct ieee80211_mgmt *mgmt,
size_t len) size_t len)
{ {
...@@ -1338,38 +1359,38 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata, ...@@ -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); ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
if (!elems.challenge) if (!elems.challenge)
return; return;
ieee80211_send_auth(sdata, 3, wk->auth_alg, ieee80211_send_auth(sdata, 3, wk->auth.algorithm,
elems.challenge - 2, elems.challenge_len + 2, elems.challenge - 2, elems.challenge_len + 2,
wk->bss->cbss.bssid, wk->auth.bssid, wk->auth.key, wk->auth.key_len,
wk->key, wk->key_len, wk->key_idx); wk->auth.key_idx);
wk->auth_transaction = 4; wk->auth.transaction = 4;
} }
static enum rx_mgmt_action __must_check static enum rx_mgmt_action __must_check
ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, 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) struct ieee80211_mgmt *mgmt, size_t len)
{ {
u16 auth_alg, auth_transaction, status_code; u16 auth_alg, auth_transaction, status_code;
if (wk->state != IEEE80211_MGD_STATE_AUTH) if (wk->type != IEEE80211_WORK_AUTH)
return RX_MGMT_NONE; return RX_MGMT_NONE;
if (len < 24 + 6) if (len < 24 + 6)
return RX_MGMT_NONE; 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; 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; return RX_MGMT_NONE;
auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
status_code = le16_to_cpu(mgmt->u.auth.status_code); status_code = le16_to_cpu(mgmt->u.auth.status_code);
if (auth_alg != wk->auth_alg || if (auth_alg != wk->auth.algorithm ||
auth_transaction != wk->auth_transaction) auth_transaction != wk->auth.transaction)
return RX_MGMT_NONE; return RX_MGMT_NONE;
if (status_code != WLAN_STATUS_SUCCESS) { if (status_code != WLAN_STATUS_SUCCESS) {
...@@ -1378,14 +1399,14 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -1378,14 +1399,14 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
return RX_MGMT_CFG80211_AUTH; return RX_MGMT_CFG80211_AUTH;
} }
switch (wk->auth_alg) { switch (wk->auth.algorithm) {
case WLAN_AUTH_OPEN: case WLAN_AUTH_OPEN:
case WLAN_AUTH_LEAP: case WLAN_AUTH_LEAP:
case WLAN_AUTH_FT: case WLAN_AUTH_FT:
ieee80211_auth_completed(sdata, wk); ieee80211_auth_completed(sdata, wk);
return RX_MGMT_CFG80211_AUTH; return RX_MGMT_CFG80211_AUTH;
case WLAN_AUTH_SHARED_KEY: case WLAN_AUTH_SHARED_KEY:
if (wk->auth_transaction == 4) { if (wk->auth.transaction == 4) {
ieee80211_auth_completed(sdata, wk); ieee80211_auth_completed(sdata, wk);
return RX_MGMT_CFG80211_AUTH; return RX_MGMT_CFG80211_AUTH;
} else } else
...@@ -1455,7 +1476,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -1455,7 +1476,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
static enum rx_mgmt_action __must_check static enum rx_mgmt_action __must_check
ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, 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, struct ieee80211_mgmt *mgmt, size_t len,
bool reassoc) bool reassoc)
{ {
...@@ -1463,7 +1484,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -1463,7 +1484,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
struct sta_info *sta; struct sta_info *sta;
struct ieee80211_bss *bss = wk->bss; struct ieee80211_bss *bss = wk->assoc.bss;
u32 rates, basic_rates; u32 rates, basic_rates;
u16 capab_info, status_code, aid; u16 capab_info, status_code, aid;
struct ieee802_11_elems elems; struct ieee802_11_elems elems;
...@@ -1693,7 +1714,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -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, 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_mgmt *mgmt, size_t len,
struct ieee80211_rx_status *rx_status) struct ieee80211_rx_status *rx_status)
{ {
...@@ -1718,11 +1739,11 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, ...@@ -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); ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
/* direct probe may be part of the association flow */ /* 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", printk(KERN_DEBUG "%s: direct probe responded\n",
sdata->name); sdata->name);
wk->tries = 0; wk->auth.tries = 0;
wk->state = IEEE80211_MGD_STATE_AUTH; wk->type = IEEE80211_WORK_AUTH;
WARN_ON(ieee80211_authenticate(sdata, wk) != RX_MGMT_NONE); 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, ...@@ -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;