mlme.c (e7d9facf0bab6d919342fea17c8cc0f65f8a0fe9) | mlme.c (55de908ab292c03f1eb280f51170ddb9c6b57e31) |
---|---|
1/* 2 * BSS client mode implementation 3 * Copyright 2003-2008, Jouni Malinen <j@w1.fi> 4 * Copyright 2004, Instant802 Networks, Inc. 5 * Copyright 2005, Devicescape Software, Inc. 6 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 7 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 8 * --- 164 unchanged lines hidden (view full) --- 173} 174 175static u32 ieee80211_config_ht_tx(struct ieee80211_sub_if_data *sdata, 176 struct ieee80211_ht_operation *ht_oper, 177 const u8 *bssid, bool reconfig) 178{ 179 struct ieee80211_local *local = sdata->local; 180 struct ieee80211_supported_band *sband; | 1/* 2 * BSS client mode implementation 3 * Copyright 2003-2008, Jouni Malinen <j@w1.fi> 4 * Copyright 2004, Instant802 Networks, Inc. 5 * Copyright 2005, Devicescape Software, Inc. 6 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 7 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 8 * --- 164 unchanged lines hidden (view full) --- 173} 174 175static u32 ieee80211_config_ht_tx(struct ieee80211_sub_if_data *sdata, 176 struct ieee80211_ht_operation *ht_oper, 177 const u8 *bssid, bool reconfig) 178{ 179 struct ieee80211_local *local = sdata->local; 180 struct ieee80211_supported_band *sband; |
181 struct ieee80211_chanctx_conf *chanctx_conf; 182 struct ieee80211_channel *chan; |
|
181 struct sta_info *sta; 182 u32 changed = 0; 183 u16 ht_opmode; 184 bool disable_40 = false; 185 | 183 struct sta_info *sta; 184 u32 changed = 0; 185 u16 ht_opmode; 186 bool disable_40 = false; 187 |
186 sband = local->hw.wiphy->bands[local->oper_channel->band]; | 188 rcu_read_lock(); 189 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 190 if (WARN_ON(!chanctx_conf)) { 191 rcu_read_unlock(); 192 return 0; 193 } 194 chan = chanctx_conf->channel; 195 rcu_read_unlock(); 196 sband = local->hw.wiphy->bands[chan->band]; |
187 188 switch (sdata->vif.bss_conf.channel_type) { 189 case NL80211_CHAN_HT40PLUS: | 197 198 switch (sdata->vif.bss_conf.channel_type) { 199 case NL80211_CHAN_HT40PLUS: |
190 if (local->oper_channel->flags & IEEE80211_CHAN_NO_HT40PLUS) | 200 if (chan->flags & IEEE80211_CHAN_NO_HT40PLUS) |
191 disable_40 = true; 192 break; 193 case NL80211_CHAN_HT40MINUS: | 201 disable_40 = true; 202 break; 203 case NL80211_CHAN_HT40MINUS: |
194 if (local->oper_channel->flags & IEEE80211_CHAN_NO_HT40MINUS) | 204 if (chan->flags & IEEE80211_CHAN_NO_HT40MINUS) |
195 disable_40 = true; 196 break; 197 default: 198 break; 199 } 200 201 /* This can change during the lifetime of the BSS */ 202 if (!(ht_oper->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) --- 151 unchanged lines hidden (view full) --- 354 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; 355 struct sk_buff *skb; 356 struct ieee80211_mgmt *mgmt; 357 u8 *pos, qos_info; 358 size_t offset = 0, noffset; 359 int i, count, rates_len, supp_rates_len; 360 u16 capab; 361 struct ieee80211_supported_band *sband; | 205 disable_40 = true; 206 break; 207 default: 208 break; 209 } 210 211 /* This can change during the lifetime of the BSS */ 212 if (!(ht_oper->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) --- 151 unchanged lines hidden (view full) --- 364 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; 365 struct sk_buff *skb; 366 struct ieee80211_mgmt *mgmt; 367 u8 *pos, qos_info; 368 size_t offset = 0, noffset; 369 int i, count, rates_len, supp_rates_len; 370 u16 capab; 371 struct ieee80211_supported_band *sband; |
372 struct ieee80211_chanctx_conf *chanctx_conf; 373 struct ieee80211_channel *chan; |
|
362 u32 rates = 0; 363 364 lockdep_assert_held(&ifmgd->mtx); 365 | 374 u32 rates = 0; 375 376 lockdep_assert_held(&ifmgd->mtx); 377 |
366 sband = local->hw.wiphy->bands[local->oper_channel->band]; | 378 rcu_read_lock(); 379 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 380 if (WARN_ON(!chanctx_conf)) { 381 rcu_read_unlock(); 382 return; 383 } 384 chan = chanctx_conf->channel; 385 rcu_read_unlock(); 386 sband = local->hw.wiphy->bands[chan->band]; |
367 368 if (assoc_data->supp_rates_len) { 369 /* 370 * Get all rates supported by the device and the AP as 371 * some APs don't like getting a superset of their rates 372 * in the association request (e.g. D-Link DAP 1353 in 373 * b-only mode)... 374 */ --- 105 unchanged lines hidden (view full) --- 480 } 481 482 if (capab & WLAN_CAPABILITY_SPECTRUM_MGMT) { 483 /* 1. power capabilities */ 484 pos = skb_put(skb, 4); 485 *pos++ = WLAN_EID_PWR_CAPABILITY; 486 *pos++ = 2; 487 *pos++ = 0; /* min tx power */ | 387 388 if (assoc_data->supp_rates_len) { 389 /* 390 * Get all rates supported by the device and the AP as 391 * some APs don't like getting a superset of their rates 392 * in the association request (e.g. D-Link DAP 1353 in 393 * b-only mode)... 394 */ --- 105 unchanged lines hidden (view full) --- 500 } 501 502 if (capab & WLAN_CAPABILITY_SPECTRUM_MGMT) { 503 /* 1. power capabilities */ 504 pos = skb_put(skb, 4); 505 *pos++ = WLAN_EID_PWR_CAPABILITY; 506 *pos++ = 2; 507 *pos++ = 0; /* min tx power */ |
488 *pos++ = local->oper_channel->max_power; /* max tx power */ | 508 *pos++ = chan->max_power; /* max tx power */ |
489 490 /* 2. supported channels */ 491 /* TODO: get this in reg domain format */ 492 pos = skb_put(skb, 2 * sband->n_channels + 2); 493 *pos++ = WLAN_EID_SUPPORTED_CHANNELS; 494 *pos++ = 2 * sband->n_channels; 495 for (i = 0; i < sband->n_channels; i++) { 496 *pos++ = ieee80211_frequency_to_channel( --- 21 unchanged lines hidden (view full) --- 518 offset); 519 pos = skb_put(skb, noffset - offset); 520 memcpy(pos, assoc_data->ie + offset, noffset - offset); 521 offset = noffset; 522 } 523 524 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) 525 ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, | 509 510 /* 2. supported channels */ 511 /* TODO: get this in reg domain format */ 512 pos = skb_put(skb, 2 * sband->n_channels + 2); 513 *pos++ = WLAN_EID_SUPPORTED_CHANNELS; 514 *pos++ = 2 * sband->n_channels; 515 for (i = 0; i < sband->n_channels; i++) { 516 *pos++ = ieee80211_frequency_to_channel( --- 21 unchanged lines hidden (view full) --- 538 offset); 539 pos = skb_put(skb, noffset - offset); 540 memcpy(pos, assoc_data->ie + offset, noffset - offset); 541 offset = noffset; 542 } 543 544 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) 545 ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, |
526 sband, local->oper_channel, ifmgd->ap_smps); | 546 sband, chan, ifmgd->ap_smps); |
527 528 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) 529 ieee80211_add_vht_ie(sdata, skb, sband); 530 531 /* if present, add any custom non-vendor IEs that go after HT */ 532 if (assoc_data->ie_len && assoc_data->ie) { 533 noffset = ieee80211_ie_split_vendor(assoc_data->ie, 534 assoc_data->ie_len, --- 117 unchanged lines hidden (view full) --- 652 653 if (!ieee80211_sdata_running(sdata)) 654 return; 655 656 mutex_lock(&ifmgd->mtx); 657 if (!ifmgd->associated) 658 goto out; 659 | 547 548 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) 549 ieee80211_add_vht_ie(sdata, skb, sband); 550 551 /* if present, add any custom non-vendor IEs that go after HT */ 552 if (assoc_data->ie_len && assoc_data->ie) { 553 noffset = ieee80211_ie_split_vendor(assoc_data->ie, 554 assoc_data->ie_len, --- 117 unchanged lines hidden (view full) --- 672 673 if (!ieee80211_sdata_running(sdata)) 674 return; 675 676 mutex_lock(&ifmgd->mtx); 677 if (!ifmgd->associated) 678 goto out; 679 |
660 sdata->local->oper_channel = sdata->local->csa_channel; | 680 sdata->local->_oper_channel = sdata->local->csa_channel; |
661 if (!sdata->local->ops->channel_switch) { 662 /* call "hw_config" only if doing sw channel switch */ 663 ieee80211_hw_config(sdata->local, 664 IEEE80211_CONF_CHANGE_CHANNEL); 665 } else { 666 /* update the device channel directly */ | 681 if (!sdata->local->ops->channel_switch) { 682 /* call "hw_config" only if doing sw channel switch */ 683 ieee80211_hw_config(sdata->local, 684 IEEE80211_CONF_CHANGE_CHANNEL); 685 } else { 686 /* update the device channel directly */ |
667 sdata->local->hw.conf.channel = sdata->local->oper_channel; | 687 sdata->local->hw.conf.channel = sdata->local->_oper_channel; |
668 } 669 670 /* XXX: shouldn't really modify cfg80211-owned data! */ | 688 } 689 690 /* XXX: shouldn't really modify cfg80211-owned data! */ |
671 ifmgd->associated->channel = sdata->local->oper_channel; | 691 ifmgd->associated->channel = sdata->local->_oper_channel; |
672 673 /* XXX: wait for a beacon first? */ 674 ieee80211_wake_queues_by_reason(&sdata->local->hw, 675 IEEE80211_QUEUE_STOP_REASON_CSA); 676 out: 677 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED; 678 mutex_unlock(&ifmgd->mtx); 679} 680 681void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success) 682{ | 692 693 /* XXX: wait for a beacon first? */ 694 ieee80211_wake_queues_by_reason(&sdata->local->hw, 695 IEEE80211_QUEUE_STOP_REASON_CSA); 696 out: 697 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED; 698 mutex_unlock(&ifmgd->mtx); 699} 700 701void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success) 702{ |
683 struct ieee80211_sub_if_data *sdata; 684 struct ieee80211_if_managed *ifmgd; | 703 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 704 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
685 | 705 |
686 sdata = vif_to_sdata(vif); 687 ifmgd = &sdata->u.mgd; 688 | |
689 trace_api_chswitch_done(sdata, success); 690 if (!success) { 691 sdata_info(sdata, 692 "driver channel switch failed, disconnecting\n"); 693 ieee80211_queue_work(&sdata->local->hw, 694 &ifmgd->csa_connection_drop_work); 695 } else { 696 ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); --- 21 unchanged lines hidden (view full) --- 718 u64 timestamp) 719{ 720 struct cfg80211_bss *cbss = 721 container_of((void *)bss, struct cfg80211_bss, priv); 722 struct ieee80211_channel *new_ch; 723 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 724 int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num, 725 cbss->channel->band); | 706 trace_api_chswitch_done(sdata, success); 707 if (!success) { 708 sdata_info(sdata, 709 "driver channel switch failed, disconnecting\n"); 710 ieee80211_queue_work(&sdata->local->hw, 711 &ifmgd->csa_connection_drop_work); 712 } else { 713 ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); --- 21 unchanged lines hidden (view full) --- 735 u64 timestamp) 736{ 737 struct cfg80211_bss *cbss = 738 container_of((void *)bss, struct cfg80211_bss, priv); 739 struct ieee80211_channel *new_ch; 740 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 741 int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num, 742 cbss->channel->band); |
743 struct ieee80211_chanctx *chanctx; |
|
726 727 ASSERT_MGD_MTX(ifmgd); 728 729 if (!ifmgd->associated) 730 return; 731 732 if (sdata->local->scanning) 733 return; --- 9 unchanged lines hidden (view full) --- 743 sdata_info(sdata, 744 "AP %pM switches to unsupported channel (%d MHz), disconnecting\n", 745 ifmgd->associated->bssid, new_freq); 746 ieee80211_queue_work(&sdata->local->hw, 747 &ifmgd->csa_connection_drop_work); 748 return; 749 } 750 | 744 745 ASSERT_MGD_MTX(ifmgd); 746 747 if (!ifmgd->associated) 748 return; 749 750 if (sdata->local->scanning) 751 return; --- 9 unchanged lines hidden (view full) --- 761 sdata_info(sdata, 762 "AP %pM switches to unsupported channel (%d MHz), disconnecting\n", 763 ifmgd->associated->bssid, new_freq); 764 ieee80211_queue_work(&sdata->local->hw, 765 &ifmgd->csa_connection_drop_work); 766 return; 767 } 768 |
751 sdata->local->csa_channel = new_ch; 752 | |
753 ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; 754 | 769 ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; 770 |
771 if (sdata->local->use_chanctx) { 772 sdata_info(sdata, 773 "not handling channel switch with channel contexts\n"); 774 ieee80211_queue_work(&sdata->local->hw, 775 &ifmgd->csa_connection_drop_work); 776 } 777 778 mutex_lock(&sdata->local->chanctx_mtx); 779 if (WARN_ON(!rcu_access_pointer(sdata->vif.chanctx_conf))) { 780 mutex_unlock(&sdata->local->chanctx_mtx); 781 return; 782 } 783 chanctx = container_of(rcu_access_pointer(sdata->vif.chanctx_conf), 784 struct ieee80211_chanctx, conf); 785 if (chanctx->refcount > 1) { 786 sdata_info(sdata, 787 "channel switch with multiple interfaces on the same channel, disconnecting\n"); 788 ieee80211_queue_work(&sdata->local->hw, 789 &ifmgd->csa_connection_drop_work); 790 mutex_unlock(&sdata->local->chanctx_mtx); 791 return; 792 } 793 mutex_unlock(&sdata->local->chanctx_mtx); 794 795 sdata->local->csa_channel = new_ch; 796 |
|
755 if (sw_elem->mode) 756 ieee80211_stop_queues_by_reason(&sdata->local->hw, 757 IEEE80211_QUEUE_STOP_REASON_CSA); 758 759 if (sdata->local->ops->channel_switch) { 760 /* use driver's channel switch callback */ 761 struct ieee80211_channel_switch ch_switch = { 762 .timestamp = timestamp, --- 512 unchanged lines hidden (view full) --- 1275 use_protection = (erp & WLAN_ERP_USE_PROTECTION) != 0; 1276 use_short_preamble = (erp & WLAN_ERP_BARKER_PREAMBLE) == 0; 1277 } else { 1278 use_protection = false; 1279 use_short_preamble = !!(capab & WLAN_CAPABILITY_SHORT_PREAMBLE); 1280 } 1281 1282 use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); | 797 if (sw_elem->mode) 798 ieee80211_stop_queues_by_reason(&sdata->local->hw, 799 IEEE80211_QUEUE_STOP_REASON_CSA); 800 801 if (sdata->local->ops->channel_switch) { 802 /* use driver's channel switch callback */ 803 struct ieee80211_channel_switch ch_switch = { 804 .timestamp = timestamp, --- 512 unchanged lines hidden (view full) --- 1317 use_protection = (erp & WLAN_ERP_USE_PROTECTION) != 0; 1318 use_short_preamble = (erp & WLAN_ERP_BARKER_PREAMBLE) == 0; 1319 } else { 1320 use_protection = false; 1321 use_short_preamble = !!(capab & WLAN_CAPABILITY_SHORT_PREAMBLE); 1322 } 1323 1324 use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); |
1283 if (sdata->local->oper_channel->band == IEEE80211_BAND_5GHZ) | 1325 if (ieee80211_get_sdata_band(sdata) == IEEE80211_BAND_5GHZ) |
1284 use_short_slot = true; 1285 1286 if (use_protection != bss_conf->use_cts_prot) { 1287 bss_conf->use_cts_prot = use_protection; 1288 changed |= BSS_CHANGED_ERP_CTS_PROT; 1289 } 1290 1291 if (use_short_preamble != bss_conf->use_short_preamble) { --- 168 unchanged lines hidden (view full) --- 1460 1461 sdata->vif.bss_conf.qos = false; 1462 changed |= BSS_CHANGED_QOS; 1463 1464 /* The BSSID (not really interesting) and HT changed */ 1465 changed |= BSS_CHANGED_BSSID | BSS_CHANGED_HT; 1466 ieee80211_bss_info_change_notify(sdata, changed); 1467 | 1326 use_short_slot = true; 1327 1328 if (use_protection != bss_conf->use_cts_prot) { 1329 bss_conf->use_cts_prot = use_protection; 1330 changed |= BSS_CHANGED_ERP_CTS_PROT; 1331 } 1332 1333 if (use_short_preamble != bss_conf->use_short_preamble) { --- 168 unchanged lines hidden (view full) --- 1502 1503 sdata->vif.bss_conf.qos = false; 1504 changed |= BSS_CHANGED_QOS; 1505 1506 /* The BSSID (not really interesting) and HT changed */ 1507 changed |= BSS_CHANGED_BSSID | BSS_CHANGED_HT; 1508 ieee80211_bss_info_change_notify(sdata, changed); 1509 |
1468 /* channel(_type) changes are handled by ieee80211_hw_config */ 1469 WARN_ON(!ieee80211_set_channel_type(local, sdata, NL80211_CHAN_NO_HT)); 1470 ieee80211_hw_config(local, 0); | 1510 ieee80211_vif_release_channel(sdata); |
1471 1472 /* disassociated - set to defaults now */ 1473 ieee80211_set_wmm_default(sdata, false); 1474 1475 del_timer_sync(&sdata->u.mgd.conn_mon_timer); 1476 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); 1477 del_timer_sync(&sdata->u.mgd.timer); 1478 del_timer_sync(&sdata->u.mgd.chswitch_timer); --- 105 unchanged lines hidden (view full) --- 1584 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); 1585 if (WARN_ON_ONCE(ssid == NULL)) 1586 ssid_len = 0; 1587 else 1588 ssid_len = ssid[1]; 1589 1590 ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid_len, NULL, 1591 0, (u32) -1, true, false, | 1511 1512 /* disassociated - set to defaults now */ 1513 ieee80211_set_wmm_default(sdata, false); 1514 1515 del_timer_sync(&sdata->u.mgd.conn_mon_timer); 1516 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); 1517 del_timer_sync(&sdata->u.mgd.timer); 1518 del_timer_sync(&sdata->u.mgd.chswitch_timer); --- 105 unchanged lines hidden (view full) --- 1624 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); 1625 if (WARN_ON_ONCE(ssid == NULL)) 1626 ssid_len = 0; 1627 else 1628 ssid_len = ssid[1]; 1629 1630 ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid_len, NULL, 1631 0, (u32) -1, true, false, |
1592 ifmgd->associated->channel); | 1632 ifmgd->associated->channel, false); |
1593 } 1594 1595 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); 1596 run_again(ifmgd, ifmgd->probe_timeout); 1597 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 1598 drv_flush(sdata->local, false); 1599} 1600 --- 86 unchanged lines hidden (view full) --- 1687 1688 ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID); 1689 if (WARN_ON_ONCE(ssid == NULL)) 1690 ssid_len = 0; 1691 else 1692 ssid_len = ssid[1]; 1693 1694 skb = ieee80211_build_probe_req(sdata, cbss->bssid, | 1633 } 1634 1635 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); 1636 run_again(ifmgd, ifmgd->probe_timeout); 1637 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 1638 drv_flush(sdata->local, false); 1639} 1640 --- 86 unchanged lines hidden (view full) --- 1727 1728 ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID); 1729 if (WARN_ON_ONCE(ssid == NULL)) 1730 ssid_len = 0; 1731 else 1732 ssid_len = ssid[1]; 1733 1734 skb = ieee80211_build_probe_req(sdata, cbss->bssid, |
1695 (u32) -1, 1696 sdata->local->oper_channel, | 1735 (u32) -1, cbss->channel, |
1697 ssid + 2, ssid_len, 1698 NULL, 0, true); 1699 1700 return skb; 1701} 1702EXPORT_SYMBOL(ieee80211_ap_probereq_get); 1703 1704static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata, --- 94 unchanged lines hidden (view full) --- 1799 1800 lockdep_assert_held(&sdata->u.mgd.mtx); 1801 1802 if (!assoc) { 1803 sta_info_destroy_addr(sdata, auth_data->bss->bssid); 1804 1805 memset(sdata->u.mgd.bssid, 0, ETH_ALEN); 1806 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID); | 1736 ssid + 2, ssid_len, 1737 NULL, 0, true); 1738 1739 return skb; 1740} 1741EXPORT_SYMBOL(ieee80211_ap_probereq_get); 1742 1743static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata, --- 94 unchanged lines hidden (view full) --- 1838 1839 lockdep_assert_held(&sdata->u.mgd.mtx); 1840 1841 if (!assoc) { 1842 sta_info_destroy_addr(sdata, auth_data->bss->bssid); 1843 1844 memset(sdata->u.mgd.bssid, 0, ETH_ALEN); 1845 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID); |
1846 ieee80211_vif_release_channel(sdata); |
|
1807 } 1808 1809 cfg80211_put_bss(auth_data->bss); 1810 kfree(auth_data); 1811 sdata->u.mgd.auth_data = NULL; 1812} 1813 1814static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata, --- 210 unchanged lines hidden (view full) --- 2025 2026 lockdep_assert_held(&sdata->u.mgd.mtx); 2027 2028 if (!assoc) { 2029 sta_info_destroy_addr(sdata, assoc_data->bss->bssid); 2030 2031 memset(sdata->u.mgd.bssid, 0, ETH_ALEN); 2032 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID); | 1847 } 1848 1849 cfg80211_put_bss(auth_data->bss); 1850 kfree(auth_data); 1851 sdata->u.mgd.auth_data = NULL; 1852} 1853 1854static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata, --- 210 unchanged lines hidden (view full) --- 2065 2066 lockdep_assert_held(&sdata->u.mgd.mtx); 2067 2068 if (!assoc) { 2069 sta_info_destroy_addr(sdata, assoc_data->bss->bssid); 2070 2071 memset(sdata->u.mgd.bssid, 0, ETH_ALEN); 2072 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID); |
2073 ieee80211_vif_release_channel(sdata); |
|
2033 } 2034 2035 kfree(assoc_data); 2036 sdata->u.mgd.assoc_data = NULL; 2037} 2038 2039static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, 2040 struct cfg80211_bss *cbss, --- 45 unchanged lines hidden (view full) --- 2086 * the association and should be available to us 2087 */ 2088 sta = sta_info_get(sdata, cbss->bssid); 2089 if (WARN_ON(!sta)) { 2090 mutex_unlock(&sdata->local->sta_mtx); 2091 return false; 2092 } 2093 | 2074 } 2075 2076 kfree(assoc_data); 2077 sdata->u.mgd.assoc_data = NULL; 2078} 2079 2080static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, 2081 struct cfg80211_bss *cbss, --- 45 unchanged lines hidden (view full) --- 2127 * the association and should be available to us 2128 */ 2129 sta = sta_info_get(sdata, cbss->bssid); 2130 if (WARN_ON(!sta)) { 2131 mutex_unlock(&sdata->local->sta_mtx); 2132 return false; 2133 } 2134 |
2094 sband = local->hw.wiphy->bands[local->oper_channel->band]; | 2135 sband = local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)]; |
2095 2096 if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) 2097 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, 2098 elems.ht_cap_elem, &sta->sta.ht_cap); 2099 2100 sta->supports_40mhz = 2101 sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40; 2102 --- 261 unchanged lines hidden (view full) --- 2364 size_t len, 2365 struct ieee80211_rx_status *rx_status) 2366{ 2367 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2368 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; 2369 size_t baselen; 2370 struct ieee802_11_elems elems; 2371 struct ieee80211_local *local = sdata->local; | 2136 2137 if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) 2138 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, 2139 elems.ht_cap_elem, &sta->sta.ht_cap); 2140 2141 sta->supports_40mhz = 2142 sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40; 2143 --- 261 unchanged lines hidden (view full) --- 2405 size_t len, 2406 struct ieee80211_rx_status *rx_status) 2407{ 2408 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2409 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; 2410 size_t baselen; 2411 struct ieee802_11_elems elems; 2412 struct ieee80211_local *local = sdata->local; |
2413 struct ieee80211_chanctx_conf *chanctx_conf; 2414 struct ieee80211_channel *chan; |
|
2372 u32 changed = 0; 2373 bool erp_valid, directed_tim = false; 2374 u8 erp_value = 0; 2375 u32 ncrc; 2376 u8 *bssid; 2377 2378 lockdep_assert_held(&ifmgd->mtx); 2379 2380 /* Process beacon from the current BSS */ 2381 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; 2382 if (baselen > len) 2383 return; 2384 | 2415 u32 changed = 0; 2416 bool erp_valid, directed_tim = false; 2417 u8 erp_value = 0; 2418 u32 ncrc; 2419 u8 *bssid; 2420 2421 lockdep_assert_held(&ifmgd->mtx); 2422 2423 /* Process beacon from the current BSS */ 2424 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; 2425 if (baselen > len) 2426 return; 2427 |
2385 if (rx_status->freq != local->oper_channel->center_freq) | 2428 rcu_read_lock(); 2429 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 2430 if (!chanctx_conf) { 2431 rcu_read_unlock(); |
2386 return; | 2432 return; |
2433 } |
|
2387 | 2434 |
2435 if (rx_status->freq != chanctx_conf->channel->center_freq) { 2436 rcu_read_unlock(); 2437 return; 2438 } 2439 chan = chanctx_conf->channel; 2440 rcu_read_unlock(); 2441 |
|
2388 if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && 2389 ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->bss->bssid)) { 2390 ieee802_11_parse_elems(mgmt->u.beacon.variable, 2391 len - baselen, &elems); 2392 2393 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, 2394 false); 2395 ifmgd->assoc_data->have_beacon = true; --- 145 unchanged lines hidden (view full) --- 2541 le16_to_cpu(mgmt->u.beacon.capab_info), 2542 erp_valid, erp_value); 2543 2544 2545 if (elems.ht_cap_elem && elems.ht_operation && elems.wmm_param && 2546 !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) { 2547 struct ieee80211_supported_band *sband; 2548 | 2442 if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && 2443 ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->bss->bssid)) { 2444 ieee802_11_parse_elems(mgmt->u.beacon.variable, 2445 len - baselen, &elems); 2446 2447 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, 2448 false); 2449 ifmgd->assoc_data->have_beacon = true; --- 145 unchanged lines hidden (view full) --- 2595 le16_to_cpu(mgmt->u.beacon.capab_info), 2596 erp_valid, erp_value); 2597 2598 2599 if (elems.ht_cap_elem && elems.ht_operation && elems.wmm_param && 2600 !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) { 2601 struct ieee80211_supported_band *sband; 2602 |
2549 sband = local->hw.wiphy->bands[local->oper_channel->band]; | 2603 sband = local->hw.wiphy->bands[chan->band]; |
2550 2551 changed |= ieee80211_config_ht_tx(sdata, elems.ht_operation, 2552 bssid, true); 2553 } 2554 2555 if (elems.country_elem && elems.pwr_constr_elem && 2556 mgmt->u.probe_resp.capab_info & 2557 cpu_to_le16(WLAN_CAPABILITY_SPECTRUM_MGMT)) | 2604 2605 changed |= ieee80211_config_ht_tx(sdata, elems.ht_operation, 2606 bssid, true); 2607 } 2608 2609 if (elems.country_elem && elems.pwr_constr_elem && 2610 mgmt->u.probe_resp.capab_info & 2611 cpu_to_le16(WLAN_CAPABILITY_SPECTRUM_MGMT)) |
2558 ieee80211_handle_pwr_constr(sdata, local->oper_channel, | 2612 ieee80211_handle_pwr_constr(sdata, chan, |
2559 elems.country_elem, 2560 elems.country_elem_len, 2561 elems.pwr_constr_elem); 2562 2563 ieee80211_bss_info_change_notify(sdata, changed); 2564} 2565 2566void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, --- 156 unchanged lines hidden (view full) --- 2723 if (!ssidie) 2724 return -EINVAL; 2725 /* 2726 * Direct probe is sent to broadcast address as some APs 2727 * will not answer to direct packet in unassociated state. 2728 */ 2729 ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], 2730 NULL, 0, (u32) -1, true, false, | 2613 elems.country_elem, 2614 elems.country_elem_len, 2615 elems.pwr_constr_elem); 2616 2617 ieee80211_bss_info_change_notify(sdata, changed); 2618} 2619 2620void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, --- 156 unchanged lines hidden (view full) --- 2777 if (!ssidie) 2778 return -EINVAL; 2779 /* 2780 * Direct probe is sent to broadcast address as some APs 2781 * will not answer to direct packet in unassociated state. 2782 */ 2783 ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], 2784 NULL, 0, (u32) -1, true, false, |
2731 auth_data->bss->channel); | 2785 auth_data->bss->channel, false); |
2732 } 2733 2734 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; 2735 run_again(ifmgd, auth_data->timeout); 2736 2737 return 0; 2738} 2739 --- 373 unchanged lines hidden (view full) --- 3113 break; 3114 case IEEE80211_HT_PARAM_CHA_SEC_BELOW: 3115 channel_type = NL80211_CHAN_HT40MINUS; 3116 break; 3117 } 3118 } 3119 } 3120 | 2786 } 2787 2788 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; 2789 run_again(ifmgd, auth_data->timeout); 2790 2791 return 0; 2792} 2793 --- 373 unchanged lines hidden (view full) --- 3167 break; 3168 case IEEE80211_HT_PARAM_CHA_SEC_BELOW: 3169 channel_type = NL80211_CHAN_HT40MINUS; 3170 break; 3171 } 3172 } 3173 } 3174 |
3121 if (!ieee80211_set_channel_type(local, sdata, channel_type)) { 3122 /* can only fail due to HT40+/- mismatch */ 3123 channel_type = NL80211_CHAN_HT20; 3124 sdata_info(sdata, 3125 "disabling 40 MHz due to multi-vif mismatch\n"); 3126 ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ; 3127 WARN_ON(!ieee80211_set_channel_type(local, sdata, 3128 channel_type)); 3129 } 3130 3131 local->oper_channel = cbss->channel; 3132 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 3133 3134 return 0; | 3175 ieee80211_vif_release_channel(sdata); 3176 return ieee80211_vif_use_channel(sdata, cbss->channel, channel_type, 3177 IEEE80211_CHANCTX_SHARED); |
3135} 3136 3137static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, 3138 struct cfg80211_bss *cbss, bool assoc) 3139{ 3140 struct ieee80211_local *local = sdata->local; 3141 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3142 struct ieee80211_bss *bss = (void *)cbss->priv; --- 53 unchanged lines hidden (view full) --- 3196 "No basic rates, using min rate instead\n"); 3197 basic_rates = BIT(min_rate_index); 3198 } 3199 3200 new_sta->sta.supp_rates[cbss->channel->band] = rates; 3201 sdata->vif.bss_conf.basic_rates = basic_rates; 3202 3203 /* cf. IEEE 802.11 9.2.12 */ | 3178} 3179 3180static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, 3181 struct cfg80211_bss *cbss, bool assoc) 3182{ 3183 struct ieee80211_local *local = sdata->local; 3184 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3185 struct ieee80211_bss *bss = (void *)cbss->priv; --- 53 unchanged lines hidden (view full) --- 3239 "No basic rates, using min rate instead\n"); 3240 basic_rates = BIT(min_rate_index); 3241 } 3242 3243 new_sta->sta.supp_rates[cbss->channel->band] = rates; 3244 sdata->vif.bss_conf.basic_rates = basic_rates; 3245 3246 /* cf. IEEE 802.11 9.2.12 */ |
3204 if (local->oper_channel->band == IEEE80211_BAND_2GHZ && | 3247 if (cbss->channel->band == IEEE80211_BAND_2GHZ && |
3205 have_higher_than_11mbit) 3206 sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; 3207 else 3208 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; 3209 3210 memcpy(ifmgd->bssid, cbss->bssid, ETH_ALEN); 3211 3212 /* set timing information */ --- 440 unchanged lines hidden --- | 3248 have_higher_than_11mbit) 3249 sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; 3250 else 3251 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; 3252 3253 memcpy(ifmgd->bssid, cbss->bssid, ETH_ALEN); 3254 3255 /* set timing information */ --- 440 unchanged lines hidden --- |