[MAC80211]: Remove bitfields from struct ieee80211_if_sta

mac80211, remove bitfields from struct ieee80211_if_sta

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Slaby 2007-08-28 17:01:54 -04:00 committed by David S. Miller
parent badffb725c
commit d6f2da5b33
6 changed files with 121 additions and 88 deletions

View File

@ -112,13 +112,13 @@ static ssize_t ieee80211_if_fmt_flags(
const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
{ {
return scnprintf(buf, buflen, "%s%s%s%s%s%s%s\n", return scnprintf(buf, buflen, "%s%s%s%s%s%s%s\n",
sdata->u.sta.ssid_set ? "SSID\n" : "", sdata->u.sta.flags & IEEE80211_STA_SSID_SET ? "SSID\n" : "",
sdata->u.sta.bssid_set ? "BSSID\n" : "", sdata->u.sta.flags & IEEE80211_STA_BSSID_SET ? "BSSID\n" : "",
sdata->u.sta.prev_bssid_set ? "prev BSSID\n" : "", sdata->u.sta.flags & IEEE80211_STA_PREV_BSSID_SET ? "prev BSSID\n" : "",
sdata->u.sta.authenticated ? "AUTH\n" : "", sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
sdata->u.sta.associated ? "ASSOC\n" : "", sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
sdata->u.sta.probereq_poll ? "PROBEREQ POLL\n" : "", sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "",
sdata->use_protection ? "CTS prot\n" : ""); sdata->use_protection ? "CTS prot\n" : "");
} }
__IEEE80211_IF_FILE(flags); __IEEE80211_IF_FILE(flags);

View File

@ -354,7 +354,7 @@ static void ieee80211_if_open(struct net_device *dev)
switch (sdata->type) { switch (sdata->type) {
case IEEE80211_IF_TYPE_STA: case IEEE80211_IF_TYPE_STA:
case IEEE80211_IF_TYPE_IBSS: case IEEE80211_IF_TYPE_IBSS:
sdata->u.sta.prev_bssid_set = 0; sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET;
break; break;
} }
} }

View File

@ -217,6 +217,19 @@ struct ieee80211_if_vlan {
u8 id; u8 id;
}; };
/* flags used in struct ieee80211_if_sta.flags */
#define IEEE80211_STA_SSID_SET BIT(0)
#define IEEE80211_STA_BSSID_SET BIT(1)
#define IEEE80211_STA_PREV_BSSID_SET BIT(2)
#define IEEE80211_STA_AUTHENTICATED BIT(3)
#define IEEE80211_STA_ASSOCIATED BIT(4)
#define IEEE80211_STA_PROBEREQ_POLL BIT(5)
#define IEEE80211_STA_CREATE_IBSS BIT(6)
#define IEEE80211_STA_MIXED_CELL BIT(7)
#define IEEE80211_STA_WMM_ENABLED BIT(8)
#define IEEE80211_STA_AUTO_SSID_SEL BIT(10)
#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)
#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
struct ieee80211_if_sta { struct ieee80211_if_sta {
enum { enum {
IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
@ -239,18 +252,7 @@ struct ieee80211_if_sta {
int auth_tries, assoc_tries; int auth_tries, assoc_tries;
unsigned int ssid_set:1; unsigned int flags;
unsigned int bssid_set:1;
unsigned int prev_bssid_set:1;
unsigned int authenticated:1;
unsigned int associated:1;
unsigned int probereq_poll:1;
unsigned int create_ibss:1;
unsigned int mixed_cell:1;
unsigned int wmm_enabled:1;
unsigned int auto_ssid_sel:1;
unsigned int auto_bssid_sel:1;
unsigned int auto_channel_sel:1;
#define IEEE80211_STA_REQ_SCAN 0 #define IEEE80211_STA_REQ_SCAN 0
#define IEEE80211_STA_REQ_AUTH 1 #define IEEE80211_STA_REQ_AUTH 1
#define IEEE80211_STA_REQ_RUN 2 #define IEEE80211_STA_REQ_RUN 2

View File

@ -187,10 +187,10 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
ifsta->capab = WLAN_CAPABILITY_ESS; ifsta->capab = WLAN_CAPABILITY_ESS;
ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN | ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN |
IEEE80211_AUTH_ALG_SHARED_KEY; IEEE80211_AUTH_ALG_SHARED_KEY;
ifsta->create_ibss = 1; ifsta->flags |= IEEE80211_STA_CREATE_IBSS |
ifsta->wmm_enabled = 1; IEEE80211_STA_WMM_ENABLED |
ifsta->auto_channel_sel = 1; IEEE80211_STA_AUTO_BSSID_SEL |
ifsta->auto_bssid_sel = 1; IEEE80211_STA_AUTO_CHANNEL_SEL;
msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev); msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev);
sdata->bss = &msdata->u.ap; sdata->bss = &msdata->u.ap;

View File

@ -270,7 +270,7 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length); int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length);
if (ret) if (ret)
return ret; return ret;
sdata->u.sta.auto_bssid_sel = 0; sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
ieee80211_sta_req_auth(dev, &sdata->u.sta); ieee80211_sta_req_auth(dev, &sdata->u.sta);
return 0; return 0;
} }
@ -502,13 +502,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->type == IEEE80211_IF_TYPE_STA) if (sdata->type == IEEE80211_IF_TYPE_STA)
sdata->u.sta.auto_channel_sel = 0; sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
/* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
if (freq->e == 0) { if (freq->e == 0) {
if (freq->m < 0) { if (freq->m < 0) {
if (sdata->type == IEEE80211_IF_TYPE_STA) if (sdata->type == IEEE80211_IF_TYPE_STA)
sdata->u.sta.auto_channel_sel = 1; sdata->u.sta.flags |=
IEEE80211_STA_AUTO_CHANNEL_SEL;
return 0; return 0;
} else } else
return ieee80211_set_channel(local, freq->m, -1); return ieee80211_set_channel(local, freq->m, -1);
@ -563,7 +564,10 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
sdata->u.sta.ssid_len = len; sdata->u.sta.ssid_len = len;
return 0; return 0;
} }
sdata->u.sta.auto_ssid_sel = !data->flags; if (data->flags)
sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
else
sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL;
ret = ieee80211_sta_set_ssid(dev, ssid, len); ret = ieee80211_sta_set_ssid(dev, ssid, len);
if (ret) if (ret)
return ret; return ret;
@ -630,13 +634,13 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
ETH_ALEN); ETH_ALEN);
return 0; return 0;
} }
if (is_zero_ether_addr((u8 *) &ap_addr->sa_data)) { if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
sdata->u.sta.auto_bssid_sel = 1; sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL |
sdata->u.sta.auto_channel_sel = 1; IEEE80211_STA_AUTO_CHANNEL_SEL;
} else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data)) else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
sdata->u.sta.auto_bssid_sel = 1; sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL;
else else
sdata->u.sta.auto_bssid_sel = 0; sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data); ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data);
if (ret) if (ret)
return ret; return ret;
@ -1104,8 +1108,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
if (sdata->type != IEEE80211_IF_TYPE_STA && if (sdata->type != IEEE80211_IF_TYPE_STA &&
sdata->type != IEEE80211_IF_TYPE_IBSS) sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL; ret = -EINVAL;
else else {
sdata->u.sta.mixed_cell = !!value; if (value)
sdata->u.sta.flags |= IEEE80211_STA_MIXED_CELL;
else
sdata->u.sta.flags &= ~IEEE80211_STA_MIXED_CELL;
}
break; break;
case PRISM2_PARAM_HW_MODES: case PRISM2_PARAM_HW_MODES:
@ -1115,15 +1123,23 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
case PRISM2_PARAM_CREATE_IBSS: case PRISM2_PARAM_CREATE_IBSS:
if (sdata->type != IEEE80211_IF_TYPE_IBSS) if (sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL; ret = -EINVAL;
else else {
sdata->u.sta.create_ibss = !!value; if (value)
sdata->u.sta.flags |= IEEE80211_STA_CREATE_IBSS;
else
sdata->u.sta.flags &= ~IEEE80211_STA_CREATE_IBSS;
}
break; break;
case PRISM2_PARAM_WMM_ENABLED: case PRISM2_PARAM_WMM_ENABLED:
if (sdata->type != IEEE80211_IF_TYPE_STA && if (sdata->type != IEEE80211_IF_TYPE_STA &&
sdata->type != IEEE80211_IF_TYPE_IBSS) sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL; ret = -EINVAL;
else else {
sdata->u.sta.wmm_enabled = !!value; if (value)
sdata->u.sta.flags |= IEEE80211_STA_WMM_ENABLED;
else
sdata->u.sta.flags &= ~IEEE80211_STA_WMM_ENABLED;
}
break; break;
default: default:
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
@ -1186,7 +1202,8 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
if (sdata->type != IEEE80211_IF_TYPE_IBSS) if (sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL; ret = -EINVAL;
else else
*param = !!sdata->u.sta.create_ibss; *param = !!(sdata->u.sta.flags &
IEEE80211_STA_CREATE_IBSS);
break; break;
case PRISM2_PARAM_MIXED_CELL: case PRISM2_PARAM_MIXED_CELL:
@ -1194,14 +1211,16 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
sdata->type != IEEE80211_IF_TYPE_IBSS) sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL; ret = -EINVAL;
else else
*param = !!sdata->u.sta.mixed_cell; *param = !!(sdata->u.sta.flags &
IEEE80211_STA_MIXED_CELL);
break; break;
case PRISM2_PARAM_WMM_ENABLED: case PRISM2_PARAM_WMM_ENABLED:
if (sdata->type != IEEE80211_IF_TYPE_STA && if (sdata->type != IEEE80211_IF_TYPE_STA &&
sdata->type != IEEE80211_IF_TYPE_IBSS) sdata->type != IEEE80211_IF_TYPE_IBSS)
ret = -EINVAL; ret = -EINVAL;
else else
*param = !!sdata->u.sta.wmm_enabled; *param = !!(sdata->u.sta.flags &
IEEE80211_STA_WMM_ENABLED);
break; break;
default: default:
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;

View File

@ -403,18 +403,20 @@ static void ieee80211_sta_send_associnfo(struct net_device *dev,
static void ieee80211_set_associated(struct net_device *dev, static void ieee80211_set_associated(struct net_device *dev,
struct ieee80211_if_sta *ifsta, int assoc) struct ieee80211_if_sta *ifsta,
unsigned int assoc)
{ {
union iwreq_data wrqu; union iwreq_data wrqu;
if (ifsta->associated == assoc) if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc)
return; return;
ifsta->associated = assoc;
if (assoc) { if (assoc) {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
struct ieee80211_sta_bss *bss; struct ieee80211_sta_bss *bss;
ifsta->flags |= IEEE80211_STA_ASSOCIATED;
sdata = IEEE80211_DEV_TO_SUB_IF(dev); sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->type != IEEE80211_IF_TYPE_STA) if (sdata->type != IEEE80211_IF_TYPE_STA)
return; return;
@ -427,11 +429,13 @@ static void ieee80211_set_associated(struct net_device *dev,
} }
netif_carrier_on(dev); netif_carrier_on(dev);
ifsta->prev_bssid_set = 1; ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN);
memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN);
ieee80211_sta_send_associnfo(dev, ifsta); ieee80211_sta_send_associnfo(dev, ifsta);
} else { } else {
ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
netif_carrier_off(dev); netif_carrier_off(dev);
ieee80211_reset_erp_info(dev); ieee80211_reset_erp_info(dev);
memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
@ -579,7 +583,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN);
memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
if (ifsta->prev_bssid_set) { if (ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) {
skb_put(skb, 10); skb_put(skb, 10);
mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT,
IEEE80211_STYPE_REASSOC_REQ); IEEE80211_STYPE_REASSOC_REQ);
@ -631,7 +635,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
memcpy(pos, ifsta->extra_ie, ifsta->extra_ie_len); memcpy(pos, ifsta->extra_ie, ifsta->extra_ie_len);
} }
if (wmm && ifsta->wmm_enabled) { if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
pos = skb_put(skb, 9); pos = skb_put(skb, 9);
*pos++ = WLAN_EID_VENDOR_SPECIFIC; *pos++ = WLAN_EID_VENDOR_SPECIFIC;
*pos++ = 7; /* len */ *pos++ = 7; /* len */
@ -718,7 +722,8 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
struct ieee80211_sta_bss *bss; struct ieee80211_sta_bss *bss;
int res = 0; int res = 0;
if (!ifsta || ifsta->mixed_cell || ifsta->key_management_enabled) if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) ||
ifsta->key_management_enabled)
return 0; return 0;
bss = ieee80211_rx_bss_get(dev, ifsta->bssid); bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
@ -786,22 +791,20 @@ static void ieee80211_associated(struct net_device *dev,
disassoc = 0; disassoc = 0;
if (time_after(jiffies, if (time_after(jiffies,
sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { sta->last_rx + IEEE80211_MONITORING_INTERVAL)) {
if (ifsta->probereq_poll) { if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) {
printk(KERN_DEBUG "%s: No ProbeResp from " printk(KERN_DEBUG "%s: No ProbeResp from "
"current AP " MAC_FMT " - assume out of " "current AP " MAC_FMT " - assume out of "
"range\n", "range\n",
dev->name, MAC_ARG(ifsta->bssid)); dev->name, MAC_ARG(ifsta->bssid));
disassoc = 1; disassoc = 1;
sta_info_free(sta); sta_info_free(sta);
ifsta->probereq_poll = 0; } else
} else {
ieee80211_send_probe_req(dev, ifsta->bssid, ieee80211_send_probe_req(dev, ifsta->bssid,
local->scan_ssid, local->scan_ssid,
local->scan_ssid_len); local->scan_ssid_len);
ifsta->probereq_poll = 1; ifsta->flags ^= IEEE80211_STA_PROBEREQ_POLL;
}
} else { } else {
ifsta->probereq_poll = 0; ifsta->flags &= ~IEEE80211_STA_PROBEREQ_POLL;
if (time_after(jiffies, ifsta->last_probe + if (time_after(jiffies, ifsta->last_probe +
IEEE80211_PROBE_INTERVAL)) { IEEE80211_PROBE_INTERVAL)) {
ifsta->last_probe = jiffies; ifsta->last_probe = jiffies;
@ -905,7 +908,7 @@ static void ieee80211_auth_completed(struct net_device *dev,
struct ieee80211_if_sta *ifsta) struct ieee80211_if_sta *ifsta)
{ {
printk(KERN_DEBUG "%s: authenticated\n", dev->name); printk(KERN_DEBUG "%s: authenticated\n", dev->name);
ifsta->authenticated = 1; ifsta->flags |= IEEE80211_STA_AUTHENTICATED;
ieee80211_associate(dev, ifsta); ieee80211_associate(dev, ifsta);
} }
@ -1092,7 +1095,7 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
" (reason=%d)\n", " (reason=%d)\n",
dev->name, MAC_ARG(mgmt->sa), reason_code); dev->name, MAC_ARG(mgmt->sa), reason_code);
if (ifsta->authenticated) { if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) {
printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); printk(KERN_DEBUG "%s: deauthenticated\n", dev->name);
} }
@ -1105,7 +1108,7 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
} }
ieee80211_set_disassoc(dev, ifsta, 1); ieee80211_set_disassoc(dev, ifsta, 1);
ifsta->authenticated = 0; ifsta->flags &= ~IEEE80211_STA_AUTHENTICATED;
} }
@ -1137,7 +1140,7 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev,
" (reason=%d)\n", " (reason=%d)\n",
dev->name, MAC_ARG(mgmt->sa), reason_code); dev->name, MAC_ARG(mgmt->sa), reason_code);
if (ifsta->associated) if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
printk(KERN_DEBUG "%s: disassociated\n", dev->name); printk(KERN_DEBUG "%s: disassociated\n", dev->name);
if (ifsta->state == IEEE80211_ASSOCIATED) { if (ifsta->state == IEEE80211_ASSOCIATED) {
@ -1209,7 +1212,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
/* if this was a reassociation, ensure we try a "full" /* if this was a reassociation, ensure we try a "full"
* association next time. This works around some broken APs * association next time. This works around some broken APs
* which do not correctly reject reassociation requests. */ * which do not correctly reject reassociation requests. */
ifsta->prev_bssid_set = 0; ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
return; return;
} }
@ -1296,7 +1299,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
rate_control_rate_init(sta, local); rate_control_rate_init(sta, local);
if (elems.wmm_param && ifsta->wmm_enabled) { if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
sta->flags |= WLAN_STA_WME; sta->flags |= WLAN_STA_WME;
ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
elems.wmm_param_len); elems.wmm_param_len);
@ -1693,7 +1696,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
return; return;
ifsta = &sdata->u.sta; ifsta = &sdata->u.sta;
if (!ifsta->associated || if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED) ||
memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
return; return;
@ -1709,7 +1712,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
if (elems.erp_info && elems.erp_info_len >= 1) if (elems.erp_info && elems.erp_info_len >= 1)
ieee80211_handle_erp_ie(dev, elems.erp_info[0]); ieee80211_handle_erp_ie(dev, elems.erp_info[0]);
if (elems.wmm_param && ifsta->wmm_enabled) { if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
elems.wmm_param_len); elems.wmm_param_len);
} }
@ -2076,7 +2079,8 @@ static void ieee80211_sta_reset_auth(struct net_device *dev,
printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name, printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name,
ifsta->auth_alg); ifsta->auth_alg);
ifsta->auth_transaction = -1; ifsta->auth_transaction = -1;
ifsta->associated = ifsta->auth_tries = ifsta->assoc_tries = 0; ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
ifsta->auth_tries = ifsta->assoc_tries = 0;
netif_carrier_off(dev); netif_carrier_off(dev);
} }
@ -2090,8 +2094,10 @@ void ieee80211_sta_req_auth(struct net_device *dev,
if (sdata->type != IEEE80211_IF_TYPE_STA) if (sdata->type != IEEE80211_IF_TYPE_STA)
return; return;
if ((ifsta->bssid_set || ifsta->auto_bssid_sel) && if ((ifsta->flags & (IEEE80211_STA_BSSID_SET |
(ifsta->ssid_set || ifsta->auto_ssid_sel)) { IEEE80211_STA_AUTO_BSSID_SEL)) &&
(ifsta->flags & (IEEE80211_STA_SSID_SET |
IEEE80211_STA_AUTO_SSID_SEL))) {
set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
queue_work(local->hw.workqueue, &ifsta->work); queue_work(local->hw.workqueue, &ifsta->work);
} }
@ -2105,7 +2111,7 @@ static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta,
if (!memcmp(ifsta->ssid, ssid, ssid_len)) if (!memcmp(ifsta->ssid, ssid, ssid_len))
return 1; return 1;
if (ifsta->auto_bssid_sel) if (ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL)
return 0; return 0;
hidden_ssid = 1; hidden_ssid = 1;
@ -2134,8 +2140,8 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
struct ieee80211_sta_bss *bss, *selected = NULL; struct ieee80211_sta_bss *bss, *selected = NULL;
int top_rssi = 0, freq; int top_rssi = 0, freq;
if (!ifsta->auto_channel_sel && !ifsta->auto_bssid_sel && if (!(ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL |
!ifsta->auto_ssid_sel) { IEEE80211_STA_AUTO_BSSID_SEL | IEEE80211_STA_AUTO_CHANNEL_SEL))) {
ifsta->state = IEEE80211_AUTHENTICATE; ifsta->state = IEEE80211_AUTHENTICATE;
ieee80211_sta_reset_auth(dev, ifsta); ieee80211_sta_reset_auth(dev, ifsta);
return 0; return 0;
@ -2151,14 +2157,15 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
!!sdata->default_key) !!sdata->default_key)
continue; continue;
if (!ifsta->auto_channel_sel && bss->freq != freq) if (!(ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) &&
bss->freq != freq)
continue; continue;
if (!ifsta->auto_bssid_sel && if (!(ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL) &&
memcmp(bss->bssid, ifsta->bssid, ETH_ALEN)) memcmp(bss->bssid, ifsta->bssid, ETH_ALEN))
continue; continue;
if (!ifsta->auto_ssid_sel && if (!(ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) &&
!ieee80211_sta_match_ssid(ifsta, bss->ssid, bss->ssid_len)) !ieee80211_sta_match_ssid(ifsta, bss->ssid, bss->ssid_len))
continue; continue;
@ -2173,7 +2180,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
if (selected) { if (selected) {
ieee80211_set_channel(local, -1, selected->freq); ieee80211_set_channel(local, -1, selected->freq);
if (!ifsta->ssid_set) if (!(ifsta->flags & IEEE80211_STA_SSID_SET))
ieee80211_sta_set_ssid(dev, selected->ssid, ieee80211_sta_set_ssid(dev, selected->ssid,
selected->ssid_len); selected->ssid_len);
ieee80211_sta_set_bssid(dev, selected->bssid); ieee80211_sta_set_bssid(dev, selected->bssid);
@ -2183,7 +2190,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
return 0; return 0;
} else { } else {
if (ifsta->state != IEEE80211_AUTHENTICATE) { if (ifsta->state != IEEE80211_AUTHENTICATE) {
if (ifsta->auto_ssid_sel) if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL)
ieee80211_sta_start_scan(dev, NULL, 0); ieee80211_sta_start_scan(dev, NULL, 0);
else else
ieee80211_sta_start_scan(dev, ifsta->ssid, ieee80211_sta_start_scan(dev, ifsta->ssid,
@ -2480,10 +2487,10 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
if (time_after(jiffies, ifsta->ibss_join_req + if (time_after(jiffies, ifsta->ibss_join_req +
IEEE80211_IBSS_JOIN_TIMEOUT)) { IEEE80211_IBSS_JOIN_TIMEOUT)) {
if (ifsta->create_ibss && if ((ifsta->flags & IEEE80211_STA_CREATE_IBSS) &&
local->oper_channel->flag & IEEE80211_CHAN_W_IBSS) local->oper_channel->flag & IEEE80211_CHAN_W_IBSS)
return ieee80211_sta_create_ibss(dev, ifsta); return ieee80211_sta_create_ibss(dev, ifsta);
if (ifsta->create_ibss) { if (ifsta->flags & IEEE80211_STA_CREATE_IBSS) {
printk(KERN_DEBUG "%s: IBSS not allowed on the" printk(KERN_DEBUG "%s: IBSS not allowed on the"
" configured channel %d (%d MHz)\n", " configured channel %d (%d MHz)\n",
dev->name, local->hw.conf.channel, dev->name, local->hw.conf.channel,
@ -2544,13 +2551,17 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len)
ifsta = &sdata->u.sta; ifsta = &sdata->u.sta;
if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0) if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0)
ifsta->prev_bssid_set = 0; ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
memcpy(ifsta->ssid, ssid, len); memcpy(ifsta->ssid, ssid, len);
memset(ifsta->ssid + len, 0, IEEE80211_MAX_SSID_LEN - len); memset(ifsta->ssid + len, 0, IEEE80211_MAX_SSID_LEN - len);
ifsta->ssid_len = len; ifsta->ssid_len = len;
ifsta->ssid_set = len ? 1 : 0; if (len)
if (sdata->type == IEEE80211_IF_TYPE_IBSS && !ifsta->bssid_set) { ifsta->flags |= IEEE80211_STA_SSID_SET;
else
ifsta->flags &= ~IEEE80211_STA_SSID_SET;
if (sdata->type == IEEE80211_IF_TYPE_IBSS &&
!(ifsta->flags & IEEE80211_STA_BSSID_SET)) {
ifsta->ibss_join_req = jiffies; ifsta->ibss_join_req = jiffies;
ifsta->state = IEEE80211_IBSS_SEARCH; ifsta->state = IEEE80211_IBSS_SEARCH;
return ieee80211_sta_find_ibss(dev, ifsta); return ieee80211_sta_find_ibss(dev, ifsta);
@ -2588,10 +2599,11 @@ int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid)
} }
} }
if (!is_valid_ether_addr(bssid)) if (is_valid_ether_addr(bssid))
ifsta->bssid_set = 0; ifsta->flags |= IEEE80211_STA_BSSID_SET;
else else
ifsta->bssid_set = 1; ifsta->flags &= ~IEEE80211_STA_BSSID_SET;
return 0; return 0;
} }
@ -2658,7 +2670,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
continue; continue;
if (sdata->type == IEEE80211_IF_TYPE_STA) { if (sdata->type == IEEE80211_IF_TYPE_STA) {
if (sdata->u.sta.associated) if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED)
ieee80211_send_nullfunc(local, sdata, 0); ieee80211_send_nullfunc(local, sdata, 0);
ieee80211_sta_timer((unsigned long)sdata); ieee80211_sta_timer((unsigned long)sdata);
} }
@ -2670,7 +2682,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
sdata = IEEE80211_DEV_TO_SUB_IF(dev); sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->type == IEEE80211_IF_TYPE_IBSS) { if (sdata->type == IEEE80211_IF_TYPE_IBSS) {
struct ieee80211_if_sta *ifsta = &sdata->u.sta; struct ieee80211_if_sta *ifsta = &sdata->u.sta;
if (!ifsta->bssid_set || if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) ||
(!ifsta->state == IEEE80211_IBSS_JOINED && (!ifsta->state == IEEE80211_IBSS_JOINED &&
!ieee80211_sta_active_ibss(dev))) !ieee80211_sta_active_ibss(dev)))
ieee80211_sta_find_ibss(dev, ifsta); ieee80211_sta_find_ibss(dev, ifsta);
@ -2812,7 +2824,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev,
netif_stop_queue(sdata->dev); netif_stop_queue(sdata->dev);
if (sdata->type == IEEE80211_IF_TYPE_STA && if (sdata->type == IEEE80211_IF_TYPE_STA &&
sdata->u.sta.associated) (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED))
ieee80211_send_nullfunc(local, sdata, 1); ieee80211_send_nullfunc(local, sdata, 1);
} }
read_unlock(&local->sub_if_lock); read_unlock(&local->sub_if_lock);
@ -3125,7 +3137,7 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason)
if (sdata->type != IEEE80211_IF_TYPE_STA) if (sdata->type != IEEE80211_IF_TYPE_STA)
return -EINVAL; return -EINVAL;
if (!ifsta->associated) if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED))
return -1; return -1;
ieee80211_send_disassoc(dev, ifsta, reason); ieee80211_send_disassoc(dev, ifsta, reason);