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/ieee80211_sta.c | |
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/ieee80211_sta.c')
-rw-r--r-- | net/mac80211/ieee80211_sta.c | 102 |
1 files changed, 57 insertions, 45 deletions
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); |