aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/ieee80211_i.h34
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/mlme.c72
-rw-r--r--net/mac80211/wext.c4
4 files changed, 61 insertions, 51 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index b5d3f58a7845..747814f319af 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -292,17 +292,33 @@ struct mesh_config {
292#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) 292#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)
293#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) 293#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
294#define IEEE80211_STA_PRIVACY_INVOKED BIT(13) 294#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
295/* flags for MLME request*/
296#define IEEE80211_STA_REQ_SCAN 0
297#define IEEE80211_STA_REQ_AUTH 1
298#define IEEE80211_STA_REQ_RUN 2
299
300/* flags used for setting mlme state */
301enum ieee80211_sta_mlme_state {
302 IEEE80211_STA_MLME_DISABLED,
303 IEEE80211_STA_MLME_AUTHENTICATE,
304 IEEE80211_STA_MLME_ASSOCIATE,
305 IEEE80211_STA_MLME_ASSOCIATED,
306 IEEE80211_STA_MLME_IBSS_SEARCH,
307 IEEE80211_STA_MLME_IBSS_JOINED,
308 IEEE80211_STA_MLME_MESH_UP
309};
310
311/* bitfield of allowed auth algs */
312#define IEEE80211_AUTH_ALG_OPEN BIT(0)
313#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
314#define IEEE80211_AUTH_ALG_LEAP BIT(2)
315
295struct ieee80211_if_sta { 316struct ieee80211_if_sta {
296 struct timer_list timer; 317 struct timer_list timer;
297 struct work_struct work; 318 struct work_struct work;
298 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 319 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
299 u8 ssid[IEEE80211_MAX_SSID_LEN]; 320 u8 ssid[IEEE80211_MAX_SSID_LEN];
300 enum { 321 enum ieee80211_sta_mlme_state state;
301 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
302 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
303 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED,
304 IEEE80211_MESH_UP
305 } state;
306 size_t ssid_len; 322 size_t ssid_len;
307 u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; 323 u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
308 size_t scan_ssid_len; 324 size_t scan_ssid_len;
@@ -352,13 +368,7 @@ struct ieee80211_if_sta {
352 unsigned long last_probe; 368 unsigned long last_probe;
353 369
354 unsigned int flags; 370 unsigned int flags;
355#define IEEE80211_STA_REQ_SCAN 0
356#define IEEE80211_STA_REQ_AUTH 1
357#define IEEE80211_STA_REQ_RUN 2
358 371
359#define IEEE80211_AUTH_ALG_OPEN BIT(0)
360#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
361#define IEEE80211_AUTH_ALG_LEAP BIT(2)
362 unsigned int auth_algs; /* bitfield of allowed auth algs */ 372 unsigned int auth_algs; /* bitfield of allowed auth algs */
363 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */ 373 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
364 int auth_transaction; 374 int auth_transaction;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 819639486653..398ca66bdfcb 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -539,7 +539,7 @@ static int ieee80211_stop(struct net_device *dev)
539 /* fall through */ 539 /* fall through */
540 case IEEE80211_IF_TYPE_STA: 540 case IEEE80211_IF_TYPE_STA:
541 case IEEE80211_IF_TYPE_IBSS: 541 case IEEE80211_IF_TYPE_IBSS:
542 sdata->u.sta.state = IEEE80211_DISABLED; 542 sdata->u.sta.state = IEEE80211_STA_MLME_DISABLED;
543 memset(sdata->u.sta.bssid, 0, ETH_ALEN); 543 memset(sdata->u.sta.bssid, 0, ETH_ALEN);
544 del_timer_sync(&sdata->u.sta.timer); 544 del_timer_sync(&sdata->u.sta.timer);
545 /* 545 /*
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index ae5a5cbabae3..f05519d1c2c6 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -663,11 +663,11 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata,
663 printk(KERN_DEBUG "%s: authentication with AP %s" 663 printk(KERN_DEBUG "%s: authentication with AP %s"
664 " timed out\n", 664 " timed out\n",
665 sdata->dev->name, print_mac(mac, ifsta->bssid)); 665 sdata->dev->name, print_mac(mac, ifsta->bssid));
666 ifsta->state = IEEE80211_DISABLED; 666 ifsta->state = IEEE80211_STA_MLME_DISABLED;
667 return; 667 return;
668 } 668 }
669 669
670 ifsta->state = IEEE80211_AUTHENTICATE; 670 ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
671 printk(KERN_DEBUG "%s: authenticate with AP %s\n", 671 printk(KERN_DEBUG "%s: authenticate with AP %s\n",
672 sdata->dev->name, print_mac(mac, ifsta->bssid)); 672 sdata->dev->name, print_mac(mac, ifsta->bssid));
673 673
@@ -1004,17 +1004,17 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata,
1004 printk(KERN_DEBUG "%s: association with AP %s" 1004 printk(KERN_DEBUG "%s: association with AP %s"
1005 " timed out\n", 1005 " timed out\n",
1006 sdata->dev->name, print_mac(mac, ifsta->bssid)); 1006 sdata->dev->name, print_mac(mac, ifsta->bssid));
1007 ifsta->state = IEEE80211_DISABLED; 1007 ifsta->state = IEEE80211_STA_MLME_DISABLED;
1008 return; 1008 return;
1009 } 1009 }
1010 1010
1011 ifsta->state = IEEE80211_ASSOCIATE; 1011 ifsta->state = IEEE80211_STA_MLME_ASSOCIATE;
1012 printk(KERN_DEBUG "%s: associate with AP %s\n", 1012 printk(KERN_DEBUG "%s: associate with AP %s\n",
1013 sdata->dev->name, print_mac(mac, ifsta->bssid)); 1013 sdata->dev->name, print_mac(mac, ifsta->bssid));
1014 if (ieee80211_privacy_mismatch(sdata, ifsta)) { 1014 if (ieee80211_privacy_mismatch(sdata, ifsta)) {
1015 printk(KERN_DEBUG "%s: mismatch in privacy configuration and " 1015 printk(KERN_DEBUG "%s: mismatch in privacy configuration and "
1016 "mixed-cell disabled - abort association\n", sdata->dev->name); 1016 "mixed-cell disabled - abort association\n", sdata->dev->name);
1017 ifsta->state = IEEE80211_DISABLED; 1017 ifsta->state = IEEE80211_STA_MLME_DISABLED;
1018 return; 1018 return;
1019 } 1019 }
1020 1020
@@ -1037,7 +1037,7 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata,
1037 * for better APs. */ 1037 * for better APs. */
1038 /* TODO: remove expired BSSes */ 1038 /* TODO: remove expired BSSes */
1039 1039
1040 ifsta->state = IEEE80211_ASSOCIATED; 1040 ifsta->state = IEEE80211_STA_MLME_ASSOCIATED;
1041 1041
1042 rcu_read_lock(); 1042 rcu_read_lock();
1043 1043
@@ -1080,7 +1080,7 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata,
1080 sta_info_destroy(sta); 1080 sta_info_destroy(sta);
1081 1081
1082 if (disassoc) { 1082 if (disassoc) {
1083 ifsta->state = IEEE80211_DISABLED; 1083 ifsta->state = IEEE80211_STA_MLME_DISABLED;
1084 ieee80211_set_associated(sdata, ifsta, 0); 1084 ieee80211_set_associated(sdata, ifsta, 0);
1085 } else { 1085 } else {
1086 mod_timer(&ifsta->timer, jiffies + 1086 mod_timer(&ifsta->timer, jiffies +
@@ -1838,7 +1838,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1838 u16 auth_alg, auth_transaction, status_code; 1838 u16 auth_alg, auth_transaction, status_code;
1839 DECLARE_MAC_BUF(mac); 1839 DECLARE_MAC_BUF(mac);
1840 1840
1841 if (ifsta->state != IEEE80211_AUTHENTICATE && 1841 if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
1842 sdata->vif.type != IEEE80211_IF_TYPE_IBSS) 1842 sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
1843 return; 1843 return;
1844 1844
@@ -1942,10 +1942,10 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
1942 if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) 1942 if (ifsta->flags & IEEE80211_STA_AUTHENTICATED)
1943 printk(KERN_DEBUG "%s: deauthenticated\n", sdata->dev->name); 1943 printk(KERN_DEBUG "%s: deauthenticated\n", sdata->dev->name);
1944 1944
1945 if (ifsta->state == IEEE80211_AUTHENTICATE || 1945 if (ifsta->state == IEEE80211_STA_MLME_AUTHENTICATE ||
1946 ifsta->state == IEEE80211_ASSOCIATE || 1946 ifsta->state == IEEE80211_STA_MLME_ASSOCIATE ||
1947 ifsta->state == IEEE80211_ASSOCIATED) { 1947 ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) {
1948 ifsta->state = IEEE80211_AUTHENTICATE; 1948 ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
1949 mod_timer(&ifsta->timer, jiffies + 1949 mod_timer(&ifsta->timer, jiffies +
1950 IEEE80211_RETRY_AUTH_INTERVAL); 1950 IEEE80211_RETRY_AUTH_INTERVAL);
1951 } 1951 }
@@ -1974,8 +1974,8 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
1974 if (ifsta->flags & IEEE80211_STA_ASSOCIATED) 1974 if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
1975 printk(KERN_DEBUG "%s: disassociated\n", sdata->dev->name); 1975 printk(KERN_DEBUG "%s: disassociated\n", sdata->dev->name);
1976 1976
1977 if (ifsta->state == IEEE80211_ASSOCIATED) { 1977 if (ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) {
1978 ifsta->state = IEEE80211_ASSOCIATE; 1978 ifsta->state = IEEE80211_STA_MLME_ASSOCIATE;
1979 mod_timer(&ifsta->timer, jiffies + 1979 mod_timer(&ifsta->timer, jiffies +
1980 IEEE80211_RETRY_AUTH_INTERVAL); 1980 IEEE80211_RETRY_AUTH_INTERVAL);
1981 } 1981 }
@@ -2005,7 +2005,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2005 /* AssocResp and ReassocResp have identical structure, so process both 2005 /* AssocResp and ReassocResp have identical structure, so process both
2006 * of them in this function. */ 2006 * of them in this function. */
2007 2007
2008 if (ifsta->state != IEEE80211_ASSOCIATE) 2008 if (ifsta->state != IEEE80211_STA_MLME_ASSOCIATE)
2009 return; 2009 return;
2010 2010
2011 if (len < 24 + 6) 2011 if (len < 24 + 6)
@@ -2487,7 +2487,7 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
2487 2487
2488 ieee80211_sta_def_wmm_params(sdata, bss, 1); 2488 ieee80211_sta_def_wmm_params(sdata, bss, 1);
2489 2489
2490 ifsta->state = IEEE80211_IBSS_JOINED; 2490 ifsta->state = IEEE80211_STA_MLME_IBSS_JOINED;
2491 mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); 2491 mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL);
2492 2492
2493 memset(&wrqu, 0, sizeof(wrqu)); 2493 memset(&wrqu, 0, sizeof(wrqu));
@@ -2960,7 +2960,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
2960#endif 2960#endif
2961 2961
2962 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS || 2962 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS ||
2963 ifsta->state != IEEE80211_IBSS_JOINED || 2963 ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED ||
2964 len < 24 + 2 || !ifsta->probe_resp) 2964 len < 24 + 2 || !ifsta->probe_resp)
2965 return; 2965 return;
2966 2966
@@ -3279,7 +3279,7 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
3279{ 3279{
3280 struct ieee80211_if_sta *ifsta; 3280 struct ieee80211_if_sta *ifsta;
3281 ifsta = &sdata->u.sta; 3281 ifsta = &sdata->u.sta;
3282 ifsta->state = IEEE80211_MESH_UP; 3282 ifsta->state = IEEE80211_STA_MLME_MESH_UP;
3283 ieee80211_sta_timer((unsigned long)sdata); 3283 ieee80211_sta_timer((unsigned long)sdata);
3284 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); 3284 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
3285} 3285}
@@ -3327,8 +3327,8 @@ void ieee80211_sta_work(struct work_struct *work)
3327 mesh_path_start_discovery(sdata); 3327 mesh_path_start_discovery(sdata);
3328#endif 3328#endif
3329 3329
3330 if (ifsta->state != IEEE80211_AUTHENTICATE && 3330 if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
3331 ifsta->state != IEEE80211_ASSOCIATE && 3331 ifsta->state != IEEE80211_STA_MLME_ASSOCIATE &&
3332 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { 3332 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) {
3333 if (ifsta->scan_ssid_len) 3333 if (ifsta->scan_ssid_len)
3334 ieee80211_sta_start_scan(sdata, ifsta->scan_ssid, ifsta->scan_ssid_len); 3334 ieee80211_sta_start_scan(sdata, ifsta->scan_ssid, ifsta->scan_ssid_len);
@@ -3345,25 +3345,25 @@ void ieee80211_sta_work(struct work_struct *work)
3345 return; 3345 return;
3346 3346
3347 switch (ifsta->state) { 3347 switch (ifsta->state) {
3348 case IEEE80211_DISABLED: 3348 case IEEE80211_STA_MLME_DISABLED:
3349 break; 3349 break;
3350 case IEEE80211_AUTHENTICATE: 3350 case IEEE80211_STA_MLME_AUTHENTICATE:
3351 ieee80211_authenticate(sdata, ifsta); 3351 ieee80211_authenticate(sdata, ifsta);
3352 break; 3352 break;
3353 case IEEE80211_ASSOCIATE: 3353 case IEEE80211_STA_MLME_ASSOCIATE:
3354 ieee80211_associate(sdata, ifsta); 3354 ieee80211_associate(sdata, ifsta);
3355 break; 3355 break;
3356 case IEEE80211_ASSOCIATED: 3356 case IEEE80211_STA_MLME_ASSOCIATED:
3357 ieee80211_associated(sdata, ifsta); 3357 ieee80211_associated(sdata, ifsta);
3358 break; 3358 break;
3359 case IEEE80211_IBSS_SEARCH: 3359 case IEEE80211_STA_MLME_IBSS_SEARCH:
3360 ieee80211_sta_find_ibss(sdata, ifsta); 3360 ieee80211_sta_find_ibss(sdata, ifsta);
3361 break; 3361 break;
3362 case IEEE80211_IBSS_JOINED: 3362 case IEEE80211_STA_MLME_IBSS_JOINED:
3363 ieee80211_sta_merge_ibss(sdata, ifsta); 3363 ieee80211_sta_merge_ibss(sdata, ifsta);
3364 break; 3364 break;
3365#ifdef CONFIG_MAC80211_MESH 3365#ifdef CONFIG_MAC80211_MESH
3366 case IEEE80211_MESH_UP: 3366 case IEEE80211_STA_MLME_MESH_UP:
3367 ieee80211_mesh_housekeeping(sdata, ifsta); 3367 ieee80211_mesh_housekeeping(sdata, ifsta);
3368 break; 3368 break;
3369#endif 3369#endif
@@ -3506,20 +3506,20 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata,
3506 ieee80211_sta_set_bssid(sdata, selected->bssid); 3506 ieee80211_sta_set_bssid(sdata, selected->bssid);
3507 ieee80211_sta_def_wmm_params(sdata, selected, 0); 3507 ieee80211_sta_def_wmm_params(sdata, selected, 0);
3508 ieee80211_rx_bss_put(local, selected); 3508 ieee80211_rx_bss_put(local, selected);
3509 ifsta->state = IEEE80211_AUTHENTICATE; 3509 ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
3510 ieee80211_sta_reset_auth(sdata, ifsta); 3510 ieee80211_sta_reset_auth(sdata, ifsta);
3511 return 0; 3511 return 0;
3512 } else { 3512 } else {
3513 if (ifsta->state != IEEE80211_AUTHENTICATE) { 3513 if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE) {
3514 if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) 3514 if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL)
3515 ieee80211_sta_start_scan(sdata, NULL, 0); 3515 ieee80211_sta_start_scan(sdata, NULL, 0);
3516 else 3516 else
3517 ieee80211_sta_start_scan(sdata, ifsta->ssid, 3517 ieee80211_sta_start_scan(sdata, ifsta->ssid,
3518 ifsta->ssid_len); 3518 ifsta->ssid_len);
3519 ifsta->state = IEEE80211_AUTHENTICATE; 3519 ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
3520 set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); 3520 set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
3521 } else 3521 } else
3522 ifsta->state = IEEE80211_DISABLED; 3522 ifsta->state = IEEE80211_STA_MLME_DISABLED;
3523 } 3523 }
3524 return -1; 3524 return -1;
3525} 3525}
@@ -3657,7 +3657,7 @@ dont_join:
3657#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 3657#endif /* CONFIG_MAC80211_IBSS_DEBUG */
3658 3658
3659 /* Selected IBSS not found in current scan results - try to scan */ 3659 /* Selected IBSS not found in current scan results - try to scan */
3660 if (ifsta->state == IEEE80211_IBSS_JOINED && 3660 if (ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED &&
3661 !ieee80211_sta_active_ibss(sdata)) { 3661 !ieee80211_sta_active_ibss(sdata)) {
3662 mod_timer(&ifsta->timer, jiffies + 3662 mod_timer(&ifsta->timer, jiffies +
3663 IEEE80211_IBSS_MERGE_INTERVAL); 3663 IEEE80211_IBSS_MERGE_INTERVAL);
@@ -3667,7 +3667,7 @@ dont_join:
3667 "join\n", sdata->dev->name); 3667 "join\n", sdata->dev->name);
3668 return ieee80211_sta_req_scan(sdata, ifsta->ssid, 3668 return ieee80211_sta_req_scan(sdata, ifsta->ssid,
3669 ifsta->ssid_len); 3669 ifsta->ssid_len);
3670 } else if (ifsta->state != IEEE80211_IBSS_JOINED) { 3670 } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) {
3671 int interval = IEEE80211_SCAN_INTERVAL; 3671 int interval = IEEE80211_SCAN_INTERVAL;
3672 3672
3673 if (time_after(jiffies, ifsta->ibss_join_req + 3673 if (time_after(jiffies, ifsta->ibss_join_req +
@@ -3687,7 +3687,7 @@ dont_join:
3687 interval = IEEE80211_SCAN_INTERVAL_SLOW; 3687 interval = IEEE80211_SCAN_INTERVAL_SLOW;
3688 } 3688 }
3689 3689
3690 ifsta->state = IEEE80211_IBSS_SEARCH; 3690 ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH;
3691 mod_timer(&ifsta->timer, jiffies + interval); 3691 mod_timer(&ifsta->timer, jiffies + interval);
3692 return 0; 3692 return 0;
3693 } 3693 }
@@ -3734,7 +3734,7 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
3734 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && 3734 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
3735 !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { 3735 !(ifsta->flags & IEEE80211_STA_BSSID_SET)) {
3736 ifsta->ibss_join_req = jiffies; 3736 ifsta->ibss_join_req = jiffies;
3737 ifsta->state = IEEE80211_IBSS_SEARCH; 3737 ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH;
3738 return ieee80211_sta_find_ibss(sdata, ifsta); 3738 return ieee80211_sta_find_ibss(sdata, ifsta);
3739 } 3739 }
3740 3740
@@ -3881,7 +3881,7 @@ done:
3881 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 3881 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
3882 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 3882 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
3883 if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || 3883 if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) ||
3884 (!(ifsta->state == IEEE80211_IBSS_JOINED) && 3884 (!(ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED) &&
3885 !ieee80211_sta_active_ibss(sdata))) 3885 !ieee80211_sta_active_ibss(sdata)))
3886 ieee80211_sta_find_ibss(sdata, ifsta); 3886 ieee80211_sta_find_ibss(sdata, ifsta);
3887 } 3887 }
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 735daa355c37..beae664ab480 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -535,8 +535,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
535 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 535 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
536 if (sdata->vif.type == IEEE80211_IF_TYPE_STA || 536 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
537 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 537 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
538 if (sdata->u.sta.state == IEEE80211_ASSOCIATED || 538 if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATED ||
539 sdata->u.sta.state == IEEE80211_IBSS_JOINED) { 539 sdata->u.sta.state == IEEE80211_STA_MLME_IBSS_JOINED) {
540 ap_addr->sa_family = ARPHRD_ETHER; 540 ap_addr->sa_family = ARPHRD_ETHER;
541 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); 541 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
542 return 0; 542 return 0;