diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2007-08-28 17:01:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:50 -0400 |
commit | d6f2da5b33911a31eb61e1790ef8e555e9605837 (patch) | |
tree | 14dbd81d232b3d942fc093e24a7a70193f613f3e /net/mac80211 | |
parent | badffb725c86cc2d46f7cb3f520f58f1c863b56c (diff) |
[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>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 14 | ||||
-rw-r--r-- | net/mac80211/ieee80211.c | 2 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 26 | ||||
-rw-r--r-- | net/mac80211/ieee80211_iface.c | 8 | ||||
-rw-r--r-- | net/mac80211/ieee80211_ioctl.c | 57 | ||||
-rw-r--r-- | net/mac80211/ieee80211_sta.c | 102 |
6 files changed, 121 insertions, 88 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 095be91829ca..099dac95b09b 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -112,13 +112,13 @@ static ssize_t ieee80211_if_fmt_flags( | |||
112 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) | 112 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) |
113 | { | 113 | { |
114 | return scnprintf(buf, buflen, "%s%s%s%s%s%s%s\n", | 114 | return scnprintf(buf, buflen, "%s%s%s%s%s%s%s\n", |
115 | sdata->u.sta.ssid_set ? "SSID\n" : "", | 115 | sdata->u.sta.flags & IEEE80211_STA_SSID_SET ? "SSID\n" : "", |
116 | sdata->u.sta.bssid_set ? "BSSID\n" : "", | 116 | sdata->u.sta.flags & IEEE80211_STA_BSSID_SET ? "BSSID\n" : "", |
117 | sdata->u.sta.prev_bssid_set ? "prev BSSID\n" : "", | 117 | sdata->u.sta.flags & IEEE80211_STA_PREV_BSSID_SET ? "prev BSSID\n" : "", |
118 | sdata->u.sta.authenticated ? "AUTH\n" : "", | 118 | sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", |
119 | sdata->u.sta.associated ? "ASSOC\n" : "", | 119 | sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", |
120 | sdata->u.sta.probereq_poll ? "PROBEREQ POLL\n" : "", | 120 | sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "", |
121 | sdata->use_protection ? "CTS prot\n" : ""); | 121 | sdata->use_protection ? "CTS prot\n" : ""); |
122 | } | 122 | } |
123 | __IEEE80211_IF_FILE(flags); | 123 | __IEEE80211_IF_FILE(flags); |
124 | 124 | ||
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 289b33ce45cf..be678c61afa5 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -354,7 +354,7 @@ static void ieee80211_if_open(struct net_device *dev) | |||
354 | switch (sdata->type) { | 354 | switch (sdata->type) { |
355 | case IEEE80211_IF_TYPE_STA: | 355 | case IEEE80211_IF_TYPE_STA: |
356 | case IEEE80211_IF_TYPE_IBSS: | 356 | case IEEE80211_IF_TYPE_IBSS: |
357 | sdata->u.sta.prev_bssid_set = 0; | 357 | sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; |
358 | break; | 358 | break; |
359 | } | 359 | } |
360 | } | 360 | } |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 9888611660b7..28c5d514e6d5 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -217,6 +217,19 @@ struct ieee80211_if_vlan { | |||
217 | u8 id; | 217 | u8 id; |
218 | }; | 218 | }; |
219 | 219 | ||
220 | /* flags used in struct ieee80211_if_sta.flags */ | ||
221 | #define IEEE80211_STA_SSID_SET BIT(0) | ||
222 | #define IEEE80211_STA_BSSID_SET BIT(1) | ||
223 | #define IEEE80211_STA_PREV_BSSID_SET BIT(2) | ||
224 | #define IEEE80211_STA_AUTHENTICATED BIT(3) | ||
225 | #define IEEE80211_STA_ASSOCIATED BIT(4) | ||
226 | #define IEEE80211_STA_PROBEREQ_POLL BIT(5) | ||
227 | #define IEEE80211_STA_CREATE_IBSS BIT(6) | ||
228 | #define IEEE80211_STA_MIXED_CELL BIT(7) | ||
229 | #define IEEE80211_STA_WMM_ENABLED BIT(8) | ||
230 | #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) | ||
231 | #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) | ||
232 | #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) | ||
220 | struct ieee80211_if_sta { | 233 | struct ieee80211_if_sta { |
221 | enum { | 234 | enum { |
222 | IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, | 235 | IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, |
@@ -239,18 +252,7 @@ struct ieee80211_if_sta { | |||
239 | 252 | ||
240 | int auth_tries, assoc_tries; | 253 | int auth_tries, assoc_tries; |
241 | 254 | ||
242 | unsigned int ssid_set:1; | 255 | unsigned int flags; |
243 | unsigned int bssid_set:1; | ||
244 | unsigned int prev_bssid_set:1; | ||
245 | unsigned int authenticated:1; | ||
246 | unsigned int associated:1; | ||
247 | unsigned int probereq_poll:1; | ||
248 | unsigned int create_ibss:1; | ||
249 | unsigned int mixed_cell:1; | ||
250 | unsigned int wmm_enabled:1; | ||
251 | unsigned int auto_ssid_sel:1; | ||
252 | unsigned int auto_bssid_sel:1; | ||
253 | unsigned int auto_channel_sel:1; | ||
254 | #define IEEE80211_STA_REQ_SCAN 0 | 256 | #define IEEE80211_STA_REQ_SCAN 0 |
255 | #define IEEE80211_STA_REQ_AUTH 1 | 257 | #define IEEE80211_STA_REQ_AUTH 1 |
256 | #define IEEE80211_STA_REQ_RUN 2 | 258 | #define IEEE80211_STA_REQ_RUN 2 |
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c index 6db67767801d..61009176d51b 100644 --- a/net/mac80211/ieee80211_iface.c +++ b/net/mac80211/ieee80211_iface.c | |||
@@ -187,10 +187,10 @@ void ieee80211_if_set_type(struct net_device *dev, int type) | |||
187 | ifsta->capab = WLAN_CAPABILITY_ESS; | 187 | ifsta->capab = WLAN_CAPABILITY_ESS; |
188 | ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN | | 188 | ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN | |
189 | IEEE80211_AUTH_ALG_SHARED_KEY; | 189 | IEEE80211_AUTH_ALG_SHARED_KEY; |
190 | ifsta->create_ibss = 1; | 190 | ifsta->flags |= IEEE80211_STA_CREATE_IBSS | |
191 | ifsta->wmm_enabled = 1; | 191 | IEEE80211_STA_WMM_ENABLED | |
192 | ifsta->auto_channel_sel = 1; | 192 | IEEE80211_STA_AUTO_BSSID_SEL | |
193 | ifsta->auto_bssid_sel = 1; | 193 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
194 | 194 | ||
195 | msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev); | 195 | msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev); |
196 | sdata->bss = &msdata->u.ap; | 196 | sdata->bss = &msdata->u.ap; |
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c index 643c8855801c..ea2e0f958ac3 100644 --- a/net/mac80211/ieee80211_ioctl.c +++ b/net/mac80211/ieee80211_ioctl.c | |||
@@ -270,7 +270,7 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev, | |||
270 | int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length); | 270 | int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length); |
271 | if (ret) | 271 | if (ret) |
272 | return ret; | 272 | return ret; |
273 | sdata->u.sta.auto_bssid_sel = 0; | 273 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
274 | ieee80211_sta_req_auth(dev, &sdata->u.sta); | 274 | ieee80211_sta_req_auth(dev, &sdata->u.sta); |
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |
@@ -502,13 +502,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
502 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 502 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
503 | 503 | ||
504 | if (sdata->type == IEEE80211_IF_TYPE_STA) | 504 | if (sdata->type == IEEE80211_IF_TYPE_STA) |
505 | sdata->u.sta.auto_channel_sel = 0; | 505 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; |
506 | 506 | ||
507 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ | 507 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ |
508 | if (freq->e == 0) { | 508 | if (freq->e == 0) { |
509 | if (freq->m < 0) { | 509 | if (freq->m < 0) { |
510 | if (sdata->type == IEEE80211_IF_TYPE_STA) | 510 | if (sdata->type == IEEE80211_IF_TYPE_STA) |
511 | sdata->u.sta.auto_channel_sel = 1; | 511 | sdata->u.sta.flags |= |
512 | IEEE80211_STA_AUTO_CHANNEL_SEL; | ||
512 | return 0; | 513 | return 0; |
513 | } else | 514 | } else |
514 | return ieee80211_set_channel(local, freq->m, -1); | 515 | return ieee80211_set_channel(local, freq->m, -1); |
@@ -563,7 +564,10 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
563 | sdata->u.sta.ssid_len = len; | 564 | sdata->u.sta.ssid_len = len; |
564 | return 0; | 565 | return 0; |
565 | } | 566 | } |
566 | sdata->u.sta.auto_ssid_sel = !data->flags; | 567 | if (data->flags) |
568 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; | ||
569 | else | ||
570 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL; | ||
567 | ret = ieee80211_sta_set_ssid(dev, ssid, len); | 571 | ret = ieee80211_sta_set_ssid(dev, ssid, len); |
568 | if (ret) | 572 | if (ret) |
569 | return ret; | 573 | return ret; |
@@ -630,13 +634,13 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, | |||
630 | ETH_ALEN); | 634 | ETH_ALEN); |
631 | return 0; | 635 | return 0; |
632 | } | 636 | } |
633 | if (is_zero_ether_addr((u8 *) &ap_addr->sa_data)) { | 637 | if (is_zero_ether_addr((u8 *) &ap_addr->sa_data)) |
634 | sdata->u.sta.auto_bssid_sel = 1; | 638 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL | |
635 | sdata->u.sta.auto_channel_sel = 1; | 639 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
636 | } else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data)) | 640 | else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data)) |
637 | sdata->u.sta.auto_bssid_sel = 1; | 641 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL; |
638 | else | 642 | else |
639 | sdata->u.sta.auto_bssid_sel = 0; | 643 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
640 | ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data); | 644 | ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data); |
641 | if (ret) | 645 | if (ret) |
642 | return ret; | 646 | return ret; |
@@ -1104,8 +1108,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev, | |||
1104 | if (sdata->type != IEEE80211_IF_TYPE_STA && | 1108 | if (sdata->type != IEEE80211_IF_TYPE_STA && |
1105 | sdata->type != IEEE80211_IF_TYPE_IBSS) | 1109 | sdata->type != IEEE80211_IF_TYPE_IBSS) |
1106 | ret = -EINVAL; | 1110 | ret = -EINVAL; |
1107 | else | 1111 | else { |
1108 | sdata->u.sta.mixed_cell = !!value; | 1112 | if (value) |
1113 | sdata->u.sta.flags |= IEEE80211_STA_MIXED_CELL; | ||
1114 | else | ||
1115 | sdata->u.sta.flags &= ~IEEE80211_STA_MIXED_CELL; | ||
1116 | } | ||
1109 | break; | 1117 | break; |
1110 | 1118 | ||
1111 | case PRISM2_PARAM_HW_MODES: | 1119 | case PRISM2_PARAM_HW_MODES: |
@@ -1115,15 +1123,23 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev, | |||
1115 | case PRISM2_PARAM_CREATE_IBSS: | 1123 | case PRISM2_PARAM_CREATE_IBSS: |
1116 | if (sdata->type != IEEE80211_IF_TYPE_IBSS) | 1124 | if (sdata->type != IEEE80211_IF_TYPE_IBSS) |
1117 | ret = -EINVAL; | 1125 | ret = -EINVAL; |
1118 | else | 1126 | else { |
1119 | sdata->u.sta.create_ibss = !!value; | 1127 | if (value) |
1128 | sdata->u.sta.flags |= IEEE80211_STA_CREATE_IBSS; | ||
1129 | else | ||
1130 | sdata->u.sta.flags &= ~IEEE80211_STA_CREATE_IBSS; | ||
1131 | } | ||
1120 | break; | 1132 | break; |
1121 | case PRISM2_PARAM_WMM_ENABLED: | 1133 | case PRISM2_PARAM_WMM_ENABLED: |
1122 | if (sdata->type != IEEE80211_IF_TYPE_STA && | 1134 | if (sdata->type != IEEE80211_IF_TYPE_STA && |
1123 | sdata->type != IEEE80211_IF_TYPE_IBSS) | 1135 | sdata->type != IEEE80211_IF_TYPE_IBSS) |
1124 | ret = -EINVAL; | 1136 | ret = -EINVAL; |
1125 | else | 1137 | else { |
1126 | sdata->u.sta.wmm_enabled = !!value; | 1138 | if (value) |
1139 | sdata->u.sta.flags |= IEEE80211_STA_WMM_ENABLED; | ||
1140 | else | ||
1141 | sdata->u.sta.flags &= ~IEEE80211_STA_WMM_ENABLED; | ||
1142 | } | ||
1127 | break; | 1143 | break; |
1128 | default: | 1144 | default: |
1129 | ret = -EOPNOTSUPP; | 1145 | ret = -EOPNOTSUPP; |
@@ -1186,7 +1202,8 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev, | |||
1186 | if (sdata->type != IEEE80211_IF_TYPE_IBSS) | 1202 | if (sdata->type != IEEE80211_IF_TYPE_IBSS) |
1187 | ret = -EINVAL; | 1203 | ret = -EINVAL; |
1188 | else | 1204 | else |
1189 | *param = !!sdata->u.sta.create_ibss; | 1205 | *param = !!(sdata->u.sta.flags & |
1206 | IEEE80211_STA_CREATE_IBSS); | ||
1190 | break; | 1207 | break; |
1191 | 1208 | ||
1192 | case PRISM2_PARAM_MIXED_CELL: | 1209 | case PRISM2_PARAM_MIXED_CELL: |
@@ -1194,14 +1211,16 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev, | |||
1194 | sdata->type != IEEE80211_IF_TYPE_IBSS) | 1211 | sdata->type != IEEE80211_IF_TYPE_IBSS) |
1195 | ret = -EINVAL; | 1212 | ret = -EINVAL; |
1196 | else | 1213 | else |
1197 | *param = !!sdata->u.sta.mixed_cell; | 1214 | *param = !!(sdata->u.sta.flags & |
1215 | IEEE80211_STA_MIXED_CELL); | ||
1198 | break; | 1216 | break; |
1199 | case PRISM2_PARAM_WMM_ENABLED: | 1217 | case PRISM2_PARAM_WMM_ENABLED: |
1200 | if (sdata->type != IEEE80211_IF_TYPE_STA && | 1218 | if (sdata->type != IEEE80211_IF_TYPE_STA && |
1201 | sdata->type != IEEE80211_IF_TYPE_IBSS) | 1219 | sdata->type != IEEE80211_IF_TYPE_IBSS) |
1202 | ret = -EINVAL; | 1220 | ret = -EINVAL; |
1203 | else | 1221 | else |
1204 | *param = !!sdata->u.sta.wmm_enabled; | 1222 | *param = !!(sdata->u.sta.flags & |
1223 | IEEE80211_STA_WMM_ENABLED); | ||
1205 | break; | 1224 | break; |
1206 | default: | 1225 | default: |
1207 | ret = -EOPNOTSUPP; | 1226 | ret = -EOPNOTSUPP; |
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index 3757298c5a60..6a57333dc75c 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
@@ -403,18 +403,20 @@ static void ieee80211_sta_send_associnfo(struct net_device *dev, | |||
403 | 403 | ||
404 | 404 | ||
405 | static void ieee80211_set_associated(struct net_device *dev, | 405 | static void ieee80211_set_associated(struct net_device *dev, |
406 | struct ieee80211_if_sta *ifsta, int assoc) | 406 | struct ieee80211_if_sta *ifsta, |
407 | unsigned int assoc) | ||
407 | { | 408 | { |
408 | union iwreq_data wrqu; | 409 | union iwreq_data wrqu; |
409 | 410 | ||
410 | if (ifsta->associated == assoc) | 411 | if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc) |
411 | return; | 412 | return; |
412 | 413 | ||
413 | ifsta->associated = assoc; | ||
414 | |||
415 | if (assoc) { | 414 | if (assoc) { |
416 | struct ieee80211_sub_if_data *sdata; | 415 | struct ieee80211_sub_if_data *sdata; |
417 | struct ieee80211_sta_bss *bss; | 416 | struct ieee80211_sta_bss *bss; |
417 | |||
418 | ifsta->flags |= IEEE80211_STA_ASSOCIATED; | ||
419 | |||
418 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 420 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
419 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 421 | if (sdata->type != IEEE80211_IF_TYPE_STA) |
420 | return; | 422 | return; |
@@ -427,11 +429,13 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
427 | } | 429 | } |
428 | 430 | ||
429 | netif_carrier_on(dev); | 431 | netif_carrier_on(dev); |
430 | ifsta->prev_bssid_set = 1; | 432 | ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; |
431 | memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); | 433 | memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); |
432 | memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); | 434 | memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); |
433 | ieee80211_sta_send_associnfo(dev, ifsta); | 435 | ieee80211_sta_send_associnfo(dev, ifsta); |
434 | } else { | 436 | } else { |
437 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; | ||
438 | |||
435 | netif_carrier_off(dev); | 439 | netif_carrier_off(dev); |
436 | ieee80211_reset_erp_info(dev); | 440 | ieee80211_reset_erp_info(dev); |
437 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); | 441 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); |
@@ -579,7 +583,7 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
579 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 583 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); |
580 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 584 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
581 | 585 | ||
582 | if (ifsta->prev_bssid_set) { | 586 | if (ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) { |
583 | skb_put(skb, 10); | 587 | skb_put(skb, 10); |
584 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 588 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, |
585 | IEEE80211_STYPE_REASSOC_REQ); | 589 | IEEE80211_STYPE_REASSOC_REQ); |
@@ -631,7 +635,7 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
631 | memcpy(pos, ifsta->extra_ie, ifsta->extra_ie_len); | 635 | memcpy(pos, ifsta->extra_ie, ifsta->extra_ie_len); |
632 | } | 636 | } |
633 | 637 | ||
634 | if (wmm && ifsta->wmm_enabled) { | 638 | if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { |
635 | pos = skb_put(skb, 9); | 639 | pos = skb_put(skb, 9); |
636 | *pos++ = WLAN_EID_VENDOR_SPECIFIC; | 640 | *pos++ = WLAN_EID_VENDOR_SPECIFIC; |
637 | *pos++ = 7; /* len */ | 641 | *pos++ = 7; /* len */ |
@@ -718,7 +722,8 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
718 | struct ieee80211_sta_bss *bss; | 722 | struct ieee80211_sta_bss *bss; |
719 | int res = 0; | 723 | int res = 0; |
720 | 724 | ||
721 | if (!ifsta || ifsta->mixed_cell || ifsta->key_management_enabled) | 725 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) || |
726 | ifsta->key_management_enabled) | ||
722 | return 0; | 727 | return 0; |
723 | 728 | ||
724 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid); | 729 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid); |
@@ -786,22 +791,20 @@ static void ieee80211_associated(struct net_device *dev, | |||
786 | disassoc = 0; | 791 | disassoc = 0; |
787 | if (time_after(jiffies, | 792 | if (time_after(jiffies, |
788 | sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { | 793 | sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { |
789 | if (ifsta->probereq_poll) { | 794 | if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) { |
790 | printk(KERN_DEBUG "%s: No ProbeResp from " | 795 | printk(KERN_DEBUG "%s: No ProbeResp from " |
791 | "current AP " MAC_FMT " - assume out of " | 796 | "current AP " MAC_FMT " - assume out of " |
792 | "range\n", | 797 | "range\n", |
793 | dev->name, MAC_ARG(ifsta->bssid)); | 798 | dev->name, MAC_ARG(ifsta->bssid)); |
794 | disassoc = 1; | 799 | disassoc = 1; |
795 | sta_info_free(sta); | 800 | sta_info_free(sta); |
796 | ifsta->probereq_poll = 0; | 801 | } else |
797 | } else { | ||
798 | ieee80211_send_probe_req(dev, ifsta->bssid, | 802 | ieee80211_send_probe_req(dev, ifsta->bssid, |
799 | local->scan_ssid, | 803 | local->scan_ssid, |
800 | local->scan_ssid_len); | 804 | local->scan_ssid_len); |
801 | ifsta->probereq_poll = 1; | 805 | ifsta->flags ^= IEEE80211_STA_PROBEREQ_POLL; |
802 | } | ||
803 | } else { | 806 | } else { |
804 | ifsta->probereq_poll = 0; | 807 | ifsta->flags &= ~IEEE80211_STA_PROBEREQ_POLL; |
805 | if (time_after(jiffies, ifsta->last_probe + | 808 | if (time_after(jiffies, ifsta->last_probe + |
806 | IEEE80211_PROBE_INTERVAL)) { | 809 | IEEE80211_PROBE_INTERVAL)) { |
807 | ifsta->last_probe = jiffies; | 810 | ifsta->last_probe = jiffies; |
@@ -905,7 +908,7 @@ static void ieee80211_auth_completed(struct net_device *dev, | |||
905 | struct ieee80211_if_sta *ifsta) | 908 | struct ieee80211_if_sta *ifsta) |
906 | { | 909 | { |
907 | printk(KERN_DEBUG "%s: authenticated\n", dev->name); | 910 | printk(KERN_DEBUG "%s: authenticated\n", dev->name); |
908 | ifsta->authenticated = 1; | 911 | ifsta->flags |= IEEE80211_STA_AUTHENTICATED; |
909 | ieee80211_associate(dev, ifsta); | 912 | ieee80211_associate(dev, ifsta); |
910 | } | 913 | } |
911 | 914 | ||
@@ -1092,7 +1095,7 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev, | |||
1092 | " (reason=%d)\n", | 1095 | " (reason=%d)\n", |
1093 | dev->name, MAC_ARG(mgmt->sa), reason_code); | 1096 | dev->name, MAC_ARG(mgmt->sa), reason_code); |
1094 | 1097 | ||
1095 | if (ifsta->authenticated) { | 1098 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) { |
1096 | printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); | 1099 | printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); |
1097 | } | 1100 | } |
1098 | 1101 | ||
@@ -1105,7 +1108,7 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev, | |||
1105 | } | 1108 | } |
1106 | 1109 | ||
1107 | ieee80211_set_disassoc(dev, ifsta, 1); | 1110 | ieee80211_set_disassoc(dev, ifsta, 1); |
1108 | ifsta->authenticated = 0; | 1111 | ifsta->flags &= ~IEEE80211_STA_AUTHENTICATED; |
1109 | } | 1112 | } |
1110 | 1113 | ||
1111 | 1114 | ||
@@ -1137,7 +1140,7 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev, | |||
1137 | " (reason=%d)\n", | 1140 | " (reason=%d)\n", |
1138 | dev->name, MAC_ARG(mgmt->sa), reason_code); | 1141 | dev->name, MAC_ARG(mgmt->sa), reason_code); |
1139 | 1142 | ||
1140 | if (ifsta->associated) | 1143 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) |
1141 | printk(KERN_DEBUG "%s: disassociated\n", dev->name); | 1144 | printk(KERN_DEBUG "%s: disassociated\n", dev->name); |
1142 | 1145 | ||
1143 | if (ifsta->state == IEEE80211_ASSOCIATED) { | 1146 | if (ifsta->state == IEEE80211_ASSOCIATED) { |
@@ -1209,7 +1212,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, | |||
1209 | /* if this was a reassociation, ensure we try a "full" | 1212 | /* if this was a reassociation, ensure we try a "full" |
1210 | * association next time. This works around some broken APs | 1213 | * association next time. This works around some broken APs |
1211 | * which do not correctly reject reassociation requests. */ | 1214 | * which do not correctly reject reassociation requests. */ |
1212 | ifsta->prev_bssid_set = 0; | 1215 | ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET; |
1213 | return; | 1216 | return; |
1214 | } | 1217 | } |
1215 | 1218 | ||
@@ -1296,7 +1299,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, | |||
1296 | 1299 | ||
1297 | rate_control_rate_init(sta, local); | 1300 | rate_control_rate_init(sta, local); |
1298 | 1301 | ||
1299 | if (elems.wmm_param && ifsta->wmm_enabled) { | 1302 | if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { |
1300 | sta->flags |= WLAN_STA_WME; | 1303 | sta->flags |= WLAN_STA_WME; |
1301 | ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, | 1304 | ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, |
1302 | elems.wmm_param_len); | 1305 | elems.wmm_param_len); |
@@ -1693,7 +1696,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
1693 | return; | 1696 | return; |
1694 | ifsta = &sdata->u.sta; | 1697 | ifsta = &sdata->u.sta; |
1695 | 1698 | ||
1696 | if (!ifsta->associated || | 1699 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED) || |
1697 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) | 1700 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) |
1698 | return; | 1701 | return; |
1699 | 1702 | ||
@@ -1709,7 +1712,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
1709 | if (elems.erp_info && elems.erp_info_len >= 1) | 1712 | if (elems.erp_info && elems.erp_info_len >= 1) |
1710 | ieee80211_handle_erp_ie(dev, elems.erp_info[0]); | 1713 | ieee80211_handle_erp_ie(dev, elems.erp_info[0]); |
1711 | 1714 | ||
1712 | if (elems.wmm_param && ifsta->wmm_enabled) { | 1715 | if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { |
1713 | ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, | 1716 | ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, |
1714 | elems.wmm_param_len); | 1717 | elems.wmm_param_len); |
1715 | } | 1718 | } |
@@ -2076,7 +2079,8 @@ static void ieee80211_sta_reset_auth(struct net_device *dev, | |||
2076 | printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name, | 2079 | printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name, |
2077 | ifsta->auth_alg); | 2080 | ifsta->auth_alg); |
2078 | ifsta->auth_transaction = -1; | 2081 | ifsta->auth_transaction = -1; |
2079 | ifsta->associated = ifsta->auth_tries = ifsta->assoc_tries = 0; | 2082 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; |
2083 | ifsta->auth_tries = ifsta->assoc_tries = 0; | ||
2080 | netif_carrier_off(dev); | 2084 | netif_carrier_off(dev); |
2081 | } | 2085 | } |
2082 | 2086 | ||
@@ -2090,8 +2094,10 @@ void ieee80211_sta_req_auth(struct net_device *dev, | |||
2090 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 2094 | if (sdata->type != IEEE80211_IF_TYPE_STA) |
2091 | return; | 2095 | return; |
2092 | 2096 | ||
2093 | if ((ifsta->bssid_set || ifsta->auto_bssid_sel) && | 2097 | if ((ifsta->flags & (IEEE80211_STA_BSSID_SET | |
2094 | (ifsta->ssid_set || ifsta->auto_ssid_sel)) { | 2098 | IEEE80211_STA_AUTO_BSSID_SEL)) && |
2099 | (ifsta->flags & (IEEE80211_STA_SSID_SET | | ||
2100 | IEEE80211_STA_AUTO_SSID_SEL))) { | ||
2095 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); | 2101 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); |
2096 | queue_work(local->hw.workqueue, &ifsta->work); | 2102 | queue_work(local->hw.workqueue, &ifsta->work); |
2097 | } | 2103 | } |
@@ -2105,7 +2111,7 @@ static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta, | |||
2105 | if (!memcmp(ifsta->ssid, ssid, ssid_len)) | 2111 | if (!memcmp(ifsta->ssid, ssid, ssid_len)) |
2106 | return 1; | 2112 | return 1; |
2107 | 2113 | ||
2108 | if (ifsta->auto_bssid_sel) | 2114 | if (ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL) |
2109 | return 0; | 2115 | return 0; |
2110 | 2116 | ||
2111 | hidden_ssid = 1; | 2117 | hidden_ssid = 1; |
@@ -2134,8 +2140,8 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
2134 | struct ieee80211_sta_bss *bss, *selected = NULL; | 2140 | struct ieee80211_sta_bss *bss, *selected = NULL; |
2135 | int top_rssi = 0, freq; | 2141 | int top_rssi = 0, freq; |
2136 | 2142 | ||
2137 | if (!ifsta->auto_channel_sel && !ifsta->auto_bssid_sel && | 2143 | if (!(ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL | |
2138 | !ifsta->auto_ssid_sel) { | 2144 | IEEE80211_STA_AUTO_BSSID_SEL | IEEE80211_STA_AUTO_CHANNEL_SEL))) { |
2139 | ifsta->state = IEEE80211_AUTHENTICATE; | 2145 | ifsta->state = IEEE80211_AUTHENTICATE; |
2140 | ieee80211_sta_reset_auth(dev, ifsta); | 2146 | ieee80211_sta_reset_auth(dev, ifsta); |
2141 | return 0; | 2147 | return 0; |
@@ -2151,14 +2157,15 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
2151 | !!sdata->default_key) | 2157 | !!sdata->default_key) |
2152 | continue; | 2158 | continue; |
2153 | 2159 | ||
2154 | if (!ifsta->auto_channel_sel && bss->freq != freq) | 2160 | if (!(ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) && |
2161 | bss->freq != freq) | ||
2155 | continue; | 2162 | continue; |
2156 | 2163 | ||
2157 | if (!ifsta->auto_bssid_sel && | 2164 | if (!(ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL) && |
2158 | memcmp(bss->bssid, ifsta->bssid, ETH_ALEN)) | 2165 | memcmp(bss->bssid, ifsta->bssid, ETH_ALEN)) |
2159 | continue; | 2166 | continue; |
2160 | 2167 | ||
2161 | if (!ifsta->auto_ssid_sel && | 2168 | if (!(ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) && |
2162 | !ieee80211_sta_match_ssid(ifsta, bss->ssid, bss->ssid_len)) | 2169 | !ieee80211_sta_match_ssid(ifsta, bss->ssid, bss->ssid_len)) |
2163 | continue; | 2170 | continue; |
2164 | 2171 | ||
@@ -2173,7 +2180,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
2173 | 2180 | ||
2174 | if (selected) { | 2181 | if (selected) { |
2175 | ieee80211_set_channel(local, -1, selected->freq); | 2182 | ieee80211_set_channel(local, -1, selected->freq); |
2176 | if (!ifsta->ssid_set) | 2183 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) |
2177 | ieee80211_sta_set_ssid(dev, selected->ssid, | 2184 | ieee80211_sta_set_ssid(dev, selected->ssid, |
2178 | selected->ssid_len); | 2185 | selected->ssid_len); |
2179 | ieee80211_sta_set_bssid(dev, selected->bssid); | 2186 | ieee80211_sta_set_bssid(dev, selected->bssid); |
@@ -2183,7 +2190,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
2183 | return 0; | 2190 | return 0; |
2184 | } else { | 2191 | } else { |
2185 | if (ifsta->state != IEEE80211_AUTHENTICATE) { | 2192 | if (ifsta->state != IEEE80211_AUTHENTICATE) { |
2186 | if (ifsta->auto_ssid_sel) | 2193 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) |
2187 | ieee80211_sta_start_scan(dev, NULL, 0); | 2194 | ieee80211_sta_start_scan(dev, NULL, 0); |
2188 | else | 2195 | else |
2189 | ieee80211_sta_start_scan(dev, ifsta->ssid, | 2196 | ieee80211_sta_start_scan(dev, ifsta->ssid, |
@@ -2480,10 +2487,10 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
2480 | 2487 | ||
2481 | if (time_after(jiffies, ifsta->ibss_join_req + | 2488 | if (time_after(jiffies, ifsta->ibss_join_req + |
2482 | IEEE80211_IBSS_JOIN_TIMEOUT)) { | 2489 | IEEE80211_IBSS_JOIN_TIMEOUT)) { |
2483 | if (ifsta->create_ibss && | 2490 | if ((ifsta->flags & IEEE80211_STA_CREATE_IBSS) && |
2484 | local->oper_channel->flag & IEEE80211_CHAN_W_IBSS) | 2491 | local->oper_channel->flag & IEEE80211_CHAN_W_IBSS) |
2485 | return ieee80211_sta_create_ibss(dev, ifsta); | 2492 | return ieee80211_sta_create_ibss(dev, ifsta); |
2486 | if (ifsta->create_ibss) { | 2493 | if (ifsta->flags & IEEE80211_STA_CREATE_IBSS) { |
2487 | printk(KERN_DEBUG "%s: IBSS not allowed on the" | 2494 | printk(KERN_DEBUG "%s: IBSS not allowed on the" |
2488 | " configured channel %d (%d MHz)\n", | 2495 | " configured channel %d (%d MHz)\n", |
2489 | dev->name, local->hw.conf.channel, | 2496 | dev->name, local->hw.conf.channel, |
@@ -2544,13 +2551,17 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | |||
2544 | ifsta = &sdata->u.sta; | 2551 | ifsta = &sdata->u.sta; |
2545 | 2552 | ||
2546 | if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0) | 2553 | if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0) |
2547 | ifsta->prev_bssid_set = 0; | 2554 | ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET; |
2548 | memcpy(ifsta->ssid, ssid, len); | 2555 | memcpy(ifsta->ssid, ssid, len); |
2549 | memset(ifsta->ssid + len, 0, IEEE80211_MAX_SSID_LEN - len); | 2556 | memset(ifsta->ssid + len, 0, IEEE80211_MAX_SSID_LEN - len); |
2550 | ifsta->ssid_len = len; | 2557 | ifsta->ssid_len = len; |
2551 | 2558 | ||
2552 | ifsta->ssid_set = len ? 1 : 0; | 2559 | if (len) |
2553 | if (sdata->type == IEEE80211_IF_TYPE_IBSS && !ifsta->bssid_set) { | 2560 | ifsta->flags |= IEEE80211_STA_SSID_SET; |
2561 | else | ||
2562 | ifsta->flags &= ~IEEE80211_STA_SSID_SET; | ||
2563 | if (sdata->type == IEEE80211_IF_TYPE_IBSS && | ||
2564 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { | ||
2554 | ifsta->ibss_join_req = jiffies; | 2565 | ifsta->ibss_join_req = jiffies; |
2555 | ifsta->state = IEEE80211_IBSS_SEARCH; | 2566 | ifsta->state = IEEE80211_IBSS_SEARCH; |
2556 | return ieee80211_sta_find_ibss(dev, ifsta); | 2567 | return ieee80211_sta_find_ibss(dev, ifsta); |
@@ -2588,10 +2599,11 @@ int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid) | |||
2588 | } | 2599 | } |
2589 | } | 2600 | } |
2590 | 2601 | ||
2591 | if (!is_valid_ether_addr(bssid)) | 2602 | if (is_valid_ether_addr(bssid)) |
2592 | ifsta->bssid_set = 0; | 2603 | ifsta->flags |= IEEE80211_STA_BSSID_SET; |
2593 | else | 2604 | else |
2594 | ifsta->bssid_set = 1; | 2605 | ifsta->flags &= ~IEEE80211_STA_BSSID_SET; |
2606 | |||
2595 | return 0; | 2607 | return 0; |
2596 | } | 2608 | } |
2597 | 2609 | ||
@@ -2658,7 +2670,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw) | |||
2658 | continue; | 2670 | continue; |
2659 | 2671 | ||
2660 | if (sdata->type == IEEE80211_IF_TYPE_STA) { | 2672 | if (sdata->type == IEEE80211_IF_TYPE_STA) { |
2661 | if (sdata->u.sta.associated) | 2673 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) |
2662 | ieee80211_send_nullfunc(local, sdata, 0); | 2674 | ieee80211_send_nullfunc(local, sdata, 0); |
2663 | ieee80211_sta_timer((unsigned long)sdata); | 2675 | ieee80211_sta_timer((unsigned long)sdata); |
2664 | } | 2676 | } |
@@ -2670,7 +2682,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw) | |||
2670 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2682 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2671 | if (sdata->type == IEEE80211_IF_TYPE_IBSS) { | 2683 | if (sdata->type == IEEE80211_IF_TYPE_IBSS) { |
2672 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 2684 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
2673 | if (!ifsta->bssid_set || | 2685 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || |
2674 | (!ifsta->state == IEEE80211_IBSS_JOINED && | 2686 | (!ifsta->state == IEEE80211_IBSS_JOINED && |
2675 | !ieee80211_sta_active_ibss(dev))) | 2687 | !ieee80211_sta_active_ibss(dev))) |
2676 | ieee80211_sta_find_ibss(dev, ifsta); | 2688 | ieee80211_sta_find_ibss(dev, ifsta); |
@@ -2812,7 +2824,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
2812 | 2824 | ||
2813 | netif_stop_queue(sdata->dev); | 2825 | netif_stop_queue(sdata->dev); |
2814 | if (sdata->type == IEEE80211_IF_TYPE_STA && | 2826 | if (sdata->type == IEEE80211_IF_TYPE_STA && |
2815 | sdata->u.sta.associated) | 2827 | (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED)) |
2816 | ieee80211_send_nullfunc(local, sdata, 1); | 2828 | ieee80211_send_nullfunc(local, sdata, 1); |
2817 | } | 2829 | } |
2818 | read_unlock(&local->sub_if_lock); | 2830 | read_unlock(&local->sub_if_lock); |
@@ -3125,7 +3137,7 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason) | |||
3125 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 3137 | if (sdata->type != IEEE80211_IF_TYPE_STA) |
3126 | return -EINVAL; | 3138 | return -EINVAL; |
3127 | 3139 | ||
3128 | if (!ifsta->associated) | 3140 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) |
3129 | return -1; | 3141 | return -1; |
3130 | 3142 | ||
3131 | ieee80211_send_disassoc(dev, ifsta, reason); | 3143 | ieee80211_send_disassoc(dev, ifsta, reason); |