diff options
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 1213 |
1 files changed, 582 insertions, 631 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 902cac1bd246..df12e746b03e 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "led.h" | 34 | #include "led.h" |
35 | #include "mesh.h" | 35 | #include "mesh.h" |
36 | 36 | ||
37 | #define IEEE80211_ASSOC_SCANS_MAX_TRIES 2 | ||
37 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) | 38 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) |
38 | #define IEEE80211_AUTH_MAX_TRIES 3 | 39 | #define IEEE80211_AUTH_MAX_TRIES 3 |
39 | #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) | 40 | #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) |
@@ -73,19 +74,19 @@ | |||
73 | #define IEEE80211_MIN_AMPDU_BUF 0x8 | 74 | #define IEEE80211_MIN_AMPDU_BUF 0x8 |
74 | #define IEEE80211_MAX_AMPDU_BUF 0x40 | 75 | #define IEEE80211_MAX_AMPDU_BUF 0x40 |
75 | 76 | ||
76 | static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | 77 | static void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
77 | u8 *ssid, size_t ssid_len); | 78 | u8 *ssid, size_t ssid_len); |
78 | static struct ieee80211_sta_bss * | 79 | static struct ieee80211_sta_bss * |
79 | ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int freq, | 80 | ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, |
80 | u8 *ssid, u8 ssid_len); | 81 | u8 *ssid, u8 ssid_len); |
81 | static void ieee80211_rx_bss_put(struct ieee80211_local *local, | 82 | static void ieee80211_rx_bss_put(struct ieee80211_local *local, |
82 | struct ieee80211_sta_bss *bss); | 83 | struct ieee80211_sta_bss *bss); |
83 | static int ieee80211_sta_find_ibss(struct net_device *dev, | 84 | static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, |
84 | struct ieee80211_if_sta *ifsta); | 85 | struct ieee80211_if_sta *ifsta); |
85 | static int ieee80211_sta_wep_configured(struct net_device *dev); | 86 | static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata); |
86 | static int ieee80211_sta_start_scan(struct net_device *dev, | 87 | static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *sdata, |
87 | u8 *ssid, size_t ssid_len); | 88 | u8 *ssid, size_t ssid_len); |
88 | static int ieee80211_sta_config_auth(struct net_device *dev, | 89 | static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, |
89 | struct ieee80211_if_sta *ifsta); | 90 | struct ieee80211_if_sta *ifsta); |
90 | static void sta_rx_agg_session_timer_expired(unsigned long data); | 91 | static void sta_rx_agg_session_timer_expired(unsigned long data); |
91 | 92 | ||
@@ -97,6 +98,8 @@ void ieee802_11_parse_elems(u8 *start, size_t len, | |||
97 | u8 *pos = start; | 98 | u8 *pos = start; |
98 | 99 | ||
99 | memset(elems, 0, sizeof(*elems)); | 100 | memset(elems, 0, sizeof(*elems)); |
101 | elems->ie_start = start; | ||
102 | elems->total_len = len; | ||
100 | 103 | ||
101 | while (left >= 2) { | 104 | while (left >= 2) { |
102 | u8 id, elen; | 105 | u8 id, elen; |
@@ -233,17 +236,37 @@ void ieee802_11_parse_elems(u8 *start, size_t len, | |||
233 | } | 236 | } |
234 | 237 | ||
235 | 238 | ||
239 | static u8 * ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie) | ||
240 | { | ||
241 | u8 *end, *pos; | ||
242 | |||
243 | pos = bss->ies; | ||
244 | if (pos == NULL) | ||
245 | return NULL; | ||
246 | end = pos + bss->ies_len; | ||
247 | |||
248 | while (pos + 1 < end) { | ||
249 | if (pos + 2 + pos[1] > end) | ||
250 | break; | ||
251 | if (pos[0] == ie) | ||
252 | return pos; | ||
253 | pos += 2 + pos[1]; | ||
254 | } | ||
255 | |||
256 | return NULL; | ||
257 | } | ||
258 | |||
259 | |||
236 | static int ecw2cw(int ecw) | 260 | static int ecw2cw(int ecw) |
237 | { | 261 | { |
238 | return (1 << ecw) - 1; | 262 | return (1 << ecw) - 1; |
239 | } | 263 | } |
240 | 264 | ||
241 | 265 | ||
242 | static void ieee80211_sta_def_wmm_params(struct net_device *dev, | 266 | static void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, |
243 | struct ieee80211_sta_bss *bss, | 267 | struct ieee80211_sta_bss *bss, |
244 | int ibss) | 268 | int ibss) |
245 | { | 269 | { |
246 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
247 | struct ieee80211_local *local = sdata->local; | 270 | struct ieee80211_local *local = sdata->local; |
248 | int i, have_higher_than_11mbit = 0; | 271 | int i, have_higher_than_11mbit = 0; |
249 | 272 | ||
@@ -281,11 +304,10 @@ static void ieee80211_sta_def_wmm_params(struct net_device *dev, | |||
281 | } | 304 | } |
282 | } | 305 | } |
283 | 306 | ||
284 | static void ieee80211_sta_wmm_params(struct net_device *dev, | 307 | static void ieee80211_sta_wmm_params(struct ieee80211_local *local, |
285 | struct ieee80211_if_sta *ifsta, | 308 | struct ieee80211_if_sta *ifsta, |
286 | u8 *wmm_param, size_t wmm_param_len) | 309 | u8 *wmm_param, size_t wmm_param_len) |
287 | { | 310 | { |
288 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
289 | struct ieee80211_tx_queue_params params; | 311 | struct ieee80211_tx_queue_params params; |
290 | size_t left; | 312 | size_t left; |
291 | int count; | 313 | int count; |
@@ -349,14 +371,14 @@ static void ieee80211_sta_wmm_params(struct net_device *dev, | |||
349 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 371 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
350 | printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d " | 372 | printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d " |
351 | "cWmin=%d cWmax=%d txop=%d\n", | 373 | "cWmin=%d cWmax=%d txop=%d\n", |
352 | dev->name, queue, aci, acm, params.aifs, params.cw_min, | 374 | local->mdev->name, queue, aci, acm, params.aifs, params.cw_min, |
353 | params.cw_max, params.txop); | 375 | params.cw_max, params.txop); |
354 | #endif | 376 | #endif |
355 | /* TODO: handle ACM (block TX, fallback to next lowest allowed | 377 | /* TODO: handle ACM (block TX, fallback to next lowest allowed |
356 | * AC for now) */ | 378 | * AC for now) */ |
357 | if (local->ops->conf_tx(local_to_hw(local), queue, ¶ms)) { | 379 | if (local->ops->conf_tx(local_to_hw(local), queue, ¶ms)) { |
358 | printk(KERN_DEBUG "%s: failed to set TX queue " | 380 | printk(KERN_DEBUG "%s: failed to set TX queue " |
359 | "parameters for queue %d\n", dev->name, queue); | 381 | "parameters for queue %d\n", local->mdev->name, queue); |
360 | } | 382 | } |
361 | } | 383 | } |
362 | } | 384 | } |
@@ -475,62 +497,30 @@ int ieee80211_ht_addt_info_ie_to_ht_bss_info( | |||
475 | return 0; | 497 | return 0; |
476 | } | 498 | } |
477 | 499 | ||
478 | static void ieee80211_sta_send_associnfo(struct net_device *dev, | 500 | static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata, |
479 | struct ieee80211_if_sta *ifsta) | 501 | struct ieee80211_if_sta *ifsta) |
480 | { | 502 | { |
481 | char *buf; | ||
482 | size_t len; | ||
483 | int i; | ||
484 | union iwreq_data wrqu; | 503 | union iwreq_data wrqu; |
485 | 504 | ||
486 | if (!ifsta->assocreq_ies && !ifsta->assocresp_ies) | ||
487 | return; | ||
488 | |||
489 | buf = kmalloc(50 + 2 * (ifsta->assocreq_ies_len + | ||
490 | ifsta->assocresp_ies_len), GFP_KERNEL); | ||
491 | if (!buf) | ||
492 | return; | ||
493 | |||
494 | len = sprintf(buf, "ASSOCINFO("); | ||
495 | if (ifsta->assocreq_ies) { | 505 | if (ifsta->assocreq_ies) { |
496 | len += sprintf(buf + len, "ReqIEs="); | 506 | memset(&wrqu, 0, sizeof(wrqu)); |
497 | for (i = 0; i < ifsta->assocreq_ies_len; i++) { | 507 | wrqu.data.length = ifsta->assocreq_ies_len; |
498 | len += sprintf(buf + len, "%02x", | 508 | wireless_send_event(sdata->dev, IWEVASSOCREQIE, &wrqu, |
499 | ifsta->assocreq_ies[i]); | 509 | ifsta->assocreq_ies); |
500 | } | ||
501 | } | 510 | } |
502 | if (ifsta->assocresp_ies) { | 511 | if (ifsta->assocresp_ies) { |
503 | if (ifsta->assocreq_ies) | 512 | memset(&wrqu, 0, sizeof(wrqu)); |
504 | len += sprintf(buf + len, " "); | 513 | wrqu.data.length = ifsta->assocresp_ies_len; |
505 | len += sprintf(buf + len, "RespIEs="); | 514 | wireless_send_event(sdata->dev, IWEVASSOCRESPIE, &wrqu, |
506 | for (i = 0; i < ifsta->assocresp_ies_len; i++) { | 515 | ifsta->assocresp_ies); |
507 | len += sprintf(buf + len, "%02x", | ||
508 | ifsta->assocresp_ies[i]); | ||
509 | } | ||
510 | } | 516 | } |
511 | len += sprintf(buf + len, ")"); | ||
512 | |||
513 | if (len > IW_CUSTOM_MAX) { | ||
514 | len = sprintf(buf, "ASSOCRESPIE="); | ||
515 | for (i = 0; i < ifsta->assocresp_ies_len; i++) { | ||
516 | len += sprintf(buf + len, "%02x", | ||
517 | ifsta->assocresp_ies[i]); | ||
518 | } | ||
519 | } | ||
520 | |||
521 | memset(&wrqu, 0, sizeof(wrqu)); | ||
522 | wrqu.data.length = len; | ||
523 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); | ||
524 | |||
525 | kfree(buf); | ||
526 | } | 517 | } |
527 | 518 | ||
528 | 519 | ||
529 | static void ieee80211_set_associated(struct net_device *dev, | 520 | static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, |
530 | struct ieee80211_if_sta *ifsta, | 521 | struct ieee80211_if_sta *ifsta, |
531 | bool assoc) | 522 | bool assoc) |
532 | { | 523 | { |
533 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
534 | struct ieee80211_local *local = sdata->local; | 524 | struct ieee80211_local *local = sdata->local; |
535 | struct ieee80211_conf *conf = &local_to_hw(local)->conf; | 525 | struct ieee80211_conf *conf = &local_to_hw(local)->conf; |
536 | union iwreq_data wrqu; | 526 | union iwreq_data wrqu; |
@@ -544,7 +534,7 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
544 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 534 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
545 | return; | 535 | return; |
546 | 536 | ||
547 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 537 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
548 | conf->channel->center_freq, | 538 | conf->channel->center_freq, |
549 | ifsta->ssid, ifsta->ssid_len); | 539 | ifsta->ssid, ifsta->ssid_len); |
550 | if (bss) { | 540 | if (bss) { |
@@ -568,12 +558,12 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
568 | ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; | 558 | ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; |
569 | memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); | 559 | memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); |
570 | memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); | 560 | memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); |
571 | ieee80211_sta_send_associnfo(dev, ifsta); | 561 | ieee80211_sta_send_associnfo(sdata, ifsta); |
572 | } else { | 562 | } else { |
573 | netif_carrier_off(dev); | 563 | netif_carrier_off(sdata->dev); |
574 | ieee80211_sta_tear_down_BA_sessions(dev, ifsta->bssid); | 564 | ieee80211_sta_tear_down_BA_sessions(sdata, ifsta->bssid); |
575 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; | 565 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; |
576 | changed |= ieee80211_reset_erp_info(dev); | 566 | changed |= ieee80211_reset_erp_info(sdata); |
577 | 567 | ||
578 | sdata->bss_conf.assoc_ht = 0; | 568 | sdata->bss_conf.assoc_ht = 0; |
579 | sdata->bss_conf.ht_conf = NULL; | 569 | sdata->bss_conf.ht_conf = NULL; |
@@ -588,27 +578,27 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
588 | ieee80211_bss_info_change_notify(sdata, changed); | 578 | ieee80211_bss_info_change_notify(sdata, changed); |
589 | 579 | ||
590 | if (assoc) | 580 | if (assoc) |
591 | netif_carrier_on(dev); | 581 | netif_carrier_on(sdata->dev); |
592 | 582 | ||
593 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 583 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
594 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | 584 | wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL); |
595 | } | 585 | } |
596 | 586 | ||
597 | static void ieee80211_set_disassoc(struct net_device *dev, | 587 | static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, |
598 | struct ieee80211_if_sta *ifsta, int deauth) | 588 | struct ieee80211_if_sta *ifsta, int deauth) |
599 | { | 589 | { |
600 | if (deauth) | 590 | if (deauth) { |
591 | ifsta->direct_probe_tries = 0; | ||
601 | ifsta->auth_tries = 0; | 592 | ifsta->auth_tries = 0; |
593 | } | ||
594 | ifsta->assoc_scan_tries = 0; | ||
602 | ifsta->assoc_tries = 0; | 595 | ifsta->assoc_tries = 0; |
603 | ieee80211_set_associated(dev, ifsta, 0); | 596 | ieee80211_set_associated(sdata, ifsta, 0); |
604 | } | 597 | } |
605 | 598 | ||
606 | void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb, | 599 | void ieee80211_sta_tx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
607 | int encrypt) | 600 | int encrypt) |
608 | { | 601 | { |
609 | struct ieee80211_sub_if_data *sdata; | ||
610 | |||
611 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
612 | skb->dev = sdata->local->mdev; | 602 | skb->dev = sdata->local->mdev; |
613 | skb_set_mac_header(skb, 0); | 603 | skb_set_mac_header(skb, 0); |
614 | skb_set_network_header(skb, 0); | 604 | skb_set_network_header(skb, 0); |
@@ -621,12 +611,12 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb, | |||
621 | } | 611 | } |
622 | 612 | ||
623 | 613 | ||
624 | static void ieee80211_send_auth(struct net_device *dev, | 614 | static void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, |
625 | struct ieee80211_if_sta *ifsta, | 615 | struct ieee80211_if_sta *ifsta, |
626 | int transaction, u8 *extra, size_t extra_len, | 616 | int transaction, u8 *extra, size_t extra_len, |
627 | int encrypt) | 617 | int encrypt) |
628 | { | 618 | { |
629 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 619 | struct ieee80211_local *local = sdata->local; |
630 | struct sk_buff *skb; | 620 | struct sk_buff *skb; |
631 | struct ieee80211_mgmt *mgmt; | 621 | struct ieee80211_mgmt *mgmt; |
632 | 622 | ||
@@ -634,19 +624,19 @@ static void ieee80211_send_auth(struct net_device *dev, | |||
634 | sizeof(*mgmt) + 6 + extra_len); | 624 | sizeof(*mgmt) + 6 + extra_len); |
635 | if (!skb) { | 625 | if (!skb) { |
636 | printk(KERN_DEBUG "%s: failed to allocate buffer for auth " | 626 | printk(KERN_DEBUG "%s: failed to allocate buffer for auth " |
637 | "frame\n", dev->name); | 627 | "frame\n", sdata->dev->name); |
638 | return; | 628 | return; |
639 | } | 629 | } |
640 | skb_reserve(skb, local->hw.extra_tx_headroom); | 630 | skb_reserve(skb, local->hw.extra_tx_headroom); |
641 | 631 | ||
642 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); | 632 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); |
643 | memset(mgmt, 0, 24 + 6); | 633 | memset(mgmt, 0, 24 + 6); |
644 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 634 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
645 | IEEE80211_STYPE_AUTH); | 635 | IEEE80211_STYPE_AUTH); |
646 | if (encrypt) | 636 | if (encrypt) |
647 | mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 637 | mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
648 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | 638 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); |
649 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 639 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
650 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 640 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
651 | mgmt->u.auth.auth_alg = cpu_to_le16(ifsta->auth_alg); | 641 | mgmt->u.auth.auth_alg = cpu_to_le16(ifsta->auth_alg); |
652 | mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); | 642 | mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); |
@@ -655,11 +645,41 @@ static void ieee80211_send_auth(struct net_device *dev, | |||
655 | if (extra) | 645 | if (extra) |
656 | memcpy(skb_put(skb, extra_len), extra, extra_len); | 646 | memcpy(skb_put(skb, extra_len), extra, extra_len); |
657 | 647 | ||
658 | ieee80211_sta_tx(dev, skb, encrypt); | 648 | ieee80211_sta_tx(sdata, skb, encrypt); |
659 | } | 649 | } |
660 | 650 | ||
651 | static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, | ||
652 | struct ieee80211_if_sta *ifsta) | ||
653 | { | ||
654 | DECLARE_MAC_BUF(mac); | ||
655 | |||
656 | ifsta->direct_probe_tries++; | ||
657 | if (ifsta->direct_probe_tries > IEEE80211_AUTH_MAX_TRIES) { | ||
658 | printk(KERN_DEBUG "%s: direct probe to AP %s timed out\n", | ||
659 | sdata->dev->name, print_mac(mac, ifsta->bssid)); | ||
660 | ifsta->state = IEEE80211_STA_MLME_DISABLED; | ||
661 | return; | ||
662 | } | ||
663 | |||
664 | printk(KERN_DEBUG "%s: direct probe to AP %s try %d\n", | ||
665 | sdata->dev->name, print_mac(mac, ifsta->bssid), | ||
666 | ifsta->direct_probe_tries); | ||
667 | |||
668 | ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE; | ||
661 | 669 | ||
662 | static void ieee80211_authenticate(struct net_device *dev, | 670 | set_bit(IEEE80211_STA_REQ_DIRECT_PROBE, &ifsta->request); |
671 | |||
672 | /* Direct probe is sent to broadcast address as some APs | ||
673 | * will not answer to direct packet in unassociated state. | ||
674 | */ | ||
675 | ieee80211_send_probe_req(sdata, NULL, | ||
676 | ifsta->ssid, ifsta->ssid_len); | ||
677 | |||
678 | mod_timer(&ifsta->timer, jiffies + IEEE80211_AUTH_TIMEOUT); | ||
679 | } | ||
680 | |||
681 | |||
682 | static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata, | ||
663 | struct ieee80211_if_sta *ifsta) | 683 | struct ieee80211_if_sta *ifsta) |
664 | { | 684 | { |
665 | DECLARE_MAC_BUF(mac); | 685 | DECLARE_MAC_BUF(mac); |
@@ -668,16 +688,16 @@ static void ieee80211_authenticate(struct net_device *dev, | |||
668 | if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { | 688 | if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { |
669 | printk(KERN_DEBUG "%s: authentication with AP %s" | 689 | printk(KERN_DEBUG "%s: authentication with AP %s" |
670 | " timed out\n", | 690 | " timed out\n", |
671 | dev->name, print_mac(mac, ifsta->bssid)); | 691 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
672 | ifsta->state = IEEE80211_DISABLED; | 692 | ifsta->state = IEEE80211_STA_MLME_DISABLED; |
673 | return; | 693 | return; |
674 | } | 694 | } |
675 | 695 | ||
676 | ifsta->state = IEEE80211_AUTHENTICATE; | 696 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; |
677 | printk(KERN_DEBUG "%s: authenticate with AP %s\n", | 697 | printk(KERN_DEBUG "%s: authenticate with AP %s\n", |
678 | dev->name, print_mac(mac, ifsta->bssid)); | 698 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
679 | 699 | ||
680 | ieee80211_send_auth(dev, ifsta, 1, NULL, 0, 0); | 700 | ieee80211_send_auth(sdata, ifsta, 1, NULL, 0, 0); |
681 | 701 | ||
682 | mod_timer(&ifsta->timer, jiffies + IEEE80211_AUTH_TIMEOUT); | 702 | mod_timer(&ifsta->timer, jiffies + IEEE80211_AUTH_TIMEOUT); |
683 | } | 703 | } |
@@ -703,13 +723,13 @@ static int ieee80211_compatible_rates(struct ieee80211_sta_bss *bss, | |||
703 | return count; | 723 | return count; |
704 | } | 724 | } |
705 | 725 | ||
706 | static void ieee80211_send_assoc(struct net_device *dev, | 726 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, |
707 | struct ieee80211_if_sta *ifsta) | 727 | struct ieee80211_if_sta *ifsta) |
708 | { | 728 | { |
709 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 729 | struct ieee80211_local *local = sdata->local; |
710 | struct sk_buff *skb; | 730 | struct sk_buff *skb; |
711 | struct ieee80211_mgmt *mgmt; | 731 | struct ieee80211_mgmt *mgmt; |
712 | u8 *pos, *ies; | 732 | u8 *pos, *ies, *ht_add_ie; |
713 | int i, len, count, rates_len, supp_rates_len; | 733 | int i, len, count, rates_len, supp_rates_len; |
714 | u16 capab; | 734 | u16 capab; |
715 | struct ieee80211_sta_bss *bss; | 735 | struct ieee80211_sta_bss *bss; |
@@ -722,7 +742,7 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
722 | ifsta->ssid_len); | 742 | ifsta->ssid_len); |
723 | if (!skb) { | 743 | if (!skb) { |
724 | printk(KERN_DEBUG "%s: failed to allocate buffer for assoc " | 744 | printk(KERN_DEBUG "%s: failed to allocate buffer for assoc " |
725 | "frame\n", dev->name); | 745 | "frame\n", sdata->dev->name); |
726 | return; | 746 | return; |
727 | } | 747 | } |
728 | skb_reserve(skb, local->hw.extra_tx_headroom); | 748 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -738,13 +758,13 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
738 | capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; | 758 | capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; |
739 | } | 759 | } |
740 | 760 | ||
741 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 761 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
742 | local->hw.conf.channel->center_freq, | 762 | local->hw.conf.channel->center_freq, |
743 | ifsta->ssid, ifsta->ssid_len); | 763 | ifsta->ssid, ifsta->ssid_len); |
744 | if (bss) { | 764 | if (bss) { |
745 | if (bss->capability & WLAN_CAPABILITY_PRIVACY) | 765 | if (bss->capability & WLAN_CAPABILITY_PRIVACY) |
746 | capab |= WLAN_CAPABILITY_PRIVACY; | 766 | capab |= WLAN_CAPABILITY_PRIVACY; |
747 | if (bss->wmm_ie) | 767 | if (bss->wmm_used) |
748 | wmm = 1; | 768 | wmm = 1; |
749 | 769 | ||
750 | /* get all rates supported by the device and the AP as | 770 | /* get all rates supported by the device and the AP as |
@@ -766,13 +786,13 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
766 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 786 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
767 | memset(mgmt, 0, 24); | 787 | memset(mgmt, 0, 24); |
768 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | 788 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); |
769 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 789 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
770 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 790 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
771 | 791 | ||
772 | if (ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) { | 792 | if (ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) { |
773 | skb_put(skb, 10); | 793 | skb_put(skb, 10); |
774 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 794 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
775 | IEEE80211_STYPE_REASSOC_REQ); | 795 | IEEE80211_STYPE_REASSOC_REQ); |
776 | mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); | 796 | mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); |
777 | mgmt->u.reassoc_req.listen_interval = | 797 | mgmt->u.reassoc_req.listen_interval = |
778 | cpu_to_le16(local->hw.conf.listen_interval); | 798 | cpu_to_le16(local->hw.conf.listen_interval); |
@@ -780,8 +800,8 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
780 | ETH_ALEN); | 800 | ETH_ALEN); |
781 | } else { | 801 | } else { |
782 | skb_put(skb, 4); | 802 | skb_put(skb, 4); |
783 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 803 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
784 | IEEE80211_STYPE_ASSOC_REQ); | 804 | IEEE80211_STYPE_ASSOC_REQ); |
785 | mgmt->u.assoc_req.capab_info = cpu_to_le16(capab); | 805 | mgmt->u.assoc_req.capab_info = cpu_to_le16(capab); |
786 | mgmt->u.reassoc_req.listen_interval = | 806 | mgmt->u.reassoc_req.listen_interval = |
787 | cpu_to_le16(local->hw.conf.listen_interval); | 807 | cpu_to_le16(local->hw.conf.listen_interval); |
@@ -866,9 +886,10 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
866 | 886 | ||
867 | /* wmm support is a must to HT */ | 887 | /* wmm support is a must to HT */ |
868 | if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) && | 888 | if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) && |
869 | sband->ht_info.ht_supported && bss->ht_add_ie) { | 889 | sband->ht_info.ht_supported && |
890 | (ht_add_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_EXTRA_INFO))) { | ||
870 | struct ieee80211_ht_addt_info *ht_add_info = | 891 | struct ieee80211_ht_addt_info *ht_add_info = |
871 | (struct ieee80211_ht_addt_info *)bss->ht_add_ie; | 892 | (struct ieee80211_ht_addt_info *)ht_add_ie; |
872 | u16 cap = sband->ht_info.cap; | 893 | u16 cap = sband->ht_info.cap; |
873 | __le16 tmp; | 894 | __le16 tmp; |
874 | u32 flags = local->hw.conf.channel->flags; | 895 | u32 flags = local->hw.conf.channel->flags; |
@@ -907,21 +928,21 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
907 | if (ifsta->assocreq_ies) | 928 | if (ifsta->assocreq_ies) |
908 | memcpy(ifsta->assocreq_ies, ies, ifsta->assocreq_ies_len); | 929 | memcpy(ifsta->assocreq_ies, ies, ifsta->assocreq_ies_len); |
909 | 930 | ||
910 | ieee80211_sta_tx(dev, skb, 0); | 931 | ieee80211_sta_tx(sdata, skb, 0); |
911 | } | 932 | } |
912 | 933 | ||
913 | 934 | ||
914 | static void ieee80211_send_deauth(struct net_device *dev, | 935 | static void ieee80211_send_deauth(struct ieee80211_sub_if_data *sdata, |
915 | struct ieee80211_if_sta *ifsta, u16 reason) | 936 | struct ieee80211_if_sta *ifsta, u16 reason) |
916 | { | 937 | { |
917 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 938 | struct ieee80211_local *local = sdata->local; |
918 | struct sk_buff *skb; | 939 | struct sk_buff *skb; |
919 | struct ieee80211_mgmt *mgmt; | 940 | struct ieee80211_mgmt *mgmt; |
920 | 941 | ||
921 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); | 942 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); |
922 | if (!skb) { | 943 | if (!skb) { |
923 | printk(KERN_DEBUG "%s: failed to allocate buffer for deauth " | 944 | printk(KERN_DEBUG "%s: failed to allocate buffer for deauth " |
924 | "frame\n", dev->name); | 945 | "frame\n", sdata->dev->name); |
925 | return; | 946 | return; |
926 | } | 947 | } |
927 | skb_reserve(skb, local->hw.extra_tx_headroom); | 948 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -929,28 +950,28 @@ static void ieee80211_send_deauth(struct net_device *dev, | |||
929 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 950 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
930 | memset(mgmt, 0, 24); | 951 | memset(mgmt, 0, 24); |
931 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | 952 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); |
932 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 953 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
933 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 954 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
934 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 955 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
935 | IEEE80211_STYPE_DEAUTH); | 956 | IEEE80211_STYPE_DEAUTH); |
936 | skb_put(skb, 2); | 957 | skb_put(skb, 2); |
937 | mgmt->u.deauth.reason_code = cpu_to_le16(reason); | 958 | mgmt->u.deauth.reason_code = cpu_to_le16(reason); |
938 | 959 | ||
939 | ieee80211_sta_tx(dev, skb, 0); | 960 | ieee80211_sta_tx(sdata, skb, 0); |
940 | } | 961 | } |
941 | 962 | ||
942 | 963 | ||
943 | static void ieee80211_send_disassoc(struct net_device *dev, | 964 | static void ieee80211_send_disassoc(struct ieee80211_sub_if_data *sdata, |
944 | struct ieee80211_if_sta *ifsta, u16 reason) | 965 | struct ieee80211_if_sta *ifsta, u16 reason) |
945 | { | 966 | { |
946 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 967 | struct ieee80211_local *local = sdata->local; |
947 | struct sk_buff *skb; | 968 | struct sk_buff *skb; |
948 | struct ieee80211_mgmt *mgmt; | 969 | struct ieee80211_mgmt *mgmt; |
949 | 970 | ||
950 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); | 971 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); |
951 | if (!skb) { | 972 | if (!skb) { |
952 | printk(KERN_DEBUG "%s: failed to allocate buffer for disassoc " | 973 | printk(KERN_DEBUG "%s: failed to allocate buffer for disassoc " |
953 | "frame\n", dev->name); | 974 | "frame\n", sdata->dev->name); |
954 | return; | 975 | return; |
955 | } | 976 | } |
956 | skb_reserve(skb, local->hw.extra_tx_headroom); | 977 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -958,21 +979,21 @@ static void ieee80211_send_disassoc(struct net_device *dev, | |||
958 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 979 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
959 | memset(mgmt, 0, 24); | 980 | memset(mgmt, 0, 24); |
960 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | 981 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); |
961 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 982 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
962 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 983 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
963 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 984 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
964 | IEEE80211_STYPE_DISASSOC); | 985 | IEEE80211_STYPE_DISASSOC); |
965 | skb_put(skb, 2); | 986 | skb_put(skb, 2); |
966 | mgmt->u.disassoc.reason_code = cpu_to_le16(reason); | 987 | mgmt->u.disassoc.reason_code = cpu_to_le16(reason); |
967 | 988 | ||
968 | ieee80211_sta_tx(dev, skb, 0); | 989 | ieee80211_sta_tx(sdata, skb, 0); |
969 | } | 990 | } |
970 | 991 | ||
971 | 992 | ||
972 | static int ieee80211_privacy_mismatch(struct net_device *dev, | 993 | static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata, |
973 | struct ieee80211_if_sta *ifsta) | 994 | struct ieee80211_if_sta *ifsta) |
974 | { | 995 | { |
975 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 996 | struct ieee80211_local *local = sdata->local; |
976 | struct ieee80211_sta_bss *bss; | 997 | struct ieee80211_sta_bss *bss; |
977 | int bss_privacy; | 998 | int bss_privacy; |
978 | int wep_privacy; | 999 | int wep_privacy; |
@@ -981,14 +1002,14 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
981 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL)) | 1002 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL)) |
982 | return 0; | 1003 | return 0; |
983 | 1004 | ||
984 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 1005 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
985 | local->hw.conf.channel->center_freq, | 1006 | local->hw.conf.channel->center_freq, |
986 | ifsta->ssid, ifsta->ssid_len); | 1007 | ifsta->ssid, ifsta->ssid_len); |
987 | if (!bss) | 1008 | if (!bss) |
988 | return 0; | 1009 | return 0; |
989 | 1010 | ||
990 | bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY); | 1011 | bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY); |
991 | wep_privacy = !!ieee80211_sta_wep_configured(dev); | 1012 | wep_privacy = !!ieee80211_sta_wep_configured(sdata); |
992 | privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED); | 1013 | privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED); |
993 | 1014 | ||
994 | ieee80211_rx_bss_put(local, bss); | 1015 | ieee80211_rx_bss_put(local, bss); |
@@ -1000,7 +1021,7 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
1000 | } | 1021 | } |
1001 | 1022 | ||
1002 | 1023 | ||
1003 | static void ieee80211_associate(struct net_device *dev, | 1024 | static void ieee80211_associate(struct ieee80211_sub_if_data *sdata, |
1004 | struct ieee80211_if_sta *ifsta) | 1025 | struct ieee80211_if_sta *ifsta) |
1005 | { | 1026 | { |
1006 | DECLARE_MAC_BUF(mac); | 1027 | DECLARE_MAC_BUF(mac); |
@@ -1009,31 +1030,31 @@ static void ieee80211_associate(struct net_device *dev, | |||
1009 | if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { | 1030 | if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { |
1010 | printk(KERN_DEBUG "%s: association with AP %s" | 1031 | printk(KERN_DEBUG "%s: association with AP %s" |
1011 | " timed out\n", | 1032 | " timed out\n", |
1012 | dev->name, print_mac(mac, ifsta->bssid)); | 1033 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
1013 | ifsta->state = IEEE80211_DISABLED; | 1034 | ifsta->state = IEEE80211_STA_MLME_DISABLED; |
1014 | return; | 1035 | return; |
1015 | } | 1036 | } |
1016 | 1037 | ||
1017 | ifsta->state = IEEE80211_ASSOCIATE; | 1038 | ifsta->state = IEEE80211_STA_MLME_ASSOCIATE; |
1018 | printk(KERN_DEBUG "%s: associate with AP %s\n", | 1039 | printk(KERN_DEBUG "%s: associate with AP %s\n", |
1019 | dev->name, print_mac(mac, ifsta->bssid)); | 1040 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
1020 | if (ieee80211_privacy_mismatch(dev, ifsta)) { | 1041 | if (ieee80211_privacy_mismatch(sdata, ifsta)) { |
1021 | printk(KERN_DEBUG "%s: mismatch in privacy configuration and " | 1042 | printk(KERN_DEBUG "%s: mismatch in privacy configuration and " |
1022 | "mixed-cell disabled - abort association\n", dev->name); | 1043 | "mixed-cell disabled - abort association\n", sdata->dev->name); |
1023 | ifsta->state = IEEE80211_DISABLED; | 1044 | ifsta->state = IEEE80211_STA_MLME_DISABLED; |
1024 | return; | 1045 | return; |
1025 | } | 1046 | } |
1026 | 1047 | ||
1027 | ieee80211_send_assoc(dev, ifsta); | 1048 | ieee80211_send_assoc(sdata, ifsta); |
1028 | 1049 | ||
1029 | mod_timer(&ifsta->timer, jiffies + IEEE80211_ASSOC_TIMEOUT); | 1050 | mod_timer(&ifsta->timer, jiffies + IEEE80211_ASSOC_TIMEOUT); |
1030 | } | 1051 | } |
1031 | 1052 | ||
1032 | 1053 | ||
1033 | static void ieee80211_associated(struct net_device *dev, | 1054 | static void ieee80211_associated(struct ieee80211_sub_if_data *sdata, |
1034 | struct ieee80211_if_sta *ifsta) | 1055 | struct ieee80211_if_sta *ifsta) |
1035 | { | 1056 | { |
1036 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1057 | struct ieee80211_local *local = sdata->local; |
1037 | struct sta_info *sta; | 1058 | struct sta_info *sta; |
1038 | int disassoc; | 1059 | int disassoc; |
1039 | DECLARE_MAC_BUF(mac); | 1060 | DECLARE_MAC_BUF(mac); |
@@ -1043,14 +1064,14 @@ static void ieee80211_associated(struct net_device *dev, | |||
1043 | * for better APs. */ | 1064 | * for better APs. */ |
1044 | /* TODO: remove expired BSSes */ | 1065 | /* TODO: remove expired BSSes */ |
1045 | 1066 | ||
1046 | ifsta->state = IEEE80211_ASSOCIATED; | 1067 | ifsta->state = IEEE80211_STA_MLME_ASSOCIATED; |
1047 | 1068 | ||
1048 | rcu_read_lock(); | 1069 | rcu_read_lock(); |
1049 | 1070 | ||
1050 | sta = sta_info_get(local, ifsta->bssid); | 1071 | sta = sta_info_get(local, ifsta->bssid); |
1051 | if (!sta) { | 1072 | if (!sta) { |
1052 | printk(KERN_DEBUG "%s: No STA entry for own AP %s\n", | 1073 | printk(KERN_DEBUG "%s: No STA entry for own AP %s\n", |
1053 | dev->name, print_mac(mac, ifsta->bssid)); | 1074 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
1054 | disassoc = 1; | 1075 | disassoc = 1; |
1055 | } else { | 1076 | } else { |
1056 | disassoc = 0; | 1077 | disassoc = 0; |
@@ -1060,11 +1081,11 @@ static void ieee80211_associated(struct net_device *dev, | |||
1060 | printk(KERN_DEBUG "%s: No ProbeResp from " | 1081 | printk(KERN_DEBUG "%s: No ProbeResp from " |
1061 | "current AP %s - assume out of " | 1082 | "current AP %s - assume out of " |
1062 | "range\n", | 1083 | "range\n", |
1063 | dev->name, print_mac(mac, ifsta->bssid)); | 1084 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
1064 | disassoc = 1; | 1085 | disassoc = 1; |
1065 | sta_info_unlink(&sta); | 1086 | sta_info_unlink(&sta); |
1066 | } else | 1087 | } else |
1067 | ieee80211_send_probe_req(dev, ifsta->bssid, | 1088 | ieee80211_send_probe_req(sdata, ifsta->bssid, |
1068 | local->scan_ssid, | 1089 | local->scan_ssid, |
1069 | local->scan_ssid_len); | 1090 | local->scan_ssid_len); |
1070 | ifsta->flags ^= IEEE80211_STA_PROBEREQ_POLL; | 1091 | ifsta->flags ^= IEEE80211_STA_PROBEREQ_POLL; |
@@ -1073,7 +1094,7 @@ static void ieee80211_associated(struct net_device *dev, | |||
1073 | if (time_after(jiffies, ifsta->last_probe + | 1094 | if (time_after(jiffies, ifsta->last_probe + |
1074 | IEEE80211_PROBE_INTERVAL)) { | 1095 | IEEE80211_PROBE_INTERVAL)) { |
1075 | ifsta->last_probe = jiffies; | 1096 | ifsta->last_probe = jiffies; |
1076 | ieee80211_send_probe_req(dev, ifsta->bssid, | 1097 | ieee80211_send_probe_req(sdata, ifsta->bssid, |
1077 | ifsta->ssid, | 1098 | ifsta->ssid, |
1078 | ifsta->ssid_len); | 1099 | ifsta->ssid_len); |
1079 | } | 1100 | } |
@@ -1086,8 +1107,8 @@ static void ieee80211_associated(struct net_device *dev, | |||
1086 | sta_info_destroy(sta); | 1107 | sta_info_destroy(sta); |
1087 | 1108 | ||
1088 | if (disassoc) { | 1109 | if (disassoc) { |
1089 | ifsta->state = IEEE80211_DISABLED; | 1110 | ifsta->state = IEEE80211_STA_MLME_DISABLED; |
1090 | ieee80211_set_associated(dev, ifsta, 0); | 1111 | ieee80211_set_associated(sdata, ifsta, 0); |
1091 | } else { | 1112 | } else { |
1092 | mod_timer(&ifsta->timer, jiffies + | 1113 | mod_timer(&ifsta->timer, jiffies + |
1093 | IEEE80211_MONITORING_INTERVAL); | 1114 | IEEE80211_MONITORING_INTERVAL); |
@@ -1095,10 +1116,10 @@ static void ieee80211_associated(struct net_device *dev, | |||
1095 | } | 1116 | } |
1096 | 1117 | ||
1097 | 1118 | ||
1098 | static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | 1119 | static void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
1099 | u8 *ssid, size_t ssid_len) | 1120 | u8 *ssid, size_t ssid_len) |
1100 | { | 1121 | { |
1101 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1122 | struct ieee80211_local *local = sdata->local; |
1102 | struct ieee80211_supported_band *sband; | 1123 | struct ieee80211_supported_band *sband; |
1103 | struct sk_buff *skb; | 1124 | struct sk_buff *skb; |
1104 | struct ieee80211_mgmt *mgmt; | 1125 | struct ieee80211_mgmt *mgmt; |
@@ -1108,16 +1129,16 @@ static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | |||
1108 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200); | 1129 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200); |
1109 | if (!skb) { | 1130 | if (!skb) { |
1110 | printk(KERN_DEBUG "%s: failed to allocate buffer for probe " | 1131 | printk(KERN_DEBUG "%s: failed to allocate buffer for probe " |
1111 | "request\n", dev->name); | 1132 | "request\n", sdata->dev->name); |
1112 | return; | 1133 | return; |
1113 | } | 1134 | } |
1114 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1135 | skb_reserve(skb, local->hw.extra_tx_headroom); |
1115 | 1136 | ||
1116 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1137 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1117 | memset(mgmt, 0, 24); | 1138 | memset(mgmt, 0, 24); |
1118 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 1139 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1119 | IEEE80211_STYPE_PROBE_REQ); | 1140 | IEEE80211_STYPE_PROBE_REQ); |
1120 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1141 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
1121 | if (dst) { | 1142 | if (dst) { |
1122 | memcpy(mgmt->da, dst, ETH_ALEN); | 1143 | memcpy(mgmt->da, dst, ETH_ALEN); |
1123 | memcpy(mgmt->bssid, dst, ETH_ALEN); | 1144 | memcpy(mgmt->bssid, dst, ETH_ALEN); |
@@ -1152,13 +1173,12 @@ static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | |||
1152 | *pos = rate->bitrate / 5; | 1173 | *pos = rate->bitrate / 5; |
1153 | } | 1174 | } |
1154 | 1175 | ||
1155 | ieee80211_sta_tx(dev, skb, 0); | 1176 | ieee80211_sta_tx(sdata, skb, 0); |
1156 | } | 1177 | } |
1157 | 1178 | ||
1158 | 1179 | ||
1159 | static int ieee80211_sta_wep_configured(struct net_device *dev) | 1180 | static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata) |
1160 | { | 1181 | { |
1161 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1162 | if (!sdata || !sdata->default_key || | 1182 | if (!sdata || !sdata->default_key || |
1163 | sdata->default_key->conf.alg != ALG_WEP) | 1183 | sdata->default_key->conf.alg != ALG_WEP) |
1164 | return 0; | 1184 | return 0; |
@@ -1166,16 +1186,16 @@ static int ieee80211_sta_wep_configured(struct net_device *dev) | |||
1166 | } | 1186 | } |
1167 | 1187 | ||
1168 | 1188 | ||
1169 | static void ieee80211_auth_completed(struct net_device *dev, | 1189 | static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata, |
1170 | struct ieee80211_if_sta *ifsta) | 1190 | struct ieee80211_if_sta *ifsta) |
1171 | { | 1191 | { |
1172 | printk(KERN_DEBUG "%s: authenticated\n", dev->name); | 1192 | printk(KERN_DEBUG "%s: authenticated\n", sdata->dev->name); |
1173 | ifsta->flags |= IEEE80211_STA_AUTHENTICATED; | 1193 | ifsta->flags |= IEEE80211_STA_AUTHENTICATED; |
1174 | ieee80211_associate(dev, ifsta); | 1194 | ieee80211_associate(sdata, ifsta); |
1175 | } | 1195 | } |
1176 | 1196 | ||
1177 | 1197 | ||
1178 | static void ieee80211_auth_challenge(struct net_device *dev, | 1198 | static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata, |
1179 | struct ieee80211_if_sta *ifsta, | 1199 | struct ieee80211_if_sta *ifsta, |
1180 | struct ieee80211_mgmt *mgmt, | 1200 | struct ieee80211_mgmt *mgmt, |
1181 | size_t len) | 1201 | size_t len) |
@@ -1187,17 +1207,16 @@ static void ieee80211_auth_challenge(struct net_device *dev, | |||
1187 | ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); | 1207 | ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); |
1188 | if (!elems.challenge) | 1208 | if (!elems.challenge) |
1189 | return; | 1209 | return; |
1190 | ieee80211_send_auth(dev, ifsta, 3, elems.challenge - 2, | 1210 | ieee80211_send_auth(sdata, ifsta, 3, elems.challenge - 2, |
1191 | elems.challenge_len + 2, 1); | 1211 | elems.challenge_len + 2, 1); |
1192 | } | 1212 | } |
1193 | 1213 | ||
1194 | static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | 1214 | static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid, |
1195 | u8 dialog_token, u16 status, u16 policy, | 1215 | u8 dialog_token, u16 status, u16 policy, |
1196 | u16 buf_size, u16 timeout) | 1216 | u16 buf_size, u16 timeout) |
1197 | { | 1217 | { |
1198 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1199 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 1218 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
1200 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1219 | struct ieee80211_local *local = sdata->local; |
1201 | struct sk_buff *skb; | 1220 | struct sk_buff *skb; |
1202 | struct ieee80211_mgmt *mgmt; | 1221 | struct ieee80211_mgmt *mgmt; |
1203 | u16 capab; | 1222 | u16 capab; |
@@ -1206,7 +1225,7 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | |||
1206 | 1225 | ||
1207 | if (!skb) { | 1226 | if (!skb) { |
1208 | printk(KERN_DEBUG "%s: failed to allocate buffer " | 1227 | printk(KERN_DEBUG "%s: failed to allocate buffer " |
1209 | "for addba resp frame\n", dev->name); | 1228 | "for addba resp frame\n", sdata->dev->name); |
1210 | return; | 1229 | return; |
1211 | } | 1230 | } |
1212 | 1231 | ||
@@ -1214,13 +1233,13 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | |||
1214 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1233 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1215 | memset(mgmt, 0, 24); | 1234 | memset(mgmt, 0, 24); |
1216 | memcpy(mgmt->da, da, ETH_ALEN); | 1235 | memcpy(mgmt->da, da, ETH_ALEN); |
1217 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1236 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
1218 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 1237 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) |
1219 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); | 1238 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
1220 | else | 1239 | else |
1221 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 1240 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
1222 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 1241 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1223 | IEEE80211_STYPE_ACTION); | 1242 | IEEE80211_STYPE_ACTION); |
1224 | 1243 | ||
1225 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp)); | 1244 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp)); |
1226 | mgmt->u.action.category = WLAN_CATEGORY_BACK; | 1245 | mgmt->u.action.category = WLAN_CATEGORY_BACK; |
@@ -1235,17 +1254,16 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | |||
1235 | mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); | 1254 | mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); |
1236 | mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); | 1255 | mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); |
1237 | 1256 | ||
1238 | ieee80211_sta_tx(dev, skb, 0); | 1257 | ieee80211_sta_tx(sdata, skb, 0); |
1239 | 1258 | ||
1240 | return; | 1259 | return; |
1241 | } | 1260 | } |
1242 | 1261 | ||
1243 | void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, | 1262 | void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, const u8 *da, |
1244 | u16 tid, u8 dialog_token, u16 start_seq_num, | 1263 | u16 tid, u8 dialog_token, u16 start_seq_num, |
1245 | u16 agg_size, u16 timeout) | 1264 | u16 agg_size, u16 timeout) |
1246 | { | 1265 | { |
1247 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1266 | struct ieee80211_local *local = sdata->local; |
1248 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1249 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 1267 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
1250 | struct sk_buff *skb; | 1268 | struct sk_buff *skb; |
1251 | struct ieee80211_mgmt *mgmt; | 1269 | struct ieee80211_mgmt *mgmt; |
@@ -1255,21 +1273,21 @@ void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, | |||
1255 | 1273 | ||
1256 | if (!skb) { | 1274 | if (!skb) { |
1257 | printk(KERN_ERR "%s: failed to allocate buffer " | 1275 | printk(KERN_ERR "%s: failed to allocate buffer " |
1258 | "for addba request frame\n", dev->name); | 1276 | "for addba request frame\n", sdata->dev->name); |
1259 | return; | 1277 | return; |
1260 | } | 1278 | } |
1261 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1279 | skb_reserve(skb, local->hw.extra_tx_headroom); |
1262 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1280 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1263 | memset(mgmt, 0, 24); | 1281 | memset(mgmt, 0, 24); |
1264 | memcpy(mgmt->da, da, ETH_ALEN); | 1282 | memcpy(mgmt->da, da, ETH_ALEN); |
1265 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1283 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
1266 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 1284 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) |
1267 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); | 1285 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
1268 | else | 1286 | else |
1269 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 1287 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
1270 | 1288 | ||
1271 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 1289 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1272 | IEEE80211_STYPE_ACTION); | 1290 | IEEE80211_STYPE_ACTION); |
1273 | 1291 | ||
1274 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req)); | 1292 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req)); |
1275 | 1293 | ||
@@ -1287,14 +1305,13 @@ void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, | |||
1287 | mgmt->u.action.u.addba_req.start_seq_num = | 1305 | mgmt->u.action.u.addba_req.start_seq_num = |
1288 | cpu_to_le16(start_seq_num << 4); | 1306 | cpu_to_le16(start_seq_num << 4); |
1289 | 1307 | ||
1290 | ieee80211_sta_tx(dev, skb, 0); | 1308 | ieee80211_sta_tx(sdata, skb, 0); |
1291 | } | 1309 | } |
1292 | 1310 | ||
1293 | static void ieee80211_sta_process_addba_request(struct net_device *dev, | 1311 | static void ieee80211_sta_process_addba_request(struct ieee80211_local *local, |
1294 | struct ieee80211_mgmt *mgmt, | 1312 | struct ieee80211_mgmt *mgmt, |
1295 | size_t len) | 1313 | size_t len) |
1296 | { | 1314 | { |
1297 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1298 | struct ieee80211_hw *hw = &local->hw; | 1315 | struct ieee80211_hw *hw = &local->hw; |
1299 | struct ieee80211_conf *conf = &hw->conf; | 1316 | struct ieee80211_conf *conf = &hw->conf; |
1300 | struct sta_info *sta; | 1317 | struct sta_info *sta; |
@@ -1426,16 +1443,15 @@ end: | |||
1426 | spin_unlock_bh(&sta->lock); | 1443 | spin_unlock_bh(&sta->lock); |
1427 | 1444 | ||
1428 | end_no_lock: | 1445 | end_no_lock: |
1429 | ieee80211_send_addba_resp(sta->sdata->dev, sta->addr, tid, | 1446 | ieee80211_send_addba_resp(sta->sdata, sta->addr, tid, |
1430 | dialog_token, status, 1, buf_size, timeout); | 1447 | dialog_token, status, 1, buf_size, timeout); |
1431 | rcu_read_unlock(); | 1448 | rcu_read_unlock(); |
1432 | } | 1449 | } |
1433 | 1450 | ||
1434 | static void ieee80211_sta_process_addba_resp(struct net_device *dev, | 1451 | static void ieee80211_sta_process_addba_resp(struct ieee80211_local *local, |
1435 | struct ieee80211_mgmt *mgmt, | 1452 | struct ieee80211_mgmt *mgmt, |
1436 | size_t len) | 1453 | size_t len) |
1437 | { | 1454 | { |
1438 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1439 | struct ieee80211_hw *hw = &local->hw; | 1455 | struct ieee80211_hw *hw = &local->hw; |
1440 | struct sta_info *sta; | 1456 | struct sta_info *sta; |
1441 | u16 capab; | 1457 | u16 capab; |
@@ -1497,11 +1513,10 @@ addba_resp_exit: | |||
1497 | rcu_read_unlock(); | 1513 | rcu_read_unlock(); |
1498 | } | 1514 | } |
1499 | 1515 | ||
1500 | void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | 1516 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, const u8 *da, u16 tid, |
1501 | u16 initiator, u16 reason_code) | 1517 | u16 initiator, u16 reason_code) |
1502 | { | 1518 | { |
1503 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1519 | struct ieee80211_local *local = sdata->local; |
1504 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1505 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 1520 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
1506 | struct sk_buff *skb; | 1521 | struct sk_buff *skb; |
1507 | struct ieee80211_mgmt *mgmt; | 1522 | struct ieee80211_mgmt *mgmt; |
@@ -1511,7 +1526,7 @@ void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | |||
1511 | 1526 | ||
1512 | if (!skb) { | 1527 | if (!skb) { |
1513 | printk(KERN_ERR "%s: failed to allocate buffer " | 1528 | printk(KERN_ERR "%s: failed to allocate buffer " |
1514 | "for delba frame\n", dev->name); | 1529 | "for delba frame\n", sdata->dev->name); |
1515 | return; | 1530 | return; |
1516 | } | 1531 | } |
1517 | 1532 | ||
@@ -1519,13 +1534,13 @@ void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | |||
1519 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1534 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1520 | memset(mgmt, 0, 24); | 1535 | memset(mgmt, 0, 24); |
1521 | memcpy(mgmt->da, da, ETH_ALEN); | 1536 | memcpy(mgmt->da, da, ETH_ALEN); |
1522 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1537 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
1523 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 1538 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) |
1524 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); | 1539 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
1525 | else | 1540 | else |
1526 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 1541 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
1527 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 1542 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1528 | IEEE80211_STYPE_ACTION); | 1543 | IEEE80211_STYPE_ACTION); |
1529 | 1544 | ||
1530 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.delba)); | 1545 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.delba)); |
1531 | 1546 | ||
@@ -1537,12 +1552,12 @@ void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | |||
1537 | mgmt->u.action.u.delba.params = cpu_to_le16(params); | 1552 | mgmt->u.action.u.delba.params = cpu_to_le16(params); |
1538 | mgmt->u.action.u.delba.reason_code = cpu_to_le16(reason_code); | 1553 | mgmt->u.action.u.delba.reason_code = cpu_to_le16(reason_code); |
1539 | 1554 | ||
1540 | ieee80211_sta_tx(dev, skb, 0); | 1555 | ieee80211_sta_tx(sdata, skb, 0); |
1541 | } | 1556 | } |
1542 | 1557 | ||
1543 | void ieee80211_send_bar(struct net_device *dev, u8 *ra, u16 tid, u16 ssn) | 1558 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn) |
1544 | { | 1559 | { |
1545 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1560 | struct ieee80211_local *local = sdata->local; |
1546 | struct sk_buff *skb; | 1561 | struct sk_buff *skb; |
1547 | struct ieee80211_bar *bar; | 1562 | struct ieee80211_bar *bar; |
1548 | u16 bar_control = 0; | 1563 | u16 bar_control = 0; |
@@ -1550,29 +1565,29 @@ void ieee80211_send_bar(struct net_device *dev, u8 *ra, u16 tid, u16 ssn) | |||
1550 | skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); | 1565 | skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); |
1551 | if (!skb) { | 1566 | if (!skb) { |
1552 | printk(KERN_ERR "%s: failed to allocate buffer for " | 1567 | printk(KERN_ERR "%s: failed to allocate buffer for " |
1553 | "bar frame\n", dev->name); | 1568 | "bar frame\n", sdata->dev->name); |
1554 | return; | 1569 | return; |
1555 | } | 1570 | } |
1556 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1571 | skb_reserve(skb, local->hw.extra_tx_headroom); |
1557 | bar = (struct ieee80211_bar *)skb_put(skb, sizeof(*bar)); | 1572 | bar = (struct ieee80211_bar *)skb_put(skb, sizeof(*bar)); |
1558 | memset(bar, 0, sizeof(*bar)); | 1573 | memset(bar, 0, sizeof(*bar)); |
1559 | bar->frame_control = IEEE80211_FC(IEEE80211_FTYPE_CTL, | 1574 | bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | |
1560 | IEEE80211_STYPE_BACK_REQ); | 1575 | IEEE80211_STYPE_BACK_REQ); |
1561 | memcpy(bar->ra, ra, ETH_ALEN); | 1576 | memcpy(bar->ra, ra, ETH_ALEN); |
1562 | memcpy(bar->ta, dev->dev_addr, ETH_ALEN); | 1577 | memcpy(bar->ta, sdata->dev->dev_addr, ETH_ALEN); |
1563 | bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; | 1578 | bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; |
1564 | bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; | 1579 | bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; |
1565 | bar_control |= (u16)(tid << 12); | 1580 | bar_control |= (u16)(tid << 12); |
1566 | bar->control = cpu_to_le16(bar_control); | 1581 | bar->control = cpu_to_le16(bar_control); |
1567 | bar->start_seq_num = cpu_to_le16(ssn); | 1582 | bar->start_seq_num = cpu_to_le16(ssn); |
1568 | 1583 | ||
1569 | ieee80211_sta_tx(dev, skb, 0); | 1584 | ieee80211_sta_tx(sdata, skb, 0); |
1570 | } | 1585 | } |
1571 | 1586 | ||
1572 | void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid, | 1587 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, |
1573 | u16 initiator, u16 reason) | 1588 | u16 initiator, u16 reason) |
1574 | { | 1589 | { |
1575 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1590 | struct ieee80211_local *local = sdata->local; |
1576 | struct ieee80211_hw *hw = &local->hw; | 1591 | struct ieee80211_hw *hw = &local->hw; |
1577 | struct sta_info *sta; | 1592 | struct sta_info *sta; |
1578 | int ret, i; | 1593 | int ret, i; |
@@ -1620,7 +1635,7 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid, | |||
1620 | 1635 | ||
1621 | /* check if this is a self generated aggregation halt */ | 1636 | /* check if this is a self generated aggregation halt */ |
1622 | if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER) | 1637 | if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER) |
1623 | ieee80211_send_delba(dev, ra, tid, 0, reason); | 1638 | ieee80211_send_delba(sdata, ra, tid, 0, reason); |
1624 | 1639 | ||
1625 | /* free the reordering buffer */ | 1640 | /* free the reordering buffer */ |
1626 | for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) { | 1641 | for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) { |
@@ -1641,10 +1656,10 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid, | |||
1641 | } | 1656 | } |
1642 | 1657 | ||
1643 | 1658 | ||
1644 | static void ieee80211_sta_process_delba(struct net_device *dev, | 1659 | static void ieee80211_sta_process_delba(struct ieee80211_sub_if_data *sdata, |
1645 | struct ieee80211_mgmt *mgmt, size_t len) | 1660 | struct ieee80211_mgmt *mgmt, size_t len) |
1646 | { | 1661 | { |
1647 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1662 | struct ieee80211_local *local = sdata->local; |
1648 | struct sta_info *sta; | 1663 | struct sta_info *sta; |
1649 | u16 tid, params; | 1664 | u16 tid, params; |
1650 | u16 initiator; | 1665 | u16 initiator; |
@@ -1671,7 +1686,7 @@ static void ieee80211_sta_process_delba(struct net_device *dev, | |||
1671 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 1686 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
1672 | 1687 | ||
1673 | if (initiator == WLAN_BACK_INITIATOR) | 1688 | if (initiator == WLAN_BACK_INITIATOR) |
1674 | ieee80211_sta_stop_rx_ba_session(dev, sta->addr, tid, | 1689 | ieee80211_sta_stop_rx_ba_session(sdata, sta->addr, tid, |
1675 | WLAN_BACK_INITIATOR, 0); | 1690 | WLAN_BACK_INITIATOR, 0); |
1676 | else { /* WLAN_BACK_RECIPIENT */ | 1691 | else { /* WLAN_BACK_RECIPIENT */ |
1677 | spin_lock_bh(&sta->lock); | 1692 | spin_lock_bh(&sta->lock); |
@@ -1758,31 +1773,31 @@ static void sta_rx_agg_session_timer_expired(unsigned long data) | |||
1758 | #ifdef CONFIG_MAC80211_HT_DEBUG | 1773 | #ifdef CONFIG_MAC80211_HT_DEBUG |
1759 | printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); | 1774 | printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); |
1760 | #endif | 1775 | #endif |
1761 | ieee80211_sta_stop_rx_ba_session(sta->sdata->dev, sta->addr, | 1776 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->addr, |
1762 | (u16)*ptid, WLAN_BACK_TIMER, | 1777 | (u16)*ptid, WLAN_BACK_TIMER, |
1763 | WLAN_REASON_QSTA_TIMEOUT); | 1778 | WLAN_REASON_QSTA_TIMEOUT); |
1764 | } | 1779 | } |
1765 | 1780 | ||
1766 | void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr) | 1781 | void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr) |
1767 | { | 1782 | { |
1768 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1783 | struct ieee80211_local *local = sdata->local; |
1769 | int i; | 1784 | int i; |
1770 | 1785 | ||
1771 | for (i = 0; i < STA_TID_NUM; i++) { | 1786 | for (i = 0; i < STA_TID_NUM; i++) { |
1772 | ieee80211_stop_tx_ba_session(&local->hw, addr, i, | 1787 | ieee80211_stop_tx_ba_session(&local->hw, addr, i, |
1773 | WLAN_BACK_INITIATOR); | 1788 | WLAN_BACK_INITIATOR); |
1774 | ieee80211_sta_stop_rx_ba_session(dev, addr, i, | 1789 | ieee80211_sta_stop_rx_ba_session(sdata, addr, i, |
1775 | WLAN_BACK_RECIPIENT, | 1790 | WLAN_BACK_RECIPIENT, |
1776 | WLAN_REASON_QSTA_LEAVE_QBSS); | 1791 | WLAN_REASON_QSTA_LEAVE_QBSS); |
1777 | } | 1792 | } |
1778 | } | 1793 | } |
1779 | 1794 | ||
1780 | static void ieee80211_send_refuse_measurement_request(struct net_device *dev, | 1795 | static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_data *sdata, |
1781 | struct ieee80211_msrment_ie *request_ie, | 1796 | struct ieee80211_msrment_ie *request_ie, |
1782 | const u8 *da, const u8 *bssid, | 1797 | const u8 *da, const u8 *bssid, |
1783 | u8 dialog_token) | 1798 | u8 dialog_token) |
1784 | { | 1799 | { |
1785 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1800 | struct ieee80211_local *local = sdata->local; |
1786 | struct sk_buff *skb; | 1801 | struct sk_buff *skb; |
1787 | struct ieee80211_mgmt *msr_report; | 1802 | struct ieee80211_mgmt *msr_report; |
1788 | 1803 | ||
@@ -1791,7 +1806,7 @@ static void ieee80211_send_refuse_measurement_request(struct net_device *dev, | |||
1791 | 1806 | ||
1792 | if (!skb) { | 1807 | if (!skb) { |
1793 | printk(KERN_ERR "%s: failed to allocate buffer for " | 1808 | printk(KERN_ERR "%s: failed to allocate buffer for " |
1794 | "measurement report frame\n", dev->name); | 1809 | "measurement report frame\n", sdata->dev->name); |
1795 | return; | 1810 | return; |
1796 | } | 1811 | } |
1797 | 1812 | ||
@@ -1799,9 +1814,9 @@ static void ieee80211_send_refuse_measurement_request(struct net_device *dev, | |||
1799 | msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24); | 1814 | msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24); |
1800 | memset(msr_report, 0, 24); | 1815 | memset(msr_report, 0, 24); |
1801 | memcpy(msr_report->da, da, ETH_ALEN); | 1816 | memcpy(msr_report->da, da, ETH_ALEN); |
1802 | memcpy(msr_report->sa, dev->dev_addr, ETH_ALEN); | 1817 | memcpy(msr_report->sa, sdata->dev->dev_addr, ETH_ALEN); |
1803 | memcpy(msr_report->bssid, bssid, ETH_ALEN); | 1818 | memcpy(msr_report->bssid, bssid, ETH_ALEN); |
1804 | msr_report->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 1819 | msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1805 | IEEE80211_STYPE_ACTION); | 1820 | IEEE80211_STYPE_ACTION); |
1806 | 1821 | ||
1807 | skb_put(skb, 1 + sizeof(msr_report->u.action.u.measurement)); | 1822 | skb_put(skb, 1 + sizeof(msr_report->u.action.u.measurement)); |
@@ -1821,10 +1836,10 @@ static void ieee80211_send_refuse_measurement_request(struct net_device *dev, | |||
1821 | IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED; | 1836 | IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED; |
1822 | msr_report->u.action.u.measurement.msr_elem.type = request_ie->type; | 1837 | msr_report->u.action.u.measurement.msr_elem.type = request_ie->type; |
1823 | 1838 | ||
1824 | ieee80211_sta_tx(dev, skb, 0); | 1839 | ieee80211_sta_tx(sdata, skb, 0); |
1825 | } | 1840 | } |
1826 | 1841 | ||
1827 | static void ieee80211_sta_process_measurement_req(struct net_device *dev, | 1842 | static void ieee80211_sta_process_measurement_req(struct ieee80211_sub_if_data *sdata, |
1828 | struct ieee80211_mgmt *mgmt, | 1843 | struct ieee80211_mgmt *mgmt, |
1829 | size_t len) | 1844 | size_t len) |
1830 | { | 1845 | { |
@@ -1835,23 +1850,22 @@ static void ieee80211_sta_process_measurement_req(struct net_device *dev, | |||
1835 | * For now just refuse | 1850 | * For now just refuse |
1836 | * TODO: Answer basic measurement as unmeasured | 1851 | * TODO: Answer basic measurement as unmeasured |
1837 | */ | 1852 | */ |
1838 | ieee80211_send_refuse_measurement_request(dev, | 1853 | ieee80211_send_refuse_measurement_request(sdata, |
1839 | &mgmt->u.action.u.measurement.msr_elem, | 1854 | &mgmt->u.action.u.measurement.msr_elem, |
1840 | mgmt->sa, mgmt->bssid, | 1855 | mgmt->sa, mgmt->bssid, |
1841 | mgmt->u.action.u.measurement.dialog_token); | 1856 | mgmt->u.action.u.measurement.dialog_token); |
1842 | } | 1857 | } |
1843 | 1858 | ||
1844 | 1859 | ||
1845 | static void ieee80211_rx_mgmt_auth(struct net_device *dev, | 1860 | static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, |
1846 | struct ieee80211_if_sta *ifsta, | 1861 | struct ieee80211_if_sta *ifsta, |
1847 | struct ieee80211_mgmt *mgmt, | 1862 | struct ieee80211_mgmt *mgmt, |
1848 | size_t len) | 1863 | size_t len) |
1849 | { | 1864 | { |
1850 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1851 | u16 auth_alg, auth_transaction, status_code; | 1865 | u16 auth_alg, auth_transaction, status_code; |
1852 | DECLARE_MAC_BUF(mac); | 1866 | DECLARE_MAC_BUF(mac); |
1853 | 1867 | ||
1854 | if (ifsta->state != IEEE80211_AUTHENTICATE && | 1868 | if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && |
1855 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 1869 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) |
1856 | return; | 1870 | return; |
1857 | 1871 | ||
@@ -1879,7 +1893,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1879 | */ | 1893 | */ |
1880 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) | 1894 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) |
1881 | return; | 1895 | return; |
1882 | ieee80211_send_auth(dev, ifsta, 2, NULL, 0, 0); | 1896 | ieee80211_send_auth(sdata, ifsta, 2, NULL, 0, 0); |
1883 | } | 1897 | } |
1884 | 1898 | ||
1885 | if (auth_alg != ifsta->auth_alg || | 1899 | if (auth_alg != ifsta->auth_alg || |
@@ -1912,7 +1926,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1912 | algs[pos] == 0xff) | 1926 | algs[pos] == 0xff) |
1913 | continue; | 1927 | continue; |
1914 | if (algs[pos] == WLAN_AUTH_SHARED_KEY && | 1928 | if (algs[pos] == WLAN_AUTH_SHARED_KEY && |
1915 | !ieee80211_sta_wep_configured(dev)) | 1929 | !ieee80211_sta_wep_configured(sdata)) |
1916 | continue; | 1930 | continue; |
1917 | ifsta->auth_alg = algs[pos]; | 1931 | ifsta->auth_alg = algs[pos]; |
1918 | break; | 1932 | break; |
@@ -1924,19 +1938,19 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1924 | switch (ifsta->auth_alg) { | 1938 | switch (ifsta->auth_alg) { |
1925 | case WLAN_AUTH_OPEN: | 1939 | case WLAN_AUTH_OPEN: |
1926 | case WLAN_AUTH_LEAP: | 1940 | case WLAN_AUTH_LEAP: |
1927 | ieee80211_auth_completed(dev, ifsta); | 1941 | ieee80211_auth_completed(sdata, ifsta); |
1928 | break; | 1942 | break; |
1929 | case WLAN_AUTH_SHARED_KEY: | 1943 | case WLAN_AUTH_SHARED_KEY: |
1930 | if (ifsta->auth_transaction == 4) | 1944 | if (ifsta->auth_transaction == 4) |
1931 | ieee80211_auth_completed(dev, ifsta); | 1945 | ieee80211_auth_completed(sdata, ifsta); |
1932 | else | 1946 | else |
1933 | ieee80211_auth_challenge(dev, ifsta, mgmt, len); | 1947 | ieee80211_auth_challenge(sdata, ifsta, mgmt, len); |
1934 | break; | 1948 | break; |
1935 | } | 1949 | } |
1936 | } | 1950 | } |
1937 | 1951 | ||
1938 | 1952 | ||
1939 | static void ieee80211_rx_mgmt_deauth(struct net_device *dev, | 1953 | static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, |
1940 | struct ieee80211_if_sta *ifsta, | 1954 | struct ieee80211_if_sta *ifsta, |
1941 | struct ieee80211_mgmt *mgmt, | 1955 | struct ieee80211_mgmt *mgmt, |
1942 | size_t len) | 1956 | size_t len) |
@@ -1953,22 +1967,22 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev, | |||
1953 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); | 1967 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); |
1954 | 1968 | ||
1955 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) | 1969 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) |
1956 | printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); | 1970 | printk(KERN_DEBUG "%s: deauthenticated\n", sdata->dev->name); |
1957 | 1971 | ||
1958 | if (ifsta->state == IEEE80211_AUTHENTICATE || | 1972 | if (ifsta->state == IEEE80211_STA_MLME_AUTHENTICATE || |
1959 | ifsta->state == IEEE80211_ASSOCIATE || | 1973 | ifsta->state == IEEE80211_STA_MLME_ASSOCIATE || |
1960 | ifsta->state == IEEE80211_ASSOCIATED) { | 1974 | ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) { |
1961 | ifsta->state = IEEE80211_AUTHENTICATE; | 1975 | ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE; |
1962 | mod_timer(&ifsta->timer, jiffies + | 1976 | mod_timer(&ifsta->timer, jiffies + |
1963 | IEEE80211_RETRY_AUTH_INTERVAL); | 1977 | IEEE80211_RETRY_AUTH_INTERVAL); |
1964 | } | 1978 | } |
1965 | 1979 | ||
1966 | ieee80211_set_disassoc(dev, ifsta, 1); | 1980 | ieee80211_set_disassoc(sdata, ifsta, 1); |
1967 | ifsta->flags &= ~IEEE80211_STA_AUTHENTICATED; | 1981 | ifsta->flags &= ~IEEE80211_STA_AUTHENTICATED; |
1968 | } | 1982 | } |
1969 | 1983 | ||
1970 | 1984 | ||
1971 | static void ieee80211_rx_mgmt_disassoc(struct net_device *dev, | 1985 | static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, |
1972 | struct ieee80211_if_sta *ifsta, | 1986 | struct ieee80211_if_sta *ifsta, |
1973 | struct ieee80211_mgmt *mgmt, | 1987 | struct ieee80211_mgmt *mgmt, |
1974 | size_t len) | 1988 | size_t len) |
@@ -1985,15 +1999,15 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev, | |||
1985 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 1999 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
1986 | 2000 | ||
1987 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) | 2001 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) |
1988 | printk(KERN_DEBUG "%s: disassociated\n", dev->name); | 2002 | printk(KERN_DEBUG "%s: disassociated\n", sdata->dev->name); |
1989 | 2003 | ||
1990 | if (ifsta->state == IEEE80211_ASSOCIATED) { | 2004 | if (ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) { |
1991 | ifsta->state = IEEE80211_ASSOCIATE; | 2005 | ifsta->state = IEEE80211_STA_MLME_ASSOCIATE; |
1992 | mod_timer(&ifsta->timer, jiffies + | 2006 | mod_timer(&ifsta->timer, jiffies + |
1993 | IEEE80211_RETRY_AUTH_INTERVAL); | 2007 | IEEE80211_RETRY_AUTH_INTERVAL); |
1994 | } | 2008 | } |
1995 | 2009 | ||
1996 | ieee80211_set_disassoc(dev, ifsta, 0); | 2010 | ieee80211_set_disassoc(sdata, ifsta, 0); |
1997 | } | 2011 | } |
1998 | 2012 | ||
1999 | 2013 | ||
@@ -2004,7 +2018,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2004 | int reassoc) | 2018 | int reassoc) |
2005 | { | 2019 | { |
2006 | struct ieee80211_local *local = sdata->local; | 2020 | struct ieee80211_local *local = sdata->local; |
2007 | struct net_device *dev = sdata->dev; | ||
2008 | struct ieee80211_supported_band *sband; | 2021 | struct ieee80211_supported_band *sband; |
2009 | struct sta_info *sta; | 2022 | struct sta_info *sta; |
2010 | u64 rates, basic_rates; | 2023 | u64 rates, basic_rates; |
@@ -2019,7 +2032,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2019 | /* AssocResp and ReassocResp have identical structure, so process both | 2032 | /* AssocResp and ReassocResp have identical structure, so process both |
2020 | * of them in this function. */ | 2033 | * of them in this function. */ |
2021 | 2034 | ||
2022 | if (ifsta->state != IEEE80211_ASSOCIATE) | 2035 | if (ifsta->state != IEEE80211_STA_MLME_ASSOCIATE) |
2023 | return; | 2036 | return; |
2024 | 2037 | ||
2025 | if (len < 24 + 6) | 2038 | if (len < 24 + 6) |
@@ -2034,12 +2047,12 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2034 | 2047 | ||
2035 | printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " | 2048 | printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " |
2036 | "status=%d aid=%d)\n", | 2049 | "status=%d aid=%d)\n", |
2037 | dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), | 2050 | sdata->dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), |
2038 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); | 2051 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); |
2039 | 2052 | ||
2040 | if (status_code != WLAN_STATUS_SUCCESS) { | 2053 | if (status_code != WLAN_STATUS_SUCCESS) { |
2041 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", | 2054 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", |
2042 | dev->name, status_code); | 2055 | sdata->dev->name, status_code); |
2043 | /* if this was a reassociation, ensure we try a "full" | 2056 | /* if this was a reassociation, ensure we try a "full" |
2044 | * association next time. This works around some broken APs | 2057 | * association next time. This works around some broken APs |
2045 | * which do not correctly reject reassociation requests. */ | 2058 | * which do not correctly reject reassociation requests. */ |
@@ -2049,7 +2062,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2049 | 2062 | ||
2050 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) | 2063 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) |
2051 | printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not " | 2064 | printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not " |
2052 | "set\n", dev->name, aid); | 2065 | "set\n", sdata->dev->name, aid); |
2053 | aid &= ~(BIT(15) | BIT(14)); | 2066 | aid &= ~(BIT(15) | BIT(14)); |
2054 | 2067 | ||
2055 | pos = mgmt->u.assoc_resp.variable; | 2068 | pos = mgmt->u.assoc_resp.variable; |
@@ -2057,11 +2070,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2057 | 2070 | ||
2058 | if (!elems.supp_rates) { | 2071 | if (!elems.supp_rates) { |
2059 | printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n", | 2072 | printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n", |
2060 | dev->name); | 2073 | sdata->dev->name); |
2061 | return; | 2074 | return; |
2062 | } | 2075 | } |
2063 | 2076 | ||
2064 | printk(KERN_DEBUG "%s: associated\n", dev->name); | 2077 | printk(KERN_DEBUG "%s: associated\n", sdata->dev->name); |
2065 | ifsta->aid = aid; | 2078 | ifsta->aid = aid; |
2066 | ifsta->ap_capab = capab_info; | 2079 | ifsta->ap_capab = capab_info; |
2067 | 2080 | ||
@@ -2082,11 +2095,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2082 | sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); | 2095 | sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); |
2083 | if (!sta) { | 2096 | if (!sta) { |
2084 | printk(KERN_DEBUG "%s: failed to alloc STA entry for" | 2097 | printk(KERN_DEBUG "%s: failed to alloc STA entry for" |
2085 | " the AP\n", dev->name); | 2098 | " the AP\n", sdata->dev->name); |
2086 | rcu_read_unlock(); | 2099 | rcu_read_unlock(); |
2087 | return; | 2100 | return; |
2088 | } | 2101 | } |
2089 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 2102 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
2090 | local->hw.conf.channel->center_freq, | 2103 | local->hw.conf.channel->center_freq, |
2091 | ifsta->ssid, ifsta->ssid_len); | 2104 | ifsta->ssid, ifsta->ssid_len); |
2092 | if (bss) { | 2105 | if (bss) { |
@@ -2099,7 +2112,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2099 | err = sta_info_insert(sta); | 2112 | err = sta_info_insert(sta); |
2100 | if (err) { | 2113 | if (err) { |
2101 | printk(KERN_DEBUG "%s: failed to insert STA entry for" | 2114 | printk(KERN_DEBUG "%s: failed to insert STA entry for" |
2102 | " the AP (error %d)\n", dev->name, err); | 2115 | " the AP (error %d)\n", sdata->dev->name, err); |
2103 | rcu_read_unlock(); | 2116 | rcu_read_unlock(); |
2104 | return; | 2117 | return; |
2105 | } | 2118 | } |
@@ -2179,7 +2192,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2179 | if (elems.wmm_param) { | 2192 | if (elems.wmm_param) { |
2180 | set_sta_flags(sta, WLAN_STA_WME); | 2193 | set_sta_flags(sta, WLAN_STA_WME); |
2181 | rcu_read_unlock(); | 2194 | rcu_read_unlock(); |
2182 | ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, | 2195 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, |
2183 | elems.wmm_param_len); | 2196 | elems.wmm_param_len); |
2184 | } else | 2197 | } else |
2185 | rcu_read_unlock(); | 2198 | rcu_read_unlock(); |
@@ -2188,17 +2201,16 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2188 | * ieee80211_set_associated() will tell the driver */ | 2201 | * ieee80211_set_associated() will tell the driver */ |
2189 | bss_conf->aid = aid; | 2202 | bss_conf->aid = aid; |
2190 | bss_conf->assoc_capability = capab_info; | 2203 | bss_conf->assoc_capability = capab_info; |
2191 | ieee80211_set_associated(dev, ifsta, 1); | 2204 | ieee80211_set_associated(sdata, ifsta, 1); |
2192 | 2205 | ||
2193 | ieee80211_associated(dev, ifsta); | 2206 | ieee80211_associated(sdata, ifsta); |
2194 | } | 2207 | } |
2195 | 2208 | ||
2196 | 2209 | ||
2197 | /* Caller must hold local->sta_bss_lock */ | 2210 | /* Caller must hold local->sta_bss_lock */ |
2198 | static void __ieee80211_rx_bss_hash_add(struct net_device *dev, | 2211 | static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local, |
2199 | struct ieee80211_sta_bss *bss) | 2212 | struct ieee80211_sta_bss *bss) |
2200 | { | 2213 | { |
2201 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
2202 | u8 hash_idx; | 2214 | u8 hash_idx; |
2203 | 2215 | ||
2204 | if (bss_mesh_cfg(bss)) | 2216 | if (bss_mesh_cfg(bss)) |
@@ -2234,10 +2246,10 @@ static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local, | |||
2234 | 2246 | ||
2235 | 2247 | ||
2236 | static struct ieee80211_sta_bss * | 2248 | static struct ieee80211_sta_bss * |
2237 | ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int freq, | 2249 | ieee80211_rx_bss_add(struct ieee80211_sub_if_data *sdata, u8 *bssid, int freq, |
2238 | u8 *ssid, u8 ssid_len) | 2250 | u8 *ssid, u8 ssid_len) |
2239 | { | 2251 | { |
2240 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2252 | struct ieee80211_local *local = sdata->local; |
2241 | struct ieee80211_sta_bss *bss; | 2253 | struct ieee80211_sta_bss *bss; |
2242 | 2254 | ||
2243 | bss = kzalloc(sizeof(*bss), GFP_ATOMIC); | 2255 | bss = kzalloc(sizeof(*bss), GFP_ATOMIC); |
@@ -2255,16 +2267,15 @@ ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int freq, | |||
2255 | spin_lock_bh(&local->sta_bss_lock); | 2267 | spin_lock_bh(&local->sta_bss_lock); |
2256 | /* TODO: order by RSSI? */ | 2268 | /* TODO: order by RSSI? */ |
2257 | list_add_tail(&bss->list, &local->sta_bss_list); | 2269 | list_add_tail(&bss->list, &local->sta_bss_list); |
2258 | __ieee80211_rx_bss_hash_add(dev, bss); | 2270 | __ieee80211_rx_bss_hash_add(local, bss); |
2259 | spin_unlock_bh(&local->sta_bss_lock); | 2271 | spin_unlock_bh(&local->sta_bss_lock); |
2260 | return bss; | 2272 | return bss; |
2261 | } | 2273 | } |
2262 | 2274 | ||
2263 | static struct ieee80211_sta_bss * | 2275 | static struct ieee80211_sta_bss * |
2264 | ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int freq, | 2276 | ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, |
2265 | u8 *ssid, u8 ssid_len) | 2277 | u8 *ssid, u8 ssid_len) |
2266 | { | 2278 | { |
2267 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
2268 | struct ieee80211_sta_bss *bss; | 2279 | struct ieee80211_sta_bss *bss; |
2269 | 2280 | ||
2270 | spin_lock_bh(&local->sta_bss_lock); | 2281 | spin_lock_bh(&local->sta_bss_lock); |
@@ -2286,10 +2297,9 @@ ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int freq, | |||
2286 | 2297 | ||
2287 | #ifdef CONFIG_MAC80211_MESH | 2298 | #ifdef CONFIG_MAC80211_MESH |
2288 | static struct ieee80211_sta_bss * | 2299 | static struct ieee80211_sta_bss * |
2289 | ieee80211_rx_mesh_bss_get(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | 2300 | ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, |
2290 | u8 *mesh_cfg, int freq) | 2301 | u8 *mesh_cfg, int freq) |
2291 | { | 2302 | { |
2292 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
2293 | struct ieee80211_sta_bss *bss; | 2303 | struct ieee80211_sta_bss *bss; |
2294 | 2304 | ||
2295 | spin_lock_bh(&local->sta_bss_lock); | 2305 | spin_lock_bh(&local->sta_bss_lock); |
@@ -2311,10 +2321,9 @@ ieee80211_rx_mesh_bss_get(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | |||
2311 | } | 2321 | } |
2312 | 2322 | ||
2313 | static struct ieee80211_sta_bss * | 2323 | static struct ieee80211_sta_bss * |
2314 | ieee80211_rx_mesh_bss_add(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | 2324 | ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, |
2315 | u8 *mesh_cfg, int mesh_config_len, int freq) | 2325 | u8 *mesh_cfg, int mesh_config_len, int freq) |
2316 | { | 2326 | { |
2317 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
2318 | struct ieee80211_sta_bss *bss; | 2327 | struct ieee80211_sta_bss *bss; |
2319 | 2328 | ||
2320 | if (mesh_config_len != MESH_CFG_LEN) | 2329 | if (mesh_config_len != MESH_CFG_LEN) |
@@ -2348,7 +2357,7 @@ ieee80211_rx_mesh_bss_add(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | |||
2348 | spin_lock_bh(&local->sta_bss_lock); | 2357 | spin_lock_bh(&local->sta_bss_lock); |
2349 | /* TODO: order by RSSI? */ | 2358 | /* TODO: order by RSSI? */ |
2350 | list_add_tail(&bss->list, &local->sta_bss_list); | 2359 | list_add_tail(&bss->list, &local->sta_bss_list); |
2351 | __ieee80211_rx_bss_hash_add(dev, bss); | 2360 | __ieee80211_rx_bss_hash_add(local, bss); |
2352 | spin_unlock_bh(&local->sta_bss_lock); | 2361 | spin_unlock_bh(&local->sta_bss_lock); |
2353 | return bss; | 2362 | return bss; |
2354 | } | 2363 | } |
@@ -2356,11 +2365,7 @@ ieee80211_rx_mesh_bss_add(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | |||
2356 | 2365 | ||
2357 | static void ieee80211_rx_bss_free(struct ieee80211_sta_bss *bss) | 2366 | static void ieee80211_rx_bss_free(struct ieee80211_sta_bss *bss) |
2358 | { | 2367 | { |
2359 | kfree(bss->wpa_ie); | 2368 | kfree(bss->ies); |
2360 | kfree(bss->rsn_ie); | ||
2361 | kfree(bss->wmm_ie); | ||
2362 | kfree(bss->ht_ie); | ||
2363 | kfree(bss->ht_add_ie); | ||
2364 | kfree(bss_mesh_id(bss)); | 2369 | kfree(bss_mesh_id(bss)); |
2365 | kfree(bss_mesh_cfg(bss)); | 2370 | kfree(bss_mesh_cfg(bss)); |
2366 | kfree(bss); | 2371 | kfree(bss); |
@@ -2399,23 +2404,20 @@ void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local) | |||
2399 | } | 2404 | } |
2400 | 2405 | ||
2401 | 2406 | ||
2402 | static int ieee80211_sta_join_ibss(struct net_device *dev, | 2407 | static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, |
2403 | struct ieee80211_if_sta *ifsta, | 2408 | struct ieee80211_if_sta *ifsta, |
2404 | struct ieee80211_sta_bss *bss) | 2409 | struct ieee80211_sta_bss *bss) |
2405 | { | 2410 | { |
2406 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2411 | struct ieee80211_local *local = sdata->local; |
2407 | int res, rates, i, j; | 2412 | int res, rates, i, j; |
2408 | struct sk_buff *skb; | 2413 | struct sk_buff *skb; |
2409 | struct ieee80211_mgmt *mgmt; | 2414 | struct ieee80211_mgmt *mgmt; |
2410 | u8 *pos; | 2415 | u8 *pos; |
2411 | struct ieee80211_sub_if_data *sdata; | ||
2412 | struct ieee80211_supported_band *sband; | 2416 | struct ieee80211_supported_band *sband; |
2413 | union iwreq_data wrqu; | 2417 | union iwreq_data wrqu; |
2414 | 2418 | ||
2415 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2419 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
2416 | 2420 | ||
2417 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2418 | |||
2419 | /* Remove possible STA entries from other IBSS networks. */ | 2421 | /* Remove possible STA entries from other IBSS networks. */ |
2420 | sta_info_flush_delayed(sdata); | 2422 | sta_info_flush_delayed(sdata); |
2421 | 2423 | ||
@@ -2433,7 +2435,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2433 | sdata->drop_unencrypted = bss->capability & | 2435 | sdata->drop_unencrypted = bss->capability & |
2434 | WLAN_CAPABILITY_PRIVACY ? 1 : 0; | 2436 | WLAN_CAPABILITY_PRIVACY ? 1 : 0; |
2435 | 2437 | ||
2436 | res = ieee80211_set_freq(dev, bss->freq); | 2438 | res = ieee80211_set_freq(sdata, bss->freq); |
2437 | 2439 | ||
2438 | if (res) | 2440 | if (res) |
2439 | return res; | 2441 | return res; |
@@ -2446,10 +2448,10 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2446 | mgmt = (struct ieee80211_mgmt *) | 2448 | mgmt = (struct ieee80211_mgmt *) |
2447 | skb_put(skb, 24 + sizeof(mgmt->u.beacon)); | 2449 | skb_put(skb, 24 + sizeof(mgmt->u.beacon)); |
2448 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); | 2450 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); |
2449 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | 2451 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
2450 | IEEE80211_STYPE_PROBE_RESP); | 2452 | IEEE80211_STYPE_PROBE_RESP); |
2451 | memset(mgmt->da, 0xff, ETH_ALEN); | 2453 | memset(mgmt->da, 0xff, ETH_ALEN); |
2452 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 2454 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
2453 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 2455 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
2454 | mgmt->u.beacon.beacon_int = | 2456 | mgmt->u.beacon.beacon_int = |
2455 | cpu_to_le16(local->hw.conf.beacon_int); | 2457 | cpu_to_le16(local->hw.conf.beacon_int); |
@@ -2506,14 +2508,14 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2506 | } | 2508 | } |
2507 | ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates; | 2509 | ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates; |
2508 | 2510 | ||
2509 | ieee80211_sta_def_wmm_params(dev, bss, 1); | 2511 | ieee80211_sta_def_wmm_params(sdata, bss, 1); |
2510 | 2512 | ||
2511 | ifsta->state = IEEE80211_IBSS_JOINED; | 2513 | ifsta->state = IEEE80211_STA_MLME_IBSS_JOINED; |
2512 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); | 2514 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); |
2513 | 2515 | ||
2514 | memset(&wrqu, 0, sizeof(wrqu)); | 2516 | memset(&wrqu, 0, sizeof(wrqu)); |
2515 | memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN); | 2517 | memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN); |
2516 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | 2518 | wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL); |
2517 | 2519 | ||
2518 | return res; | 2520 | return res; |
2519 | } | 2521 | } |
@@ -2554,55 +2556,91 @@ u64 ieee80211_sta_get_rates(struct ieee80211_local *local, | |||
2554 | return supp_rates; | 2556 | return supp_rates; |
2555 | } | 2557 | } |
2556 | 2558 | ||
2559 | static u64 ieee80211_sta_get_mandatory_rates(struct ieee80211_local *local, | ||
2560 | enum ieee80211_band band) | ||
2561 | { | ||
2562 | struct ieee80211_supported_band *sband; | ||
2563 | struct ieee80211_rate *bitrates; | ||
2564 | u64 mandatory_rates; | ||
2565 | enum ieee80211_rate_flags mandatory_flag; | ||
2566 | int i; | ||
2567 | |||
2568 | sband = local->hw.wiphy->bands[band]; | ||
2569 | if (!sband) { | ||
2570 | WARN_ON(1); | ||
2571 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
2572 | } | ||
2557 | 2573 | ||
2558 | static void ieee80211_rx_bss_info(struct net_device *dev, | 2574 | if (band == IEEE80211_BAND_2GHZ) |
2575 | mandatory_flag = IEEE80211_RATE_MANDATORY_B; | ||
2576 | else | ||
2577 | mandatory_flag = IEEE80211_RATE_MANDATORY_A; | ||
2578 | |||
2579 | bitrates = sband->bitrates; | ||
2580 | mandatory_rates = 0; | ||
2581 | for (i = 0; i < sband->n_bitrates; i++) | ||
2582 | if (bitrates[i].flags & mandatory_flag) | ||
2583 | mandatory_rates |= BIT(i); | ||
2584 | return mandatory_rates; | ||
2585 | } | ||
2586 | |||
2587 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | ||
2559 | struct ieee80211_mgmt *mgmt, | 2588 | struct ieee80211_mgmt *mgmt, |
2560 | size_t len, | 2589 | size_t len, |
2561 | struct ieee80211_rx_status *rx_status, | 2590 | struct ieee80211_rx_status *rx_status, |
2562 | struct ieee802_11_elems *elems, | 2591 | struct ieee802_11_elems *elems) |
2563 | int beacon) | ||
2564 | { | 2592 | { |
2565 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2593 | struct ieee80211_local *local = sdata->local; |
2566 | int freq, clen; | 2594 | int freq, clen; |
2567 | struct ieee80211_sta_bss *bss; | 2595 | struct ieee80211_sta_bss *bss; |
2568 | struct sta_info *sta; | 2596 | struct sta_info *sta; |
2569 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2570 | u64 beacon_timestamp, rx_timestamp; | ||
2571 | struct ieee80211_channel *channel; | 2597 | struct ieee80211_channel *channel; |
2598 | u64 beacon_timestamp, rx_timestamp; | ||
2599 | u64 supp_rates = 0; | ||
2600 | bool beacon = ieee80211_is_beacon(mgmt->frame_control); | ||
2601 | enum ieee80211_band band = rx_status->band; | ||
2572 | DECLARE_MAC_BUF(mac); | 2602 | DECLARE_MAC_BUF(mac); |
2573 | DECLARE_MAC_BUF(mac2); | 2603 | DECLARE_MAC_BUF(mac2); |
2574 | 2604 | ||
2575 | if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN)) | ||
2576 | return; /* ignore ProbeResp to foreign address */ | ||
2577 | |||
2578 | beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); | 2605 | beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); |
2579 | 2606 | ||
2580 | if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id && | 2607 | if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id && |
2581 | elems->mesh_config && mesh_matches_local(elems, dev)) { | 2608 | elems->mesh_config && mesh_matches_local(elems, sdata)) { |
2582 | u64 rates = ieee80211_sta_get_rates(local, elems, | 2609 | supp_rates = ieee80211_sta_get_rates(local, elems, band); |
2583 | rx_status->band); | ||
2584 | 2610 | ||
2585 | mesh_neighbour_update(mgmt->sa, rates, dev, | 2611 | mesh_neighbour_update(mgmt->sa, supp_rates, sdata, |
2586 | mesh_peer_accepts_plinks(elems, dev)); | 2612 | mesh_peer_accepts_plinks(elems)); |
2587 | } | 2613 | } |
2588 | 2614 | ||
2589 | rcu_read_lock(); | 2615 | rcu_read_lock(); |
2590 | 2616 | ||
2591 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems->supp_rates && | 2617 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems->supp_rates && |
2592 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 && | 2618 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) { |
2593 | (sta = sta_info_get(local, mgmt->sa))) { | 2619 | |
2594 | u64 prev_rates; | 2620 | supp_rates = ieee80211_sta_get_rates(local, elems, band); |
2595 | u64 supp_rates = ieee80211_sta_get_rates(local, elems, | 2621 | |
2596 | rx_status->band); | 2622 | sta = sta_info_get(local, mgmt->sa); |
2597 | 2623 | if (sta) { | |
2598 | prev_rates = sta->supp_rates[rx_status->band]; | 2624 | u64 prev_rates; |
2599 | sta->supp_rates[rx_status->band] &= supp_rates; | 2625 | |
2600 | if (sta->supp_rates[rx_status->band] == 0) { | 2626 | prev_rates = sta->supp_rates[band]; |
2601 | /* No matching rates - this should not really happen. | 2627 | /* make sure mandatory rates are always added */ |
2602 | * Make sure that at least one rate is marked | 2628 | sta->supp_rates[band] = supp_rates | |
2603 | * supported to avoid issues with TX rate ctrl. */ | 2629 | ieee80211_sta_get_mandatory_rates(local, band); |
2604 | sta->supp_rates[rx_status->band] = | 2630 | |
2605 | sdata->u.sta.supp_rates_bits[rx_status->band]; | 2631 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2632 | if (sta->supp_rates[band] != prev_rates) | ||
2633 | printk(KERN_DEBUG "%s: updated supp_rates set " | ||
2634 | "for %s based on beacon info (0x%llx | " | ||
2635 | "0x%llx -> 0x%llx)\n", | ||
2636 | sdata->dev->name, print_mac(mac, sta->addr), | ||
2637 | (unsigned long long) prev_rates, | ||
2638 | (unsigned long long) supp_rates, | ||
2639 | (unsigned long long) sta->supp_rates[band]); | ||
2640 | #endif | ||
2641 | } else { | ||
2642 | ieee80211_ibss_add_sta(sdata, NULL, mgmt->bssid, | ||
2643 | mgmt->sa, supp_rates); | ||
2606 | } | 2644 | } |
2607 | } | 2645 | } |
2608 | 2646 | ||
@@ -2620,21 +2658,21 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2620 | 2658 | ||
2621 | #ifdef CONFIG_MAC80211_MESH | 2659 | #ifdef CONFIG_MAC80211_MESH |
2622 | if (elems->mesh_config) | 2660 | if (elems->mesh_config) |
2623 | bss = ieee80211_rx_mesh_bss_get(dev, elems->mesh_id, | 2661 | bss = ieee80211_rx_mesh_bss_get(local, elems->mesh_id, |
2624 | elems->mesh_id_len, elems->mesh_config, freq); | 2662 | elems->mesh_id_len, elems->mesh_config, freq); |
2625 | else | 2663 | else |
2626 | #endif | 2664 | #endif |
2627 | bss = ieee80211_rx_bss_get(dev, mgmt->bssid, freq, | 2665 | bss = ieee80211_rx_bss_get(local, mgmt->bssid, freq, |
2628 | elems->ssid, elems->ssid_len); | 2666 | elems->ssid, elems->ssid_len); |
2629 | if (!bss) { | 2667 | if (!bss) { |
2630 | #ifdef CONFIG_MAC80211_MESH | 2668 | #ifdef CONFIG_MAC80211_MESH |
2631 | if (elems->mesh_config) | 2669 | if (elems->mesh_config) |
2632 | bss = ieee80211_rx_mesh_bss_add(dev, elems->mesh_id, | 2670 | bss = ieee80211_rx_mesh_bss_add(local, elems->mesh_id, |
2633 | elems->mesh_id_len, elems->mesh_config, | 2671 | elems->mesh_id_len, elems->mesh_config, |
2634 | elems->mesh_config_len, freq); | 2672 | elems->mesh_config_len, freq); |
2635 | else | 2673 | else |
2636 | #endif | 2674 | #endif |
2637 | bss = ieee80211_rx_bss_add(dev, mgmt->bssid, freq, | 2675 | bss = ieee80211_rx_bss_add(sdata, mgmt->bssid, freq, |
2638 | elems->ssid, elems->ssid_len); | 2676 | elems->ssid, elems->ssid_len); |
2639 | if (!bss) | 2677 | if (!bss) |
2640 | return; | 2678 | return; |
@@ -2653,43 +2691,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2653 | bss->has_erp_value = 1; | 2691 | bss->has_erp_value = 1; |
2654 | } | 2692 | } |
2655 | 2693 | ||
2656 | if (elems->ht_cap_elem && | ||
2657 | (!bss->ht_ie || bss->ht_ie_len != elems->ht_cap_elem_len || | ||
2658 | memcmp(bss->ht_ie, elems->ht_cap_elem, elems->ht_cap_elem_len))) { | ||
2659 | kfree(bss->ht_ie); | ||
2660 | bss->ht_ie = kmalloc(elems->ht_cap_elem_len + 2, GFP_ATOMIC); | ||
2661 | if (bss->ht_ie) { | ||
2662 | memcpy(bss->ht_ie, elems->ht_cap_elem - 2, | ||
2663 | elems->ht_cap_elem_len + 2); | ||
2664 | bss->ht_ie_len = elems->ht_cap_elem_len + 2; | ||
2665 | } else | ||
2666 | bss->ht_ie_len = 0; | ||
2667 | } else if (!elems->ht_cap_elem && bss->ht_ie) { | ||
2668 | kfree(bss->ht_ie); | ||
2669 | bss->ht_ie = NULL; | ||
2670 | bss->ht_ie_len = 0; | ||
2671 | } | ||
2672 | |||
2673 | if (elems->ht_info_elem && | ||
2674 | (!bss->ht_add_ie || | ||
2675 | bss->ht_add_ie_len != elems->ht_info_elem_len || | ||
2676 | memcmp(bss->ht_add_ie, elems->ht_info_elem, | ||
2677 | elems->ht_info_elem_len))) { | ||
2678 | kfree(bss->ht_add_ie); | ||
2679 | bss->ht_add_ie = | ||
2680 | kmalloc(elems->ht_info_elem_len + 2, GFP_ATOMIC); | ||
2681 | if (bss->ht_add_ie) { | ||
2682 | memcpy(bss->ht_add_ie, elems->ht_info_elem - 2, | ||
2683 | elems->ht_info_elem_len + 2); | ||
2684 | bss->ht_add_ie_len = elems->ht_info_elem_len + 2; | ||
2685 | } else | ||
2686 | bss->ht_add_ie_len = 0; | ||
2687 | } else if (!elems->ht_info_elem && bss->ht_add_ie) { | ||
2688 | kfree(bss->ht_add_ie); | ||
2689 | bss->ht_add_ie = NULL; | ||
2690 | bss->ht_add_ie_len = 0; | ||
2691 | } | ||
2692 | |||
2693 | bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int); | 2694 | bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int); |
2694 | bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info); | 2695 | bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info); |
2695 | 2696 | ||
@@ -2721,108 +2722,36 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2721 | bss->supp_rates_len += clen; | 2722 | bss->supp_rates_len += clen; |
2722 | } | 2723 | } |
2723 | 2724 | ||
2724 | bss->band = rx_status->band; | 2725 | bss->band = band; |
2725 | 2726 | ||
2726 | bss->timestamp = beacon_timestamp; | 2727 | bss->timestamp = beacon_timestamp; |
2727 | bss->last_update = jiffies; | 2728 | bss->last_update = jiffies; |
2728 | bss->signal = rx_status->signal; | 2729 | bss->signal = rx_status->signal; |
2729 | bss->noise = rx_status->noise; | 2730 | bss->noise = rx_status->noise; |
2730 | bss->qual = rx_status->qual; | 2731 | bss->qual = rx_status->qual; |
2731 | if (!beacon && !bss->probe_resp) | 2732 | if (!beacon) |
2732 | bss->probe_resp = true; | 2733 | bss->last_probe_resp = jiffies; |
2733 | |||
2734 | /* | 2734 | /* |
2735 | * In STA mode, the remaining parameters should not be overridden | 2735 | * In STA mode, the remaining parameters should not be overridden |
2736 | * by beacons because they're not necessarily accurate there. | 2736 | * by beacons because they're not necessarily accurate there. |
2737 | */ | 2737 | */ |
2738 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 2738 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && |
2739 | bss->probe_resp && beacon) { | 2739 | bss->last_probe_resp && beacon) { |
2740 | ieee80211_rx_bss_put(local, bss); | 2740 | ieee80211_rx_bss_put(local, bss); |
2741 | return; | 2741 | return; |
2742 | } | 2742 | } |
2743 | 2743 | ||
2744 | if (elems->wpa && | 2744 | if (bss->ies == NULL || bss->ies_len < elems->total_len) { |
2745 | (!bss->wpa_ie || bss->wpa_ie_len != elems->wpa_len || | 2745 | kfree(bss->ies); |
2746 | memcmp(bss->wpa_ie, elems->wpa, elems->wpa_len))) { | 2746 | bss->ies = kmalloc(elems->total_len, GFP_ATOMIC); |
2747 | kfree(bss->wpa_ie); | ||
2748 | bss->wpa_ie = kmalloc(elems->wpa_len + 2, GFP_ATOMIC); | ||
2749 | if (bss->wpa_ie) { | ||
2750 | memcpy(bss->wpa_ie, elems->wpa - 2, elems->wpa_len + 2); | ||
2751 | bss->wpa_ie_len = elems->wpa_len + 2; | ||
2752 | } else | ||
2753 | bss->wpa_ie_len = 0; | ||
2754 | } else if (!elems->wpa && bss->wpa_ie) { | ||
2755 | kfree(bss->wpa_ie); | ||
2756 | bss->wpa_ie = NULL; | ||
2757 | bss->wpa_ie_len = 0; | ||
2758 | } | ||
2759 | |||
2760 | if (elems->rsn && | ||
2761 | (!bss->rsn_ie || bss->rsn_ie_len != elems->rsn_len || | ||
2762 | memcmp(bss->rsn_ie, elems->rsn, elems->rsn_len))) { | ||
2763 | kfree(bss->rsn_ie); | ||
2764 | bss->rsn_ie = kmalloc(elems->rsn_len + 2, GFP_ATOMIC); | ||
2765 | if (bss->rsn_ie) { | ||
2766 | memcpy(bss->rsn_ie, elems->rsn - 2, elems->rsn_len + 2); | ||
2767 | bss->rsn_ie_len = elems->rsn_len + 2; | ||
2768 | } else | ||
2769 | bss->rsn_ie_len = 0; | ||
2770 | } else if (!elems->rsn && bss->rsn_ie) { | ||
2771 | kfree(bss->rsn_ie); | ||
2772 | bss->rsn_ie = NULL; | ||
2773 | bss->rsn_ie_len = 0; | ||
2774 | } | 2747 | } |
2748 | if (bss->ies) { | ||
2749 | memcpy(bss->ies, elems->ie_start, elems->total_len); | ||
2750 | bss->ies_len = elems->total_len; | ||
2751 | } else | ||
2752 | bss->ies_len = 0; | ||
2775 | 2753 | ||
2776 | /* | 2754 | bss->wmm_used = elems->wmm_param || elems->wmm_info; |
2777 | * Cf. | ||
2778 | * http://www.wipo.int/pctdb/en/wo.jsp?wo=2007047181&IA=WO2007047181&DISPLAY=DESC | ||
2779 | * | ||
2780 | * quoting: | ||
2781 | * | ||
2782 | * In particular, "Wi-Fi CERTIFIED for WMM - Support for Multimedia | ||
2783 | * Applications with Quality of Service in Wi-Fi Networks," Wi- Fi | ||
2784 | * Alliance (September 1, 2004) is incorporated by reference herein. | ||
2785 | * The inclusion of the WMM Parameters in probe responses and | ||
2786 | * association responses is mandatory for WMM enabled networks. The | ||
2787 | * inclusion of the WMM Parameters in beacons, however, is optional. | ||
2788 | */ | ||
2789 | |||
2790 | if (elems->wmm_param && | ||
2791 | (!bss->wmm_ie || bss->wmm_ie_len != elems->wmm_param_len || | ||
2792 | memcmp(bss->wmm_ie, elems->wmm_param, elems->wmm_param_len))) { | ||
2793 | kfree(bss->wmm_ie); | ||
2794 | bss->wmm_ie = kmalloc(elems->wmm_param_len + 2, GFP_ATOMIC); | ||
2795 | if (bss->wmm_ie) { | ||
2796 | memcpy(bss->wmm_ie, elems->wmm_param - 2, | ||
2797 | elems->wmm_param_len + 2); | ||
2798 | bss->wmm_ie_len = elems->wmm_param_len + 2; | ||
2799 | } else | ||
2800 | bss->wmm_ie_len = 0; | ||
2801 | } else if (elems->wmm_info && | ||
2802 | (!bss->wmm_ie || bss->wmm_ie_len != elems->wmm_info_len || | ||
2803 | memcmp(bss->wmm_ie, elems->wmm_info, | ||
2804 | elems->wmm_info_len))) { | ||
2805 | /* As for certain AP's Fifth bit is not set in WMM IE in | ||
2806 | * beacon frames.So while parsing the beacon frame the | ||
2807 | * wmm_info structure is used instead of wmm_param. | ||
2808 | * wmm_info structure was never used to set bss->wmm_ie. | ||
2809 | * This code fixes this problem by copying the WME | ||
2810 | * information from wmm_info to bss->wmm_ie and enabling | ||
2811 | * n-band association. | ||
2812 | */ | ||
2813 | kfree(bss->wmm_ie); | ||
2814 | bss->wmm_ie = kmalloc(elems->wmm_info_len + 2, GFP_ATOMIC); | ||
2815 | if (bss->wmm_ie) { | ||
2816 | memcpy(bss->wmm_ie, elems->wmm_info - 2, | ||
2817 | elems->wmm_info_len + 2); | ||
2818 | bss->wmm_ie_len = elems->wmm_info_len + 2; | ||
2819 | } else | ||
2820 | bss->wmm_ie_len = 0; | ||
2821 | } else if (!elems->wmm_param && !elems->wmm_info && bss->wmm_ie) { | ||
2822 | kfree(bss->wmm_ie); | ||
2823 | bss->wmm_ie = NULL; | ||
2824 | bss->wmm_ie_len = 0; | ||
2825 | } | ||
2826 | 2755 | ||
2827 | /* check if we need to merge IBSS */ | 2756 | /* check if we need to merge IBSS */ |
2828 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && beacon && | 2757 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && beacon && |
@@ -2848,7 +2777,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2848 | * e.g: at 1 MBit that means mactime is 192 usec earlier | 2777 | * e.g: at 1 MBit that means mactime is 192 usec earlier |
2849 | * (=24 bytes * 8 usecs/byte) than the beacon timestamp. | 2778 | * (=24 bytes * 8 usecs/byte) than the beacon timestamp. |
2850 | */ | 2779 | */ |
2851 | int rate = local->hw.wiphy->bands[rx_status->band]-> | 2780 | int rate = local->hw.wiphy->bands[band]-> |
2852 | bitrates[rx_status->rate_idx].bitrate; | 2781 | bitrates[rx_status->rate_idx].bitrate; |
2853 | rx_timestamp = rx_status->mactime + (24 * 8 * 10 / rate); | 2782 | rx_timestamp = rx_status->mactime + (24 * 8 * 10 / rate); |
2854 | } else if (local && local->ops && local->ops->get_tsf) | 2783 | } else if (local && local->ops && local->ops->get_tsf) |
@@ -2871,12 +2800,12 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2871 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2800 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2872 | printk(KERN_DEBUG "%s: beacon TSF higher than " | 2801 | printk(KERN_DEBUG "%s: beacon TSF higher than " |
2873 | "local TSF - IBSS merge with BSSID %s\n", | 2802 | "local TSF - IBSS merge with BSSID %s\n", |
2874 | dev->name, print_mac(mac, mgmt->bssid)); | 2803 | sdata->dev->name, print_mac(mac, mgmt->bssid)); |
2875 | #endif | 2804 | #endif |
2876 | ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss); | 2805 | ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss); |
2877 | ieee80211_ibss_add_sta(dev, NULL, | 2806 | ieee80211_ibss_add_sta(sdata, NULL, |
2878 | mgmt->bssid, mgmt->sa, | 2807 | mgmt->bssid, mgmt->sa, |
2879 | BIT(rx_status->rate_idx)); | 2808 | supp_rates); |
2880 | } | 2809 | } |
2881 | } | 2810 | } |
2882 | 2811 | ||
@@ -2884,13 +2813,17 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2884 | } | 2813 | } |
2885 | 2814 | ||
2886 | 2815 | ||
2887 | static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev, | 2816 | static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, |
2888 | struct ieee80211_mgmt *mgmt, | 2817 | struct ieee80211_mgmt *mgmt, |
2889 | size_t len, | 2818 | size_t len, |
2890 | struct ieee80211_rx_status *rx_status) | 2819 | struct ieee80211_rx_status *rx_status) |
2891 | { | 2820 | { |
2892 | size_t baselen; | 2821 | size_t baselen; |
2893 | struct ieee802_11_elems elems; | 2822 | struct ieee802_11_elems elems; |
2823 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2824 | |||
2825 | if (memcmp(mgmt->da, sdata->dev->dev_addr, ETH_ALEN)) | ||
2826 | return; /* ignore ProbeResp to foreign address */ | ||
2894 | 2827 | ||
2895 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; | 2828 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; |
2896 | if (baselen > len) | 2829 | if (baselen > len) |
@@ -2899,20 +2832,27 @@ static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev, | |||
2899 | ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, | 2832 | ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, |
2900 | &elems); | 2833 | &elems); |
2901 | 2834 | ||
2902 | ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems, 0); | 2835 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems); |
2836 | |||
2837 | /* direct probe may be part of the association flow */ | ||
2838 | if (test_and_clear_bit(IEEE80211_STA_REQ_DIRECT_PROBE, | ||
2839 | &ifsta->request)) { | ||
2840 | printk(KERN_DEBUG "%s direct probe responded\n", | ||
2841 | sdata->dev->name); | ||
2842 | ieee80211_authenticate(sdata, ifsta); | ||
2843 | } | ||
2903 | } | 2844 | } |
2904 | 2845 | ||
2905 | 2846 | ||
2906 | static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | 2847 | static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, |
2907 | struct ieee80211_mgmt *mgmt, | 2848 | struct ieee80211_mgmt *mgmt, |
2908 | size_t len, | 2849 | size_t len, |
2909 | struct ieee80211_rx_status *rx_status) | 2850 | struct ieee80211_rx_status *rx_status) |
2910 | { | 2851 | { |
2911 | struct ieee80211_sub_if_data *sdata; | ||
2912 | struct ieee80211_if_sta *ifsta; | 2852 | struct ieee80211_if_sta *ifsta; |
2913 | size_t baselen; | 2853 | size_t baselen; |
2914 | struct ieee802_11_elems elems; | 2854 | struct ieee802_11_elems elems; |
2915 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2855 | struct ieee80211_local *local = sdata->local; |
2916 | struct ieee80211_conf *conf = &local->hw.conf; | 2856 | struct ieee80211_conf *conf = &local->hw.conf; |
2917 | u32 changed = 0; | 2857 | u32 changed = 0; |
2918 | 2858 | ||
@@ -2923,9 +2863,8 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
2923 | 2863 | ||
2924 | ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); | 2864 | ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); |
2925 | 2865 | ||
2926 | ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems, 1); | 2866 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems); |
2927 | 2867 | ||
2928 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2929 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 2868 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
2930 | return; | 2869 | return; |
2931 | ifsta = &sdata->u.sta; | 2870 | ifsta = &sdata->u.sta; |
@@ -2934,7 +2873,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
2934 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) | 2873 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) |
2935 | return; | 2874 | return; |
2936 | 2875 | ||
2937 | ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, | 2876 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, |
2938 | elems.wmm_param_len); | 2877 | elems.wmm_param_len); |
2939 | 2878 | ||
2940 | /* Do not send changes to driver if we are scanning. This removes | 2879 | /* Do not send changes to driver if we are scanning. This removes |
@@ -2966,14 +2905,13 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
2966 | } | 2905 | } |
2967 | 2906 | ||
2968 | 2907 | ||
2969 | static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | 2908 | static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, |
2970 | struct ieee80211_if_sta *ifsta, | 2909 | struct ieee80211_if_sta *ifsta, |
2971 | struct ieee80211_mgmt *mgmt, | 2910 | struct ieee80211_mgmt *mgmt, |
2972 | size_t len, | 2911 | size_t len, |
2973 | struct ieee80211_rx_status *rx_status) | 2912 | struct ieee80211_rx_status *rx_status) |
2974 | { | 2913 | { |
2975 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2914 | struct ieee80211_local *local = sdata->local; |
2976 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2977 | int tx_last_beacon; | 2915 | int tx_last_beacon; |
2978 | struct sk_buff *skb; | 2916 | struct sk_buff *skb; |
2979 | struct ieee80211_mgmt *resp; | 2917 | struct ieee80211_mgmt *resp; |
@@ -2985,7 +2923,7 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
2985 | #endif | 2923 | #endif |
2986 | 2924 | ||
2987 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS || | 2925 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS || |
2988 | ifsta->state != IEEE80211_IBSS_JOINED || | 2926 | ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED || |
2989 | len < 24 + 2 || !ifsta->probe_resp) | 2927 | len < 24 + 2 || !ifsta->probe_resp) |
2990 | return; | 2928 | return; |
2991 | 2929 | ||
@@ -2997,7 +2935,7 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
2997 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2935 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2998 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%s DA=%s BSSID=" | 2936 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%s DA=%s BSSID=" |
2999 | "%s (tx_last_beacon=%d)\n", | 2937 | "%s (tx_last_beacon=%d)\n", |
3000 | dev->name, print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da), | 2938 | sdata->dev->name, print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da), |
3001 | print_mac(mac3, mgmt->bssid), tx_last_beacon); | 2939 | print_mac(mac3, mgmt->bssid), tx_last_beacon); |
3002 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2940 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
3003 | 2941 | ||
@@ -3015,7 +2953,7 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
3015 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2953 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3016 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " | 2954 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " |
3017 | "from %s\n", | 2955 | "from %s\n", |
3018 | dev->name, print_mac(mac, mgmt->sa)); | 2956 | sdata->dev->name, print_mac(mac, mgmt->sa)); |
3019 | #endif | 2957 | #endif |
3020 | return; | 2958 | return; |
3021 | } | 2959 | } |
@@ -3035,19 +2973,18 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
3035 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 2973 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
3036 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2974 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3037 | printk(KERN_DEBUG "%s: Sending ProbeResp to %s\n", | 2975 | printk(KERN_DEBUG "%s: Sending ProbeResp to %s\n", |
3038 | dev->name, print_mac(mac, resp->da)); | 2976 | sdata->dev->name, print_mac(mac, resp->da)); |
3039 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2977 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
3040 | ieee80211_sta_tx(dev, skb, 0); | 2978 | ieee80211_sta_tx(sdata, skb, 0); |
3041 | } | 2979 | } |
3042 | 2980 | ||
3043 | static void ieee80211_rx_mgmt_action(struct net_device *dev, | 2981 | static void ieee80211_rx_mgmt_action(struct ieee80211_sub_if_data *sdata, |
3044 | struct ieee80211_if_sta *ifsta, | 2982 | struct ieee80211_if_sta *ifsta, |
3045 | struct ieee80211_mgmt *mgmt, | 2983 | struct ieee80211_mgmt *mgmt, |
3046 | size_t len, | 2984 | size_t len, |
3047 | struct ieee80211_rx_status *rx_status) | 2985 | struct ieee80211_rx_status *rx_status) |
3048 | { | 2986 | { |
3049 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2987 | struct ieee80211_local *local = sdata->local; |
3050 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
3051 | 2988 | ||
3052 | if (len < IEEE80211_MIN_ACTION_SIZE) | 2989 | if (len < IEEE80211_MIN_ACTION_SIZE) |
3053 | return; | 2990 | return; |
@@ -3061,7 +2998,7 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev, | |||
3061 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 2998 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
3062 | sizeof(mgmt->u.action.u.measurement))) | 2999 | sizeof(mgmt->u.action.u.measurement))) |
3063 | break; | 3000 | break; |
3064 | ieee80211_sta_process_measurement_req(dev, mgmt, len); | 3001 | ieee80211_sta_process_measurement_req(sdata, mgmt, len); |
3065 | break; | 3002 | break; |
3066 | } | 3003 | } |
3067 | break; | 3004 | break; |
@@ -3071,38 +3008,37 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev, | |||
3071 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 3008 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
3072 | sizeof(mgmt->u.action.u.addba_req))) | 3009 | sizeof(mgmt->u.action.u.addba_req))) |
3073 | break; | 3010 | break; |
3074 | ieee80211_sta_process_addba_request(dev, mgmt, len); | 3011 | ieee80211_sta_process_addba_request(local, mgmt, len); |
3075 | break; | 3012 | break; |
3076 | case WLAN_ACTION_ADDBA_RESP: | 3013 | case WLAN_ACTION_ADDBA_RESP: |
3077 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 3014 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
3078 | sizeof(mgmt->u.action.u.addba_resp))) | 3015 | sizeof(mgmt->u.action.u.addba_resp))) |
3079 | break; | 3016 | break; |
3080 | ieee80211_sta_process_addba_resp(dev, mgmt, len); | 3017 | ieee80211_sta_process_addba_resp(local, mgmt, len); |
3081 | break; | 3018 | break; |
3082 | case WLAN_ACTION_DELBA: | 3019 | case WLAN_ACTION_DELBA: |
3083 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 3020 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
3084 | sizeof(mgmt->u.action.u.delba))) | 3021 | sizeof(mgmt->u.action.u.delba))) |
3085 | break; | 3022 | break; |
3086 | ieee80211_sta_process_delba(dev, mgmt, len); | 3023 | ieee80211_sta_process_delba(sdata, mgmt, len); |
3087 | break; | 3024 | break; |
3088 | } | 3025 | } |
3089 | break; | 3026 | break; |
3090 | case PLINK_CATEGORY: | 3027 | case PLINK_CATEGORY: |
3091 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 3028 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
3092 | mesh_rx_plink_frame(dev, mgmt, len, rx_status); | 3029 | mesh_rx_plink_frame(sdata, mgmt, len, rx_status); |
3093 | break; | 3030 | break; |
3094 | case MESH_PATH_SEL_CATEGORY: | 3031 | case MESH_PATH_SEL_CATEGORY: |
3095 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 3032 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
3096 | mesh_rx_path_sel_frame(dev, mgmt, len); | 3033 | mesh_rx_path_sel_frame(sdata, mgmt, len); |
3097 | break; | 3034 | break; |
3098 | } | 3035 | } |
3099 | } | 3036 | } |
3100 | 3037 | ||
3101 | void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, | 3038 | void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
3102 | struct ieee80211_rx_status *rx_status) | 3039 | struct ieee80211_rx_status *rx_status) |
3103 | { | 3040 | { |
3104 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3041 | struct ieee80211_local *local = sdata->local; |
3105 | struct ieee80211_sub_if_data *sdata; | ||
3106 | struct ieee80211_if_sta *ifsta; | 3042 | struct ieee80211_if_sta *ifsta; |
3107 | struct ieee80211_mgmt *mgmt; | 3043 | struct ieee80211_mgmt *mgmt; |
3108 | u16 fc; | 3044 | u16 fc; |
@@ -3110,7 +3046,6 @@ void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, | |||
3110 | if (skb->len < 24) | 3046 | if (skb->len < 24) |
3111 | goto fail; | 3047 | goto fail; |
3112 | 3048 | ||
3113 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3114 | ifsta = &sdata->u.sta; | 3049 | ifsta = &sdata->u.sta; |
3115 | 3050 | ||
3116 | mgmt = (struct ieee80211_mgmt *) skb->data; | 3051 | mgmt = (struct ieee80211_mgmt *) skb->data; |
@@ -3136,17 +3071,14 @@ void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, | |||
3136 | kfree_skb(skb); | 3071 | kfree_skb(skb); |
3137 | } | 3072 | } |
3138 | 3073 | ||
3139 | 3074 | static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |
3140 | static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, | ||
3141 | struct sk_buff *skb) | 3075 | struct sk_buff *skb) |
3142 | { | 3076 | { |
3143 | struct ieee80211_rx_status *rx_status; | 3077 | struct ieee80211_rx_status *rx_status; |
3144 | struct ieee80211_sub_if_data *sdata; | ||
3145 | struct ieee80211_if_sta *ifsta; | 3078 | struct ieee80211_if_sta *ifsta; |
3146 | struct ieee80211_mgmt *mgmt; | 3079 | struct ieee80211_mgmt *mgmt; |
3147 | u16 fc; | 3080 | u16 fc; |
3148 | 3081 | ||
3149 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3150 | ifsta = &sdata->u.sta; | 3082 | ifsta = &sdata->u.sta; |
3151 | 3083 | ||
3152 | rx_status = (struct ieee80211_rx_status *) skb->cb; | 3084 | rx_status = (struct ieee80211_rx_status *) skb->cb; |
@@ -3155,17 +3087,17 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, | |||
3155 | 3087 | ||
3156 | switch (fc & IEEE80211_FCTL_STYPE) { | 3088 | switch (fc & IEEE80211_FCTL_STYPE) { |
3157 | case IEEE80211_STYPE_PROBE_REQ: | 3089 | case IEEE80211_STYPE_PROBE_REQ: |
3158 | ieee80211_rx_mgmt_probe_req(dev, ifsta, mgmt, skb->len, | 3090 | ieee80211_rx_mgmt_probe_req(sdata, ifsta, mgmt, skb->len, |
3159 | rx_status); | 3091 | rx_status); |
3160 | break; | 3092 | break; |
3161 | case IEEE80211_STYPE_PROBE_RESP: | 3093 | case IEEE80211_STYPE_PROBE_RESP: |
3162 | ieee80211_rx_mgmt_probe_resp(dev, mgmt, skb->len, rx_status); | 3094 | ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len, rx_status); |
3163 | break; | 3095 | break; |
3164 | case IEEE80211_STYPE_BEACON: | 3096 | case IEEE80211_STYPE_BEACON: |
3165 | ieee80211_rx_mgmt_beacon(dev, mgmt, skb->len, rx_status); | 3097 | ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, rx_status); |
3166 | break; | 3098 | break; |
3167 | case IEEE80211_STYPE_AUTH: | 3099 | case IEEE80211_STYPE_AUTH: |
3168 | ieee80211_rx_mgmt_auth(dev, ifsta, mgmt, skb->len); | 3100 | ieee80211_rx_mgmt_auth(sdata, ifsta, mgmt, skb->len); |
3169 | break; | 3101 | break; |
3170 | case IEEE80211_STYPE_ASSOC_RESP: | 3102 | case IEEE80211_STYPE_ASSOC_RESP: |
3171 | ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 0); | 3103 | ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 0); |
@@ -3174,13 +3106,13 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, | |||
3174 | ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 1); | 3106 | ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 1); |
3175 | break; | 3107 | break; |
3176 | case IEEE80211_STYPE_DEAUTH: | 3108 | case IEEE80211_STYPE_DEAUTH: |
3177 | ieee80211_rx_mgmt_deauth(dev, ifsta, mgmt, skb->len); | 3109 | ieee80211_rx_mgmt_deauth(sdata, ifsta, mgmt, skb->len); |
3178 | break; | 3110 | break; |
3179 | case IEEE80211_STYPE_DISASSOC: | 3111 | case IEEE80211_STYPE_DISASSOC: |
3180 | ieee80211_rx_mgmt_disassoc(dev, ifsta, mgmt, skb->len); | 3112 | ieee80211_rx_mgmt_disassoc(sdata, ifsta, mgmt, skb->len); |
3181 | break; | 3113 | break; |
3182 | case IEEE80211_STYPE_ACTION: | 3114 | case IEEE80211_STYPE_ACTION: |
3183 | ieee80211_rx_mgmt_action(dev, ifsta, mgmt, skb->len, rx_status); | 3115 | ieee80211_rx_mgmt_action(sdata, ifsta, mgmt, skb->len, rx_status); |
3184 | break; | 3116 | break; |
3185 | } | 3117 | } |
3186 | 3118 | ||
@@ -3189,7 +3121,7 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, | |||
3189 | 3121 | ||
3190 | 3122 | ||
3191 | ieee80211_rx_result | 3123 | ieee80211_rx_result |
3192 | ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb, | 3124 | ieee80211_sta_rx_scan(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
3193 | struct ieee80211_rx_status *rx_status) | 3125 | struct ieee80211_rx_status *rx_status) |
3194 | { | 3126 | { |
3195 | struct ieee80211_mgmt *mgmt; | 3127 | struct ieee80211_mgmt *mgmt; |
@@ -3208,13 +3140,13 @@ ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb, | |||
3208 | return RX_DROP_MONITOR; | 3140 | return RX_DROP_MONITOR; |
3209 | 3141 | ||
3210 | if (ieee80211_is_probe_resp(fc)) { | 3142 | if (ieee80211_is_probe_resp(fc)) { |
3211 | ieee80211_rx_mgmt_probe_resp(dev, mgmt, skb->len, rx_status); | 3143 | ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len, rx_status); |
3212 | dev_kfree_skb(skb); | 3144 | dev_kfree_skb(skb); |
3213 | return RX_QUEUED; | 3145 | return RX_QUEUED; |
3214 | } | 3146 | } |
3215 | 3147 | ||
3216 | if (ieee80211_is_beacon(fc)) { | 3148 | if (ieee80211_is_beacon(fc)) { |
3217 | ieee80211_rx_mgmt_beacon(dev, mgmt, skb->len, rx_status); | 3149 | ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, rx_status); |
3218 | dev_kfree_skb(skb); | 3150 | dev_kfree_skb(skb); |
3219 | return RX_QUEUED; | 3151 | return RX_QUEUED; |
3220 | } | 3152 | } |
@@ -3223,12 +3155,11 @@ ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb, | |||
3223 | } | 3155 | } |
3224 | 3156 | ||
3225 | 3157 | ||
3226 | static int ieee80211_sta_active_ibss(struct net_device *dev) | 3158 | static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata) |
3227 | { | 3159 | { |
3228 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3160 | struct ieee80211_local *local = sdata->local; |
3229 | int active = 0; | 3161 | int active = 0; |
3230 | struct sta_info *sta; | 3162 | struct sta_info *sta; |
3231 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3232 | 3163 | ||
3233 | rcu_read_lock(); | 3164 | rcu_read_lock(); |
3234 | 3165 | ||
@@ -3247,9 +3178,9 @@ static int ieee80211_sta_active_ibss(struct net_device *dev) | |||
3247 | } | 3178 | } |
3248 | 3179 | ||
3249 | 3180 | ||
3250 | static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time) | 3181 | static void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, unsigned long exp_time) |
3251 | { | 3182 | { |
3252 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3183 | struct ieee80211_local *local = sdata->local; |
3253 | struct sta_info *sta, *tmp; | 3184 | struct sta_info *sta, *tmp; |
3254 | LIST_HEAD(tmp_list); | 3185 | LIST_HEAD(tmp_list); |
3255 | DECLARE_MAC_BUF(mac); | 3186 | DECLARE_MAC_BUF(mac); |
@@ -3260,7 +3191,7 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time) | |||
3260 | if (time_after(jiffies, sta->last_rx + exp_time)) { | 3191 | if (time_after(jiffies, sta->last_rx + exp_time)) { |
3261 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 3192 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3262 | printk(KERN_DEBUG "%s: expiring inactive STA %s\n", | 3193 | printk(KERN_DEBUG "%s: expiring inactive STA %s\n", |
3263 | dev->name, print_mac(mac, sta->addr)); | 3194 | sdata->dev->name, print_mac(mac, sta->addr)); |
3264 | #endif | 3195 | #endif |
3265 | __sta_info_unlink(&sta); | 3196 | __sta_info_unlink(&sta); |
3266 | if (sta) | 3197 | if (sta) |
@@ -3273,30 +3204,29 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time) | |||
3273 | } | 3204 | } |
3274 | 3205 | ||
3275 | 3206 | ||
3276 | static void ieee80211_sta_merge_ibss(struct net_device *dev, | 3207 | static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata, |
3277 | struct ieee80211_if_sta *ifsta) | 3208 | struct ieee80211_if_sta *ifsta) |
3278 | { | 3209 | { |
3279 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); | 3210 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); |
3280 | 3211 | ||
3281 | ieee80211_sta_expire(dev, IEEE80211_IBSS_INACTIVITY_LIMIT); | 3212 | ieee80211_sta_expire(sdata, IEEE80211_IBSS_INACTIVITY_LIMIT); |
3282 | if (ieee80211_sta_active_ibss(dev)) | 3213 | if (ieee80211_sta_active_ibss(sdata)) |
3283 | return; | 3214 | return; |
3284 | 3215 | ||
3285 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " | 3216 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " |
3286 | "IBSS networks with same SSID (merge)\n", dev->name); | 3217 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); |
3287 | ieee80211_sta_req_scan(dev, ifsta->ssid, ifsta->ssid_len); | 3218 | ieee80211_sta_req_scan(sdata, ifsta->ssid, ifsta->ssid_len); |
3288 | } | 3219 | } |
3289 | 3220 | ||
3290 | 3221 | ||
3291 | #ifdef CONFIG_MAC80211_MESH | 3222 | #ifdef CONFIG_MAC80211_MESH |
3292 | static void ieee80211_mesh_housekeeping(struct net_device *dev, | 3223 | static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, |
3293 | struct ieee80211_if_sta *ifsta) | 3224 | struct ieee80211_if_sta *ifsta) |
3294 | { | 3225 | { |
3295 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3296 | bool free_plinks; | 3226 | bool free_plinks; |
3297 | 3227 | ||
3298 | ieee80211_sta_expire(dev, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); | 3228 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); |
3299 | mesh_path_expire(dev); | 3229 | mesh_path_expire(sdata); |
3300 | 3230 | ||
3301 | free_plinks = mesh_plink_availables(sdata); | 3231 | free_plinks = mesh_plink_availables(sdata); |
3302 | if (free_plinks != sdata->u.sta.accepting_plinks) | 3232 | if (free_plinks != sdata->u.sta.accepting_plinks) |
@@ -3307,12 +3237,11 @@ static void ieee80211_mesh_housekeeping(struct net_device *dev, | |||
3307 | } | 3237 | } |
3308 | 3238 | ||
3309 | 3239 | ||
3310 | void ieee80211_start_mesh(struct net_device *dev) | 3240 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) |
3311 | { | 3241 | { |
3312 | struct ieee80211_if_sta *ifsta; | 3242 | struct ieee80211_if_sta *ifsta; |
3313 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3314 | ifsta = &sdata->u.sta; | 3243 | ifsta = &sdata->u.sta; |
3315 | ifsta->state = IEEE80211_MESH_UP; | 3244 | ifsta->state = IEEE80211_STA_MLME_MESH_UP; |
3316 | ieee80211_sta_timer((unsigned long)sdata); | 3245 | ieee80211_sta_timer((unsigned long)sdata); |
3317 | ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | 3246 | ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); |
3318 | } | 3247 | } |
@@ -3324,7 +3253,7 @@ void ieee80211_sta_timer(unsigned long data) | |||
3324 | struct ieee80211_sub_if_data *sdata = | 3253 | struct ieee80211_sub_if_data *sdata = |
3325 | (struct ieee80211_sub_if_data *) data; | 3254 | (struct ieee80211_sub_if_data *) data; |
3326 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 3255 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
3327 | struct ieee80211_local *local = wdev_priv(&sdata->wdev); | 3256 | struct ieee80211_local *local = sdata->local; |
3328 | 3257 | ||
3329 | set_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); | 3258 | set_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); |
3330 | queue_work(local->hw.workqueue, &ifsta->work); | 3259 | queue_work(local->hw.workqueue, &ifsta->work); |
@@ -3334,12 +3263,11 @@ void ieee80211_sta_work(struct work_struct *work) | |||
3334 | { | 3263 | { |
3335 | struct ieee80211_sub_if_data *sdata = | 3264 | struct ieee80211_sub_if_data *sdata = |
3336 | container_of(work, struct ieee80211_sub_if_data, u.sta.work); | 3265 | container_of(work, struct ieee80211_sub_if_data, u.sta.work); |
3337 | struct net_device *dev = sdata->dev; | 3266 | struct ieee80211_local *local = sdata->local; |
3338 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
3339 | struct ieee80211_if_sta *ifsta; | 3267 | struct ieee80211_if_sta *ifsta; |
3340 | struct sk_buff *skb; | 3268 | struct sk_buff *skb; |
3341 | 3269 | ||
3342 | if (!netif_running(dev)) | 3270 | if (!netif_running(sdata->dev)) |
3343 | return; | 3271 | return; |
3344 | 3272 | ||
3345 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 3273 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
@@ -3352,53 +3280,57 @@ void ieee80211_sta_work(struct work_struct *work) | |||
3352 | ifsta = &sdata->u.sta; | 3280 | ifsta = &sdata->u.sta; |
3353 | 3281 | ||
3354 | while ((skb = skb_dequeue(&ifsta->skb_queue))) | 3282 | while ((skb = skb_dequeue(&ifsta->skb_queue))) |
3355 | ieee80211_sta_rx_queued_mgmt(dev, skb); | 3283 | ieee80211_sta_rx_queued_mgmt(sdata, skb); |
3356 | 3284 | ||
3357 | #ifdef CONFIG_MAC80211_MESH | 3285 | #ifdef CONFIG_MAC80211_MESH |
3358 | if (ifsta->preq_queue_len && | 3286 | if (ifsta->preq_queue_len && |
3359 | time_after(jiffies, | 3287 | time_after(jiffies, |
3360 | ifsta->last_preq + msecs_to_jiffies(ifsta->mshcfg.dot11MeshHWMPpreqMinInterval))) | 3288 | ifsta->last_preq + msecs_to_jiffies(ifsta->mshcfg.dot11MeshHWMPpreqMinInterval))) |
3361 | mesh_path_start_discovery(dev); | 3289 | mesh_path_start_discovery(sdata); |
3362 | #endif | 3290 | #endif |
3363 | 3291 | ||
3364 | if (ifsta->state != IEEE80211_AUTHENTICATE && | 3292 | if (ifsta->state != IEEE80211_STA_MLME_DIRECT_PROBE && |
3365 | ifsta->state != IEEE80211_ASSOCIATE && | 3293 | ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && |
3294 | ifsta->state != IEEE80211_STA_MLME_ASSOCIATE && | ||
3366 | test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { | 3295 | test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { |
3367 | if (ifsta->scan_ssid_len) | 3296 | if (ifsta->scan_ssid_len) |
3368 | ieee80211_sta_start_scan(dev, ifsta->scan_ssid, ifsta->scan_ssid_len); | 3297 | ieee80211_sta_start_scan(sdata, ifsta->scan_ssid, ifsta->scan_ssid_len); |
3369 | else | 3298 | else |
3370 | ieee80211_sta_start_scan(dev, NULL, 0); | 3299 | ieee80211_sta_start_scan(sdata, NULL, 0); |
3371 | return; | 3300 | return; |
3372 | } | 3301 | } |
3373 | 3302 | ||
3374 | if (test_and_clear_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request)) { | 3303 | if (test_and_clear_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request)) { |
3375 | if (ieee80211_sta_config_auth(dev, ifsta)) | 3304 | if (ieee80211_sta_config_auth(sdata, ifsta)) |
3376 | return; | 3305 | return; |
3377 | clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); | 3306 | clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); |
3378 | } else if (!test_and_clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request)) | 3307 | } else if (!test_and_clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request)) |
3379 | return; | 3308 | return; |
3380 | 3309 | ||
3381 | switch (ifsta->state) { | 3310 | switch (ifsta->state) { |
3382 | case IEEE80211_DISABLED: | 3311 | case IEEE80211_STA_MLME_DISABLED: |
3312 | break; | ||
3313 | case IEEE80211_STA_MLME_DIRECT_PROBE: | ||
3314 | ieee80211_direct_probe(sdata, ifsta); | ||
3383 | break; | 3315 | break; |
3384 | case IEEE80211_AUTHENTICATE: | 3316 | case IEEE80211_STA_MLME_AUTHENTICATE: |
3385 | ieee80211_authenticate(dev, ifsta); | 3317 | ieee80211_authenticate(sdata, ifsta); |
3386 | break; | 3318 | break; |
3387 | case IEEE80211_ASSOCIATE: | 3319 | case IEEE80211_STA_MLME_ASSOCIATE: |
3388 | ieee80211_associate(dev, ifsta); | 3320 | ieee80211_associate(sdata, ifsta); |
3389 | break; | 3321 | break; |
3390 | case IEEE80211_ASSOCIATED: | 3322 | case IEEE80211_STA_MLME_ASSOCIATED: |
3391 | ieee80211_associated(dev, ifsta); | 3323 | ieee80211_associated(sdata, ifsta); |
3392 | break; | 3324 | break; |
3393 | case IEEE80211_IBSS_SEARCH: | 3325 | case IEEE80211_STA_MLME_IBSS_SEARCH: |
3394 | ieee80211_sta_find_ibss(dev, ifsta); | 3326 | ieee80211_sta_find_ibss(sdata, ifsta); |
3395 | break; | 3327 | break; |
3396 | case IEEE80211_IBSS_JOINED: | 3328 | case IEEE80211_STA_MLME_IBSS_JOINED: |
3397 | ieee80211_sta_merge_ibss(dev, ifsta); | 3329 | ieee80211_sta_merge_ibss(sdata, ifsta); |
3398 | break; | 3330 | break; |
3399 | #ifdef CONFIG_MAC80211_MESH | 3331 | #ifdef CONFIG_MAC80211_MESH |
3400 | case IEEE80211_MESH_UP: | 3332 | case IEEE80211_STA_MLME_MESH_UP: |
3401 | ieee80211_mesh_housekeeping(dev, ifsta); | 3333 | ieee80211_mesh_housekeeping(sdata, ifsta); |
3402 | break; | 3334 | break; |
3403 | #endif | 3335 | #endif |
3404 | default: | 3336 | default: |
@@ -3406,20 +3338,20 @@ void ieee80211_sta_work(struct work_struct *work) | |||
3406 | break; | 3338 | break; |
3407 | } | 3339 | } |
3408 | 3340 | ||
3409 | if (ieee80211_privacy_mismatch(dev, ifsta)) { | 3341 | if (ieee80211_privacy_mismatch(sdata, ifsta)) { |
3410 | printk(KERN_DEBUG "%s: privacy configuration mismatch and " | 3342 | printk(KERN_DEBUG "%s: privacy configuration mismatch and " |
3411 | "mixed-cell disabled - disassociate\n", dev->name); | 3343 | "mixed-cell disabled - disassociate\n", sdata->dev->name); |
3412 | 3344 | ||
3413 | ieee80211_send_disassoc(dev, ifsta, WLAN_REASON_UNSPECIFIED); | 3345 | ieee80211_send_disassoc(sdata, ifsta, WLAN_REASON_UNSPECIFIED); |
3414 | ieee80211_set_disassoc(dev, ifsta, 0); | 3346 | ieee80211_set_disassoc(sdata, ifsta, 0); |
3415 | } | 3347 | } |
3416 | } | 3348 | } |
3417 | 3349 | ||
3418 | 3350 | ||
3419 | static void ieee80211_sta_reset_auth(struct net_device *dev, | 3351 | static void ieee80211_sta_reset_auth(struct ieee80211_sub_if_data *sdata, |
3420 | struct ieee80211_if_sta *ifsta) | 3352 | struct ieee80211_if_sta *ifsta) |
3421 | { | 3353 | { |
3422 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3354 | struct ieee80211_local *local = sdata->local; |
3423 | 3355 | ||
3424 | if (local->ops->reset_tsf) { | 3356 | if (local->ops->reset_tsf) { |
3425 | /* Reset own TSF to allow time synchronization work. */ | 3357 | /* Reset own TSF to allow time synchronization work. */ |
@@ -3439,16 +3371,18 @@ static void ieee80211_sta_reset_auth(struct net_device *dev, | |||
3439 | ifsta->auth_alg = WLAN_AUTH_OPEN; | 3371 | ifsta->auth_alg = WLAN_AUTH_OPEN; |
3440 | ifsta->auth_transaction = -1; | 3372 | ifsta->auth_transaction = -1; |
3441 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; | 3373 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; |
3442 | ifsta->auth_tries = ifsta->assoc_tries = 0; | 3374 | ifsta->assoc_scan_tries = 0; |
3443 | netif_carrier_off(dev); | 3375 | ifsta->direct_probe_tries = 0; |
3376 | ifsta->auth_tries = 0; | ||
3377 | ifsta->assoc_tries = 0; | ||
3378 | netif_carrier_off(sdata->dev); | ||
3444 | } | 3379 | } |
3445 | 3380 | ||
3446 | 3381 | ||
3447 | void ieee80211_sta_req_auth(struct net_device *dev, | 3382 | void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, |
3448 | struct ieee80211_if_sta *ifsta) | 3383 | struct ieee80211_if_sta *ifsta) |
3449 | { | 3384 | { |
3450 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3385 | struct ieee80211_local *local = sdata->local; |
3451 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3452 | 3386 | ||
3453 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 3387 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
3454 | return; | 3388 | return; |
@@ -3492,11 +3426,10 @@ static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta, | |||
3492 | return 0; | 3426 | return 0; |
3493 | } | 3427 | } |
3494 | 3428 | ||
3495 | static int ieee80211_sta_config_auth(struct net_device *dev, | 3429 | static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, |
3496 | struct ieee80211_if_sta *ifsta) | 3430 | struct ieee80211_if_sta *ifsta) |
3497 | { | 3431 | { |
3498 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3432 | struct ieee80211_local *local = sdata->local; |
3499 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3500 | struct ieee80211_sta_bss *bss, *selected = NULL; | 3433 | struct ieee80211_sta_bss *bss, *selected = NULL; |
3501 | int top_rssi = 0, freq; | 3434 | int top_rssi = 0, freq; |
3502 | 3435 | ||
@@ -3535,38 +3468,48 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
3535 | spin_unlock_bh(&local->sta_bss_lock); | 3468 | spin_unlock_bh(&local->sta_bss_lock); |
3536 | 3469 | ||
3537 | if (selected) { | 3470 | if (selected) { |
3538 | ieee80211_set_freq(dev, selected->freq); | 3471 | ieee80211_set_freq(sdata, selected->freq); |
3539 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) | 3472 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) |
3540 | ieee80211_sta_set_ssid(dev, selected->ssid, | 3473 | ieee80211_sta_set_ssid(sdata, selected->ssid, |
3541 | selected->ssid_len); | 3474 | selected->ssid_len); |
3542 | ieee80211_sta_set_bssid(dev, selected->bssid); | 3475 | ieee80211_sta_set_bssid(sdata, selected->bssid); |
3543 | ieee80211_sta_def_wmm_params(dev, selected, 0); | 3476 | ieee80211_sta_def_wmm_params(sdata, selected, 0); |
3477 | |||
3478 | /* Send out direct probe if no probe resp was received or | ||
3479 | * the one we have is outdated | ||
3480 | */ | ||
3481 | if (!selected->last_probe_resp || | ||
3482 | time_after(jiffies, selected->last_probe_resp | ||
3483 | + IEEE80211_SCAN_RESULT_EXPIRE)) | ||
3484 | ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE; | ||
3485 | else | ||
3486 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; | ||
3487 | |||
3544 | ieee80211_rx_bss_put(local, selected); | 3488 | ieee80211_rx_bss_put(local, selected); |
3545 | ifsta->state = IEEE80211_AUTHENTICATE; | 3489 | ieee80211_sta_reset_auth(sdata, ifsta); |
3546 | ieee80211_sta_reset_auth(dev, ifsta); | ||
3547 | return 0; | 3490 | return 0; |
3548 | } else { | 3491 | } else { |
3549 | if (ifsta->state != IEEE80211_AUTHENTICATE) { | 3492 | if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) { |
3493 | ifsta->assoc_scan_tries++; | ||
3550 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) | 3494 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) |
3551 | ieee80211_sta_start_scan(dev, NULL, 0); | 3495 | ieee80211_sta_start_scan(sdata, NULL, 0); |
3552 | else | 3496 | else |
3553 | ieee80211_sta_start_scan(dev, ifsta->ssid, | 3497 | ieee80211_sta_start_scan(sdata, ifsta->ssid, |
3554 | ifsta->ssid_len); | 3498 | ifsta->ssid_len); |
3555 | ifsta->state = IEEE80211_AUTHENTICATE; | 3499 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; |
3556 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); | 3500 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); |
3557 | } else | 3501 | } else |
3558 | ifsta->state = IEEE80211_DISABLED; | 3502 | ifsta->state = IEEE80211_STA_MLME_DISABLED; |
3559 | } | 3503 | } |
3560 | return -1; | 3504 | return -1; |
3561 | } | 3505 | } |
3562 | 3506 | ||
3563 | 3507 | ||
3564 | static int ieee80211_sta_create_ibss(struct net_device *dev, | 3508 | static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata, |
3565 | struct ieee80211_if_sta *ifsta) | 3509 | struct ieee80211_if_sta *ifsta) |
3566 | { | 3510 | { |
3567 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3511 | struct ieee80211_local *local = sdata->local; |
3568 | struct ieee80211_sta_bss *bss; | 3512 | struct ieee80211_sta_bss *bss; |
3569 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3570 | struct ieee80211_supported_band *sband; | 3513 | struct ieee80211_supported_band *sband; |
3571 | u8 bssid[ETH_ALEN], *pos; | 3514 | u8 bssid[ETH_ALEN], *pos; |
3572 | int i; | 3515 | int i; |
@@ -3582,15 +3525,15 @@ static int ieee80211_sta_create_ibss(struct net_device *dev, | |||
3582 | * random number generator get different BSSID. */ | 3525 | * random number generator get different BSSID. */ |
3583 | get_random_bytes(bssid, ETH_ALEN); | 3526 | get_random_bytes(bssid, ETH_ALEN); |
3584 | for (i = 0; i < ETH_ALEN; i++) | 3527 | for (i = 0; i < ETH_ALEN; i++) |
3585 | bssid[i] ^= dev->dev_addr[i]; | 3528 | bssid[i] ^= sdata->dev->dev_addr[i]; |
3586 | bssid[0] &= ~0x01; | 3529 | bssid[0] &= ~0x01; |
3587 | bssid[0] |= 0x02; | 3530 | bssid[0] |= 0x02; |
3588 | #endif | 3531 | #endif |
3589 | 3532 | ||
3590 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n", | 3533 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n", |
3591 | dev->name, print_mac(mac, bssid)); | 3534 | sdata->dev->name, print_mac(mac, bssid)); |
3592 | 3535 | ||
3593 | bss = ieee80211_rx_bss_add(dev, bssid, | 3536 | bss = ieee80211_rx_bss_add(sdata, bssid, |
3594 | local->hw.conf.channel->center_freq, | 3537 | local->hw.conf.channel->center_freq, |
3595 | sdata->u.sta.ssid, sdata->u.sta.ssid_len); | 3538 | sdata->u.sta.ssid, sdata->u.sta.ssid_len); |
3596 | if (!bss) | 3539 | if (!bss) |
@@ -3617,16 +3560,16 @@ static int ieee80211_sta_create_ibss(struct net_device *dev, | |||
3617 | *pos++ = (u8) (rate / 5); | 3560 | *pos++ = (u8) (rate / 5); |
3618 | } | 3561 | } |
3619 | 3562 | ||
3620 | ret = ieee80211_sta_join_ibss(dev, ifsta, bss); | 3563 | ret = ieee80211_sta_join_ibss(sdata, ifsta, bss); |
3621 | ieee80211_rx_bss_put(local, bss); | 3564 | ieee80211_rx_bss_put(local, bss); |
3622 | return ret; | 3565 | return ret; |
3623 | } | 3566 | } |
3624 | 3567 | ||
3625 | 3568 | ||
3626 | static int ieee80211_sta_find_ibss(struct net_device *dev, | 3569 | static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, |
3627 | struct ieee80211_if_sta *ifsta) | 3570 | struct ieee80211_if_sta *ifsta) |
3628 | { | 3571 | { |
3629 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3572 | struct ieee80211_local *local = sdata->local; |
3630 | struct ieee80211_sta_bss *bss; | 3573 | struct ieee80211_sta_bss *bss; |
3631 | int found = 0; | 3574 | int found = 0; |
3632 | u8 bssid[ETH_ALEN]; | 3575 | u8 bssid[ETH_ALEN]; |
@@ -3637,10 +3580,10 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
3637 | if (ifsta->ssid_len == 0) | 3580 | if (ifsta->ssid_len == 0) |
3638 | return -EINVAL; | 3581 | return -EINVAL; |
3639 | 3582 | ||
3640 | active_ibss = ieee80211_sta_active_ibss(dev); | 3583 | active_ibss = ieee80211_sta_active_ibss(sdata); |
3641 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 3584 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3642 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", | 3585 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", |
3643 | dev->name, active_ibss); | 3586 | sdata->dev->name, active_ibss); |
3644 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 3587 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
3645 | spin_lock_bh(&local->sta_bss_lock); | 3588 | spin_lock_bh(&local->sta_bss_lock); |
3646 | list_for_each_entry(bss, &local->sta_bss_list, list) { | 3589 | list_for_each_entry(bss, &local->sta_bss_list, list) { |
@@ -3675,15 +3618,15 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
3675 | else | 3618 | else |
3676 | search_freq = local->hw.conf.channel->center_freq; | 3619 | search_freq = local->hw.conf.channel->center_freq; |
3677 | 3620 | ||
3678 | bss = ieee80211_rx_bss_get(dev, bssid, search_freq, | 3621 | bss = ieee80211_rx_bss_get(local, bssid, search_freq, |
3679 | ifsta->ssid, ifsta->ssid_len); | 3622 | ifsta->ssid, ifsta->ssid_len); |
3680 | if (!bss) | 3623 | if (!bss) |
3681 | goto dont_join; | 3624 | goto dont_join; |
3682 | 3625 | ||
3683 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" | 3626 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" |
3684 | " based on configured SSID\n", | 3627 | " based on configured SSID\n", |
3685 | dev->name, print_mac(mac, bssid)); | 3628 | sdata->dev->name, print_mac(mac, bssid)); |
3686 | ret = ieee80211_sta_join_ibss(dev, ifsta, bss); | 3629 | ret = ieee80211_sta_join_ibss(sdata, ifsta, bss); |
3687 | ieee80211_rx_bss_put(local, bss); | 3630 | ieee80211_rx_bss_put(local, bss); |
3688 | return ret; | 3631 | return ret; |
3689 | } | 3632 | } |
@@ -3694,17 +3637,17 @@ dont_join: | |||
3694 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 3637 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
3695 | 3638 | ||
3696 | /* Selected IBSS not found in current scan results - try to scan */ | 3639 | /* Selected IBSS not found in current scan results - try to scan */ |
3697 | if (ifsta->state == IEEE80211_IBSS_JOINED && | 3640 | if (ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED && |
3698 | !ieee80211_sta_active_ibss(dev)) { | 3641 | !ieee80211_sta_active_ibss(sdata)) { |
3699 | mod_timer(&ifsta->timer, jiffies + | 3642 | mod_timer(&ifsta->timer, jiffies + |
3700 | IEEE80211_IBSS_MERGE_INTERVAL); | 3643 | IEEE80211_IBSS_MERGE_INTERVAL); |
3701 | } else if (time_after(jiffies, local->last_scan_completed + | 3644 | } else if (time_after(jiffies, local->last_scan_completed + |
3702 | IEEE80211_SCAN_INTERVAL)) { | 3645 | IEEE80211_SCAN_INTERVAL)) { |
3703 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " | 3646 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
3704 | "join\n", dev->name); | 3647 | "join\n", sdata->dev->name); |
3705 | return ieee80211_sta_req_scan(dev, ifsta->ssid, | 3648 | return ieee80211_sta_req_scan(sdata, ifsta->ssid, |
3706 | ifsta->ssid_len); | 3649 | ifsta->ssid_len); |
3707 | } else if (ifsta->state != IEEE80211_IBSS_JOINED) { | 3650 | } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) { |
3708 | int interval = IEEE80211_SCAN_INTERVAL; | 3651 | int interval = IEEE80211_SCAN_INTERVAL; |
3709 | 3652 | ||
3710 | if (time_after(jiffies, ifsta->ibss_join_req + | 3653 | if (time_after(jiffies, ifsta->ibss_join_req + |
@@ -3712,10 +3655,10 @@ dont_join: | |||
3712 | if ((ifsta->flags & IEEE80211_STA_CREATE_IBSS) && | 3655 | if ((ifsta->flags & IEEE80211_STA_CREATE_IBSS) && |
3713 | (!(local->oper_channel->flags & | 3656 | (!(local->oper_channel->flags & |
3714 | IEEE80211_CHAN_NO_IBSS))) | 3657 | IEEE80211_CHAN_NO_IBSS))) |
3715 | return ieee80211_sta_create_ibss(dev, ifsta); | 3658 | return ieee80211_sta_create_ibss(sdata, ifsta); |
3716 | if (ifsta->flags & IEEE80211_STA_CREATE_IBSS) { | 3659 | if (ifsta->flags & IEEE80211_STA_CREATE_IBSS) { |
3717 | printk(KERN_DEBUG "%s: IBSS not allowed on" | 3660 | printk(KERN_DEBUG "%s: IBSS not allowed on" |
3718 | " %d MHz\n", dev->name, | 3661 | " %d MHz\n", sdata->dev->name, |
3719 | local->hw.conf.channel->center_freq); | 3662 | local->hw.conf.channel->center_freq); |
3720 | } | 3663 | } |
3721 | 3664 | ||
@@ -3724,7 +3667,7 @@ dont_join: | |||
3724 | interval = IEEE80211_SCAN_INTERVAL_SLOW; | 3667 | interval = IEEE80211_SCAN_INTERVAL_SLOW; |
3725 | } | 3668 | } |
3726 | 3669 | ||
3727 | ifsta->state = IEEE80211_IBSS_SEARCH; | 3670 | ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH; |
3728 | mod_timer(&ifsta->timer, jiffies + interval); | 3671 | mod_timer(&ifsta->timer, jiffies + interval); |
3729 | return 0; | 3672 | return 0; |
3730 | } | 3673 | } |
@@ -3733,9 +3676,8 @@ dont_join: | |||
3733 | } | 3676 | } |
3734 | 3677 | ||
3735 | 3678 | ||
3736 | int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | 3679 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len) |
3737 | { | 3680 | { |
3738 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3739 | struct ieee80211_if_sta *ifsta; | 3681 | struct ieee80211_if_sta *ifsta; |
3740 | int res; | 3682 | int res; |
3741 | 3683 | ||
@@ -3759,7 +3701,7 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | |||
3759 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_SSID); | 3701 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_SSID); |
3760 | if (res) { | 3702 | if (res) { |
3761 | printk(KERN_DEBUG "%s: Failed to config new SSID to " | 3703 | printk(KERN_DEBUG "%s: Failed to config new SSID to " |
3762 | "the low-level driver\n", dev->name); | 3704 | "the low-level driver\n", sdata->dev->name); |
3763 | return res; | 3705 | return res; |
3764 | } | 3706 | } |
3765 | } | 3707 | } |
@@ -3772,17 +3714,16 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | |||
3772 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | 3714 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && |
3773 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { | 3715 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { |
3774 | ifsta->ibss_join_req = jiffies; | 3716 | ifsta->ibss_join_req = jiffies; |
3775 | ifsta->state = IEEE80211_IBSS_SEARCH; | 3717 | ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH; |
3776 | return ieee80211_sta_find_ibss(dev, ifsta); | 3718 | return ieee80211_sta_find_ibss(sdata, ifsta); |
3777 | } | 3719 | } |
3778 | 3720 | ||
3779 | return 0; | 3721 | return 0; |
3780 | } | 3722 | } |
3781 | 3723 | ||
3782 | 3724 | ||
3783 | int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len) | 3725 | int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len) |
3784 | { | 3726 | { |
3785 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3786 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 3727 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
3787 | memcpy(ssid, ifsta->ssid, ifsta->ssid_len); | 3728 | memcpy(ssid, ifsta->ssid, ifsta->ssid_len); |
3788 | *len = ifsta->ssid_len; | 3729 | *len = ifsta->ssid_len; |
@@ -3790,13 +3731,11 @@ int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len) | |||
3790 | } | 3731 | } |
3791 | 3732 | ||
3792 | 3733 | ||
3793 | int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid) | 3734 | int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid) |
3794 | { | 3735 | { |
3795 | struct ieee80211_sub_if_data *sdata; | ||
3796 | struct ieee80211_if_sta *ifsta; | 3736 | struct ieee80211_if_sta *ifsta; |
3797 | int res; | 3737 | int res; |
3798 | 3738 | ||
3799 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3800 | ifsta = &sdata->u.sta; | 3739 | ifsta = &sdata->u.sta; |
3801 | 3740 | ||
3802 | if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { | 3741 | if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { |
@@ -3809,7 +3748,7 @@ int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid) | |||
3809 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID); | 3748 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID); |
3810 | if (res) { | 3749 | if (res) { |
3811 | printk(KERN_DEBUG "%s: Failed to config new BSSID to " | 3750 | printk(KERN_DEBUG "%s: Failed to config new BSSID to " |
3812 | "the low-level driver\n", dev->name); | 3751 | "the low-level driver\n", sdata->dev->name); |
3813 | return res; | 3752 | return res; |
3814 | } | 3753 | } |
3815 | } | 3754 | } |
@@ -3850,7 +3789,7 @@ static void ieee80211_send_nullfunc(struct ieee80211_local *local, | |||
3850 | memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN); | 3789 | memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN); |
3851 | memcpy(nullfunc->addr3, sdata->u.sta.bssid, ETH_ALEN); | 3790 | memcpy(nullfunc->addr3, sdata->u.sta.bssid, ETH_ALEN); |
3852 | 3791 | ||
3853 | ieee80211_sta_tx(sdata->dev, skb, 0); | 3792 | ieee80211_sta_tx(sdata, skb, 0); |
3854 | } | 3793 | } |
3855 | 3794 | ||
3856 | 3795 | ||
@@ -3922,9 +3861,9 @@ done: | |||
3922 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 3861 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
3923 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 3862 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
3924 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || | 3863 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || |
3925 | (!(ifsta->state == IEEE80211_IBSS_JOINED) && | 3864 | (!(ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED) && |
3926 | !ieee80211_sta_active_ibss(dev))) | 3865 | !ieee80211_sta_active_ibss(sdata))) |
3927 | ieee80211_sta_find_ibss(dev, ifsta); | 3866 | ieee80211_sta_find_ibss(sdata, ifsta); |
3928 | } | 3867 | } |
3929 | } | 3868 | } |
3930 | EXPORT_SYMBOL(ieee80211_scan_completed); | 3869 | EXPORT_SYMBOL(ieee80211_scan_completed); |
@@ -4013,7 +3952,7 @@ void ieee80211_sta_scan_work(struct work_struct *work) | |||
4013 | 3952 | ||
4014 | if (local->scan_channel->flags & IEEE80211_CHAN_PASSIVE_SCAN) | 3953 | if (local->scan_channel->flags & IEEE80211_CHAN_PASSIVE_SCAN) |
4015 | break; | 3954 | break; |
4016 | ieee80211_send_probe_req(dev, NULL, local->scan_ssid, | 3955 | ieee80211_send_probe_req(sdata, NULL, local->scan_ssid, |
4017 | local->scan_ssid_len); | 3956 | local->scan_ssid_len); |
4018 | next_delay = IEEE80211_CHANNEL_TIME; | 3957 | next_delay = IEEE80211_CHANNEL_TIME; |
4019 | break; | 3958 | break; |
@@ -4025,10 +3964,10 @@ void ieee80211_sta_scan_work(struct work_struct *work) | |||
4025 | } | 3964 | } |
4026 | 3965 | ||
4027 | 3966 | ||
4028 | static int ieee80211_sta_start_scan(struct net_device *dev, | 3967 | static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, |
4029 | u8 *ssid, size_t ssid_len) | 3968 | u8 *ssid, size_t ssid_len) |
4030 | { | 3969 | { |
4031 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3970 | struct ieee80211_local *local = scan_sdata->local; |
4032 | struct ieee80211_sub_if_data *sdata; | 3971 | struct ieee80211_sub_if_data *sdata; |
4033 | 3972 | ||
4034 | if (ssid_len > IEEE80211_MAX_SSID_LEN) | 3973 | if (ssid_len > IEEE80211_MAX_SSID_LEN) |
@@ -4052,7 +3991,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4052 | */ | 3991 | */ |
4053 | 3992 | ||
4054 | if (local->sta_sw_scanning || local->sta_hw_scanning) { | 3993 | if (local->sta_sw_scanning || local->sta_hw_scanning) { |
4055 | if (local->scan_dev == dev) | 3994 | if (local->scan_dev == scan_sdata->dev) |
4056 | return 0; | 3995 | return 0; |
4057 | return -EBUSY; | 3996 | return -EBUSY; |
4058 | } | 3997 | } |
@@ -4062,7 +4001,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4062 | ssid, ssid_len); | 4001 | ssid, ssid_len); |
4063 | if (!rc) { | 4002 | if (!rc) { |
4064 | local->sta_hw_scanning = 1; | 4003 | local->sta_hw_scanning = 1; |
4065 | local->scan_dev = dev; | 4004 | local->scan_dev = scan_sdata->dev; |
4066 | } | 4005 | } |
4067 | return rc; | 4006 | return rc; |
4068 | } | 4007 | } |
@@ -4086,7 +4025,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4086 | local->scan_state = SCAN_SET_CHANNEL; | 4025 | local->scan_state = SCAN_SET_CHANNEL; |
4087 | local->scan_channel_idx = 0; | 4026 | local->scan_channel_idx = 0; |
4088 | local->scan_band = IEEE80211_BAND_2GHZ; | 4027 | local->scan_band = IEEE80211_BAND_2GHZ; |
4089 | local->scan_dev = dev; | 4028 | local->scan_dev = scan_sdata->dev; |
4090 | 4029 | ||
4091 | netif_addr_lock_bh(local->mdev); | 4030 | netif_addr_lock_bh(local->mdev); |
4092 | local->filter_flags |= FIF_BCN_PRBRESP_PROMISC; | 4031 | local->filter_flags |= FIF_BCN_PRBRESP_PROMISC; |
@@ -4105,17 +4044,16 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4105 | } | 4044 | } |
4106 | 4045 | ||
4107 | 4046 | ||
4108 | int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len) | 4047 | int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len) |
4109 | { | 4048 | { |
4110 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4111 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 4049 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
4112 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 4050 | struct ieee80211_local *local = sdata->local; |
4113 | 4051 | ||
4114 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 4052 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
4115 | return ieee80211_sta_start_scan(dev, ssid, ssid_len); | 4053 | return ieee80211_sta_start_scan(sdata, ssid, ssid_len); |
4116 | 4054 | ||
4117 | if (local->sta_sw_scanning || local->sta_hw_scanning) { | 4055 | if (local->sta_sw_scanning || local->sta_hw_scanning) { |
4118 | if (local->scan_dev == dev) | 4056 | if (local->scan_dev == sdata->dev) |
4119 | return 0; | 4057 | return 0; |
4120 | return -EBUSY; | 4058 | return -EBUSY; |
4121 | } | 4059 | } |
@@ -4128,13 +4066,54 @@ int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len) | |||
4128 | return 0; | 4066 | return 0; |
4129 | } | 4067 | } |
4130 | 4068 | ||
4069 | |||
4070 | static void ieee80211_sta_add_scan_ies(struct iw_request_info *info, | ||
4071 | struct ieee80211_sta_bss *bss, | ||
4072 | char **current_ev, char *end_buf) | ||
4073 | { | ||
4074 | u8 *pos, *end, *next; | ||
4075 | struct iw_event iwe; | ||
4076 | |||
4077 | if (bss == NULL || bss->ies == NULL) | ||
4078 | return; | ||
4079 | |||
4080 | /* | ||
4081 | * If needed, fragment the IEs buffer (at IE boundaries) into short | ||
4082 | * enough fragments to fit into IW_GENERIC_IE_MAX octet messages. | ||
4083 | */ | ||
4084 | pos = bss->ies; | ||
4085 | end = pos + bss->ies_len; | ||
4086 | |||
4087 | while (end - pos > IW_GENERIC_IE_MAX) { | ||
4088 | next = pos + 2 + pos[1]; | ||
4089 | while (next + 2 + next[1] - pos < IW_GENERIC_IE_MAX) | ||
4090 | next = next + 2 + next[1]; | ||
4091 | |||
4092 | memset(&iwe, 0, sizeof(iwe)); | ||
4093 | iwe.cmd = IWEVGENIE; | ||
4094 | iwe.u.data.length = next - pos; | ||
4095 | *current_ev = iwe_stream_add_point(info, *current_ev, | ||
4096 | end_buf, &iwe, pos); | ||
4097 | |||
4098 | pos = next; | ||
4099 | } | ||
4100 | |||
4101 | if (end > pos) { | ||
4102 | memset(&iwe, 0, sizeof(iwe)); | ||
4103 | iwe.cmd = IWEVGENIE; | ||
4104 | iwe.u.data.length = end - pos; | ||
4105 | *current_ev = iwe_stream_add_point(info, *current_ev, | ||
4106 | end_buf, &iwe, pos); | ||
4107 | } | ||
4108 | } | ||
4109 | |||
4110 | |||
4131 | static char * | 4111 | static char * |
4132 | ieee80211_sta_scan_result(struct net_device *dev, | 4112 | ieee80211_sta_scan_result(struct ieee80211_local *local, |
4133 | struct iw_request_info *info, | 4113 | struct iw_request_info *info, |
4134 | struct ieee80211_sta_bss *bss, | 4114 | struct ieee80211_sta_bss *bss, |
4135 | char *current_ev, char *end_buf) | 4115 | char *current_ev, char *end_buf) |
4136 | { | 4116 | { |
4137 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
4138 | struct iw_event iwe; | 4117 | struct iw_event iwe; |
4139 | 4118 | ||
4140 | if (time_after(jiffies, | 4119 | if (time_after(jiffies, |
@@ -4208,29 +4187,7 @@ ieee80211_sta_scan_result(struct net_device *dev, | |||
4208 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, | 4187 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
4209 | &iwe, ""); | 4188 | &iwe, ""); |
4210 | 4189 | ||
4211 | if (bss && bss->wpa_ie) { | 4190 | ieee80211_sta_add_scan_ies(info, bss, ¤t_ev, end_buf); |
4212 | memset(&iwe, 0, sizeof(iwe)); | ||
4213 | iwe.cmd = IWEVGENIE; | ||
4214 | iwe.u.data.length = bss->wpa_ie_len; | ||
4215 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, | ||
4216 | &iwe, bss->wpa_ie); | ||
4217 | } | ||
4218 | |||
4219 | if (bss && bss->rsn_ie) { | ||
4220 | memset(&iwe, 0, sizeof(iwe)); | ||
4221 | iwe.cmd = IWEVGENIE; | ||
4222 | iwe.u.data.length = bss->rsn_ie_len; | ||
4223 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, | ||
4224 | &iwe, bss->rsn_ie); | ||
4225 | } | ||
4226 | |||
4227 | if (bss && bss->ht_ie) { | ||
4228 | memset(&iwe, 0, sizeof(iwe)); | ||
4229 | iwe.cmd = IWEVGENIE; | ||
4230 | iwe.u.data.length = bss->ht_ie_len; | ||
4231 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, | ||
4232 | &iwe, bss->ht_ie); | ||
4233 | } | ||
4234 | 4191 | ||
4235 | if (bss && bss->supp_rates_len > 0) { | 4192 | if (bss && bss->supp_rates_len > 0) { |
4236 | /* display all supported rates in readable format */ | 4193 | /* display all supported rates in readable format */ |
@@ -4321,11 +4278,10 @@ ieee80211_sta_scan_result(struct net_device *dev, | |||
4321 | } | 4278 | } |
4322 | 4279 | ||
4323 | 4280 | ||
4324 | int ieee80211_sta_scan_results(struct net_device *dev, | 4281 | int ieee80211_sta_scan_results(struct ieee80211_local *local, |
4325 | struct iw_request_info *info, | 4282 | struct iw_request_info *info, |
4326 | char *buf, size_t len) | 4283 | char *buf, size_t len) |
4327 | { | 4284 | { |
4328 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
4329 | char *current_ev = buf; | 4285 | char *current_ev = buf; |
4330 | char *end_buf = buf + len; | 4286 | char *end_buf = buf + len; |
4331 | struct ieee80211_sta_bss *bss; | 4287 | struct ieee80211_sta_bss *bss; |
@@ -4336,7 +4292,7 @@ int ieee80211_sta_scan_results(struct net_device *dev, | |||
4336 | spin_unlock_bh(&local->sta_bss_lock); | 4292 | spin_unlock_bh(&local->sta_bss_lock); |
4337 | return -E2BIG; | 4293 | return -E2BIG; |
4338 | } | 4294 | } |
4339 | current_ev = ieee80211_sta_scan_result(dev, info, bss, | 4295 | current_ev = ieee80211_sta_scan_result(local, info, bss, |
4340 | current_ev, end_buf); | 4296 | current_ev, end_buf); |
4341 | } | 4297 | } |
4342 | spin_unlock_bh(&local->sta_bss_lock); | 4298 | spin_unlock_bh(&local->sta_bss_lock); |
@@ -4344,9 +4300,8 @@ int ieee80211_sta_scan_results(struct net_device *dev, | |||
4344 | } | 4300 | } |
4345 | 4301 | ||
4346 | 4302 | ||
4347 | int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len) | 4303 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len) |
4348 | { | 4304 | { |
4349 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4350 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 4305 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
4351 | 4306 | ||
4352 | kfree(ifsta->extra_ie); | 4307 | kfree(ifsta->extra_ie); |
@@ -4366,13 +4321,12 @@ int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len) | |||
4366 | } | 4321 | } |
4367 | 4322 | ||
4368 | 4323 | ||
4369 | struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | 4324 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, |
4370 | struct sk_buff *skb, u8 *bssid, | 4325 | struct sk_buff *skb, u8 *bssid, |
4371 | u8 *addr, u64 supp_rates) | 4326 | u8 *addr, u64 supp_rates) |
4372 | { | 4327 | { |
4373 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 4328 | struct ieee80211_local *local = sdata->local; |
4374 | struct sta_info *sta; | 4329 | struct sta_info *sta; |
4375 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4376 | DECLARE_MAC_BUF(mac); | 4330 | DECLARE_MAC_BUF(mac); |
4377 | int band = local->hw.conf.channel->band; | 4331 | int band = local->hw.conf.channel->band; |
4378 | 4332 | ||
@@ -4381,7 +4335,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | |||
4381 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 4335 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
4382 | if (net_ratelimit()) { | 4336 | if (net_ratelimit()) { |
4383 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " | 4337 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " |
4384 | "entry %s\n", dev->name, print_mac(mac, addr)); | 4338 | "entry %s\n", sdata->dev->name, print_mac(mac, addr)); |
4385 | } | 4339 | } |
4386 | return NULL; | 4340 | return NULL; |
4387 | } | 4341 | } |
@@ -4391,7 +4345,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | |||
4391 | 4345 | ||
4392 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 4346 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
4393 | printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", | 4347 | printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", |
4394 | wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name); | 4348 | wiphy_name(local->hw.wiphy), print_mac(mac, addr), sdata->dev->name); |
4395 | #endif | 4349 | #endif |
4396 | 4350 | ||
4397 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); | 4351 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); |
@@ -4400,10 +4354,9 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | |||
4400 | 4354 | ||
4401 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); | 4355 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); |
4402 | 4356 | ||
4403 | if (supp_rates) | 4357 | /* make sure mandatory rates are always added */ |
4404 | sta->supp_rates[band] = supp_rates; | 4358 | sta->supp_rates[band] = supp_rates | |
4405 | else | 4359 | ieee80211_sta_get_mandatory_rates(local, band); |
4406 | sta->supp_rates[band] = sdata->u.sta.supp_rates_bits[band]; | ||
4407 | 4360 | ||
4408 | rate_control_rate_init(sta, local); | 4361 | rate_control_rate_init(sta, local); |
4409 | 4362 | ||
@@ -4414,31 +4367,29 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | |||
4414 | } | 4367 | } |
4415 | 4368 | ||
4416 | 4369 | ||
4417 | int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason) | 4370 | int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason) |
4418 | { | 4371 | { |
4419 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4420 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 4372 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
4421 | 4373 | ||
4422 | printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", | 4374 | printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", |
4423 | dev->name, reason); | 4375 | sdata->dev->name, reason); |
4424 | 4376 | ||
4425 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 4377 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && |
4426 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 4378 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) |
4427 | return -EINVAL; | 4379 | return -EINVAL; |
4428 | 4380 | ||
4429 | ieee80211_send_deauth(dev, ifsta, reason); | 4381 | ieee80211_send_deauth(sdata, ifsta, reason); |
4430 | ieee80211_set_disassoc(dev, ifsta, 1); | 4382 | ieee80211_set_disassoc(sdata, ifsta, 1); |
4431 | return 0; | 4383 | return 0; |
4432 | } | 4384 | } |
4433 | 4385 | ||
4434 | 4386 | ||
4435 | int ieee80211_sta_disassociate(struct net_device *dev, u16 reason) | 4387 | int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason) |
4436 | { | 4388 | { |
4437 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4438 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 4389 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
4439 | 4390 | ||
4440 | printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", | 4391 | printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", |
4441 | dev->name, reason); | 4392 | sdata->dev->name, reason); |
4442 | 4393 | ||
4443 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 4394 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
4444 | return -EINVAL; | 4395 | return -EINVAL; |
@@ -4446,8 +4397,8 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason) | |||
4446 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) | 4397 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) |
4447 | return -1; | 4398 | return -1; |
4448 | 4399 | ||
4449 | ieee80211_send_disassoc(dev, ifsta, reason); | 4400 | ieee80211_send_disassoc(sdata, ifsta, reason); |
4450 | ieee80211_set_disassoc(dev, ifsta, 0); | 4401 | ieee80211_set_disassoc(sdata, ifsta, 0); |
4451 | return 0; | 4402 | return 0; |
4452 | } | 4403 | } |
4453 | 4404 | ||
@@ -4464,7 +4415,7 @@ void ieee80211_notify_mac(struct ieee80211_hw *hw, | |||
4464 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 4415 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
4465 | continue; | 4416 | continue; |
4466 | 4417 | ||
4467 | ieee80211_sta_req_auth(sdata->dev, &sdata->u.sta); | 4418 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
4468 | } | 4419 | } |
4469 | rcu_read_unlock(); | 4420 | rcu_read_unlock(); |
4470 | break; | 4421 | break; |