15 #include <linux/if_ether.h>
17 #include <linux/if_arp.h>
20 #include <linux/rtnetlink.h>
23 #include <linux/slab.h>
24 #include <linux/export.h>
26 #include <asm/unaligned.h>
33 #define IEEE80211_AUTH_TIMEOUT (HZ / 5)
34 #define IEEE80211_AUTH_MAX_TRIES 3
35 #define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5)
36 #define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
37 #define IEEE80211_ASSOC_MAX_TRIES 3
39 static int max_nullfunc_tries = 2;
42 "Maximum nullfunc tx tries before disconnecting (reason 4).");
44 static int max_probe_tries = 5;
47 "Maximum probe tries before disconnecting (reason 4).");
57 #define IEEE80211_BEACON_LOSS_COUNT 7
63 #define IEEE80211_CONNECTION_IDLE_TIME (30 * HZ)
69 static int probe_wait_ms = 500;
72 "Maximum time(ms) to wait for probe response"
73 " before disconnecting (reason 4).");
80 #define IEEE80211_SIGNAL_AVE_WEIGHT 3
86 #define IEEE80211_SIGNAL_AVE_MIN_COUNT 4
88 #define TMR_RUNNING_TIMER 0
89 #define TMR_RUNNING_CHANSW 1
135 ASSERT_MGD_MTX(ifmgd);
137 if (!timer_pending(&ifmgd->
timer) ||
170 static int ecw2cw(
int ecw)
172 return (1 << ecw) - 1;
177 const u8 *
bssid,
bool reconfig)
184 bool disable_40 =
false;
188 switch (sdata->
vif.bss_conf.channel_type) {
213 if (sta && (!reconfig ||
214 (disable_40 != !(sta->
sta.ht_cap.cap &
222 rate_control_rate_update(local, sband, sta,
230 if (!reconfig || (sdata->
vif.bss_conf.ht_operation_mode != ht_opmode)) {
232 sdata->
vif.bss_conf.ht_operation_mode = ht_opmode;
240 static int ieee80211_compatible_rates(
const u8 *supp_rates,
int supp_rates_len,
247 for (i = 0; i < supp_rates_len; i++) {
248 int rate = (supp_rates[
i] & 0x7F) * 5;
251 if (sband->
bitrates[j].bitrate == rate) {
358 size_t offset = 0, noffset;
359 int i,
count, rates_len, supp_rates_len;
375 rates_len = ieee80211_compatible_rates(assoc_data->
supp_rates,
388 skb = alloc_skb(local->
hw.extra_tx_headroom +
402 skb_reserve(skb, local->
hw.extra_tx_headroom);
426 if (!is_zero_ether_addr(assoc_data->
prev_bssid)) {
431 mgmt->
u.reassoc_req.listen_interval =
440 mgmt->
u.assoc_req.listen_interval =
451 supp_rates_len = rates_len;
452 if (supp_rates_len > 8)
455 pos =
skb_put(skb, supp_rates_len + 2);
457 *pos++ = supp_rates_len;
461 if (
BIT(i) & rates) {
463 *pos++ = (
u8) (rate / 5);
469 if (rates_len > count) {
470 pos =
skb_put(skb, rates_len - count + 2);
472 *pos++ = rates_len -
count;
475 if (
BIT(i) & rates) {
477 *pos++ = (
u8) (rate / 5);
503 if (assoc_data->
ie_len && assoc_data->
ie) {
504 static const u8 before_ht[] = {
519 pos =
skb_put(skb, noffset - offset);
520 memcpy(pos, assoc_data->
ie + offset, noffset - offset);
525 ieee80211_add_ht_ie(sdata, skb, assoc_data->
ap_ht_param,
529 ieee80211_add_vht_ie(sdata, skb, sband);
532 if (assoc_data->
ie_len && assoc_data->
ie) {
536 pos =
skb_put(skb, noffset - offset);
537 memcpy(pos, assoc_data->
ie + offset, noffset - offset);
541 if (assoc_data->
wmm) {
542 if (assoc_data->
uapsd) {
563 if (assoc_data->
ie_len && assoc_data->
ie) {
564 noffset = assoc_data->
ie_len;
565 pos =
skb_put(skb, noffset - offset);
566 memcpy(pos, assoc_data->
ie + offset, noffset - offset);
569 drv_mgd_prepare_tx(local, sdata);
572 ieee80211_tx_skb(sdata, skb);
589 ieee80211_tx_skb(sdata, skb);
613 ieee80211_tx_skb(sdata, skb);
616 static void ieee80211_send_4addr_nullfunc(
struct ieee80211_local *local,
626 skb = dev_alloc_skb(local->
hw.extra_tx_headroom + 30);
630 skb_reserve(skb, local->
hw.extra_tx_headroom);
643 ieee80211_tx_skb(sdata, skb);
653 if (!ieee80211_sdata_running(sdata))
660 sdata->
local->oper_channel = sdata->
local->csa_channel;
661 if (!sdata->
local->ops->channel_switch) {
667 sdata->
local->hw.conf.channel = sdata->
local->oper_channel;
686 sdata = vif_to_sdata(vif);
687 ifmgd = &sdata->
u.
mgd;
689 trace_api_chswitch_done(sdata, success);
692 "driver channel switch failed, disconnecting\n");
701 static void ieee80211_chswitch_timer(
unsigned long data)
707 if (sdata->
local->quiescing) {
727 ASSERT_MGD_MTX(ifmgd);
732 if (sdata->
local->scanning)
741 new_ch = ieee80211_get_channel(sdata->
local->hw.wiphy, new_freq);
744 "AP %pM switches to unsupported channel (%d MHz), disconnecting\n",
751 sdata->
local->csa_channel = new_ch;
759 if (sdata->
local->ops->channel_switch) {
763 .block_tx = sw_elem->
mode,
765 .count = sw_elem->
count,
768 drv_channel_switch(sdata->
local, &ch_switch);
773 if (sw_elem->
count <= 1)
783 const u8 *country_ie,
u8 country_ie_len,
784 const u8 *pwr_constr_elem)
788 int i, chan_pwr, chan_increment, new_ap_level;
789 bool have_chan_pwr =
false;
795 triplet = (
void *)(country_ie + 3);
798 switch (channel->
band) {
812 while (country_ie_len >= 3) {
819 if (first_channel + i * chan_increment == chan) {
820 have_chan_pwr =
true;
836 new_ap_level =
max_t(
int, 0, chan_pwr - *pwr_constr_elem);
838 if (sdata->
local->ap_power_level == new_ap_level)
842 "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
843 new_ap_level, chan_pwr, *pwr_constr_elem,
845 sdata->
local->ap_power_level = new_ap_level;
917 ieee80211_enable_ps(local, local->
ps_sdata);
930 bool authorized =
false;
967 if (!ieee80211_sdata_running(sdata))
983 if (count == 1 && ieee80211_powersave_allowed(found)) {
990 beaconint_us = ieee80211_tu_to_usec(
991 found->
vif.bss_conf.beacon_int);
1013 if (beaconint_us > latency) {
1020 bss = (
void *)found->
u.
mgd.associated->priv;
1026 else if (dtimper > 1)
1027 maxslp =
min_t(
int, dtimper,
1028 latency / beaconint_us);
1030 local->
hw.conf.max_sleep_period = maxslp;
1031 local->
hw.conf.ps_dtim_period = dtimper;
1038 ieee80211_change_ps(local);
1043 bool ps_allowed = ieee80211_powersave_allowed(sdata);
1045 if (sdata->
vif.bss_conf.ps != ps_allowed) {
1046 sdata->
vif.bss_conf.ps = ps_allowed;
1073 unsigned long flags;
1080 ifmgd = &sdata->
u.
mgd;
1086 local->
hw.conf.dynamic_ps_timeout > 0) {
1088 if (drv_tx_frames_pending(local)) {
1091 local->
hw.conf.dynamic_ps_timeout));
1101 for (q = 0; q < local->
hw.queues; q++) {
1107 local->
hw.conf.dynamic_ps_timeout));
1116 netif_tx_stop_all_queues(sdata->
dev);
1118 if (drv_tx_frames_pending(local))
1121 local->
hw.conf.dynamic_ps_timeout));
1125 drv_flush(local,
false);
1138 netif_tx_wake_all_queues(sdata->
dev);
1154 u8 *wmm_param,
size_t wmm_param_len)
1162 if (!local->
ops->conf_tx)
1171 if (wmm_param_len < 8 || wmm_param[5] != 1)
1177 count = wmm_param[6] & 0x0f;
1182 pos = wmm_param + 8;
1183 left = wmm_param_len - 8;
1188 for (; left >= 4; left -= 4, pos += 4) {
1189 int aci = (pos[0] >> 5) & 0x03;
1190 int acm = (pos[0] >> 4) & 0x01;
1226 params.aifs = pos[0] & 0x0f;
1227 params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
1228 params.cw_min = ecw2cw(pos[1] & 0x0f);
1229 params.txop = get_unaligned_le16(pos + 2);
1233 "WMM queue=%d aci=%d acm=%d aifs=%d cWmin=%d cWmax=%d txop=%d uapsd=%d\n",
1238 if (drv_conf_tx(local, sdata, queue, &
params))
1240 "failed to set TX queue parameters for queue %d\n",
1245 sdata->
vif.bss_conf.qos =
true;
1261 __ieee80211_stop_poll(sdata);
1266 u16 capab,
bool erp_valid,
u8 erp)
1270 bool use_protection;
1278 use_protection =
false;
1284 use_short_slot =
true;
1306 u32 bss_info_changed)
1313 bss_info_changed |= ieee80211_handle_bss_capability(sdata,
1319 sdata->
u.
mgd.associated = cbss;
1325 ieee80211_stop_poll(sdata);
1334 bss_conf->
assoc = 1;
1356 netif_tx_start_all_queues(sdata->
dev);
1369 ASSERT_MGD_MTX(ifmgd);
1377 ieee80211_stop_poll(sdata);
1395 netif_tx_stop_all_queues(sdata->
dev);
1422 drv_flush(local,
false);
1425 if (tx || frame_buf)
1427 reason, tx, frame_buf);
1431 drv_flush(local,
false);
1444 sdata->
vif.bss_conf.assoc =
false;
1456 if (sdata->
vif.bss_conf.arp_filter_enabled) {
1457 sdata->
vif.bss_conf.arp_filter_enabled =
false;
1461 sdata->
vif.bss_conf.qos =
false;
1480 sdata->
u.
mgd.timers_running = 0;
1494 if (is_multicast_ether_addr(hdr->
addr1))
1512 __ieee80211_stop_poll(sdata);
1545 sdata->
u.
mgd.probe_send_count > 0) {
1547 sdata->
u.
mgd.probe_send_count = 0;
1549 sdata->
u.
mgd.nullfunc_failed =
true;
1559 u8 unicast_limit =
max(1, max_probe_tries - 3);
1591 0, (
u32) -1,
true,
false,
1598 drv_flush(sdata->
local,
false);
1605 bool already =
false;
1607 if (!ieee80211_sdata_running(sdata))
1617 if (sdata->
local->tmp_channel || sdata->
local->scanning) {
1624 "detected beacon loss from AP - sending probe request\n");
1659 ieee80211_mgd_probe_ap_send(sdata);
1677 ASSERT_MGD_MTX(ifmgd);
1696 sdata->
local->oper_channel,
1705 bool transmit_frame)
1719 transmit_frame, frame_buf);
1734 static void ieee80211_beacon_connection_loss_work(
struct work_struct *work)
1738 u.mgd.beacon_connection_loss_work);
1751 sdata_info(sdata,
"Connection to AP %pM lost\n",
1753 __ieee80211_disconnect(sdata,
false);
1755 ieee80211_mgd_probe_ap(sdata,
true);
1759 static void ieee80211_csa_connection_drop_work(
struct work_struct *work)
1763 u.mgd.csa_connection_drop_work);
1767 __ieee80211_disconnect(sdata,
true);
1775 trace_api_beacon_loss(sdata);
1787 trace_api_connection_loss(sdata);
1821 pos = mgmt->
u.auth.variable;
1823 if (!elems.challenge)
1826 drv_mgd_prepare_tx(sdata->
local, sdata);
1828 elems.challenge - 2, elems.challenge_len + 2,
1829 auth_data->
bss->bssid, auth_data->
bss->bssid,
1853 if (!ether_addr_equal(bssid, mgmt->
bssid))
1857 auth_transaction =
le16_to_cpu(mgmt->
u.auth.auth_transaction);
1860 if (auth_alg != ifmgd->
auth_data->algorithm ||
1861 auth_transaction != ifmgd->
auth_data->expected_transaction)
1865 sdata_info(sdata,
"%pM denied authentication (status %d)\n",
1866 mgmt->
sa, status_code);
1867 ieee80211_destroy_auth_data(sdata,
false);
1877 if (ifmgd->
auth_data->expected_transaction != 4) {
1892 run_again(ifmgd, ifmgd->
auth_data->timeout);
1902 sdata_info(sdata,
"failed moving %pM to auth\n", bssid);
1936 sdata_info(sdata,
"deauthenticated from %pM (Reason: %u)\n",
1937 bssid, reason_code);
1939 ieee80211_set_disassoc(sdata, 0, 0,
false,
NULL);
1965 reason_code =
le16_to_cpu(mgmt->
u.disassoc.reason_code);
1967 sdata_info(sdata,
"disassociated from %pM (Reason: %u)\n",
1968 mgmt->
sa, reason_code);
1970 ieee80211_set_disassoc(sdata, 0, 0,
false,
NULL);
1980 u8 *supp_rates,
unsigned int supp_rates_len,
1981 u32 *rates,
u32 *basic_rates,
1982 bool *have_higher_than_11mbit,
1983 int *min_rate,
int *min_rate_index)
1987 for (i = 0; i < supp_rates_len; i++) {
1988 int rate = (supp_rates[
i] & 0x7f) * 5;
1989 bool is_basic = !!(supp_rates[
i] & 0x80);
1992 *have_higher_than_11mbit =
true;
2002 if (!!(supp_rates[i] & 0x80) &&
2007 if (sband->
bitrates[j].bitrate == rate) {
2010 *basic_rates |=
BIT(j);
2011 if (rate < *min_rate) {
2013 *min_rate_index =
j;
2057 capab_info =
le16_to_cpu(mgmt->
u.assoc_resp.capab_info);
2059 if ((aid & (
BIT(15) |
BIT(14))) != (
BIT(15) |
BIT(14)))
2060 sdata_info(sdata,
"invalid AID value 0x%x; bits 15:14 not set\n",
2062 aid &= ~(
BIT(15) |
BIT(14));
2067 sdata_info(sdata,
"invalid AID value %d (out of range), turn off PS\n",
2073 pos = mgmt->
u.assoc_resp.variable;
2076 if (!elems.supp_rates) {
2077 sdata_info(sdata,
"no SuppRates element in AssocResp\n");
2098 elems.ht_cap_elem, &sta->
sta.ht_cap);
2103 rate_control_rate_init(sta);
2108 if (elems.wmm_param)
2118 "failed to move station %pM to desired state\n",
2135 if (elems.wmm_param)
2136 ieee80211_sta_wmm_params(local, sdata, elems.wmm_param,
2137 elems.wmm_param_len);
2142 if (elems.ht_operation && elems.wmm_param &&
2144 changed |= ieee80211_config_ht_tx(sdata, elems.ht_operation,
2145 cbss->
bssid,
false);
2151 ieee80211_set_associated(sdata, cbss, changed);
2158 ieee80211_send_4addr_nullfunc(local, sdata);
2186 if (!ether_addr_equal(assoc_data->
bss->bssid, mgmt->
bssid))
2198 capab_info =
le16_to_cpu(mgmt->
u.assoc_resp.capab_info);
2199 status_code =
le16_to_cpu(mgmt->
u.assoc_resp.status_code);
2203 "RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n",
2204 reassoc ?
"Rea" :
"A", mgmt->
sa,
2205 capab_info, status_code, (
u16)(aid & ~(
BIT(15) |
BIT(14))));
2207 pos = mgmt->
u.assoc_resp.variable;
2211 elems.timeout_int && elems.timeout_int_len == 5 &&
2215 ms = tu * 1024 / 1000;
2217 "%pM rejected association temporarily; comeback duration %u TU (%u ms)\n",
2221 run_again(ifmgd, assoc_data->
timeout);
2225 *bss = assoc_data->
bss;
2228 sdata_info(sdata,
"%pM denied association (code=%d)\n",
2229 mgmt->
sa, status_code);
2230 ieee80211_destroy_assoc_data(sdata,
false);
2232 if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
2234 ieee80211_destroy_assoc_data(sdata,
false);
2245 ieee80211_destroy_assoc_data(sdata,
true);
2261 bool need_ps =
false;
2263 if (sdata->
u.
mgd.associated &&
2264 ether_addr_equal(mgmt->
bssid, sdata->
u.
mgd.associated->bssid)) {
2265 bss = (
void *)sdata->
u.
mgd.associated->priv;
2274 freq = rx_status->
freq;
2276 channel = ieee80211_get_channel(local->
hw.wiphy, freq);
2286 if (!sdata->
u.
mgd.associated)
2308 size_t baselen, len = skb->
len;
2311 ifmgd = &sdata->
u.
mgd;
2313 ASSERT_MGD_MTX(ifmgd);
2315 if (!ether_addr_equal(mgmt->
da, sdata->
vif.addr))
2318 baselen = (
u8 *) mgmt->
u.probe_resp.variable - (
u8 *)
mgmt;
2325 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems,
false);
2327 if (ifmgd->associated &&
2328 ether_addr_equal(mgmt->
bssid, ifmgd->associated->bssid))
2329 ieee80211_reset_ap_probe(sdata);
2331 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
2332 ether_addr_equal(mgmt->
bssid, ifmgd->auth_data->bss->bssid)) {
2334 sdata_info(sdata,
"direct probe responded\n");
2335 ifmgd->auth_data->tries = 0;
2336 ifmgd->auth_data->timeout =
jiffies;
2337 run_again(ifmgd, ifmgd->auth_data->timeout);
2354 static const u64 care_about_ies =
2373 bool erp_valid, directed_tim =
false;
2381 baselen = (
u8 *) mgmt->
u.beacon.variable - (
u8 *)
mgmt;
2391 len - baselen, &elems);
2393 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems,
2399 run_again(ifmgd, ifmgd->
assoc_data->timeout);
2434 (last_sig <= ifmgd->rssi_min_thold || last_sig == 0)) {
2437 }
else if (sig < ifmgd->rssi_min_thold &&
2453 (last_event == 0 || sig < last_event - hyst)) {
2459 }
else if (sig > thold &&
2460 (last_event == 0 || sig > last_event + hyst)) {
2471 "cancelling probereq poll due to a received beacon\n");
2488 ncrc =
crc32_be(0, (
void *)&mgmt->
u.beacon.beacon_int, 4);
2490 len - baselen, &elems,
2491 care_about_ies, ncrc);
2494 directed_tim = ieee80211_check_tim(elems.
tim, elems.
tim_len,
2499 if (local->
hw.conf.dynamic_ps_timeout > 0) {
2527 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems,
2530 if (ieee80211_sta_wmm_params(local, sdata, elems.
wmm_param,
2540 changed |= ieee80211_handle_bss_capability(sdata,
2542 erp_valid, erp_value);
2551 changed |= ieee80211_config_ht_tx(sdata, elems.
ht_operation,
2556 mgmt->
u.probe_resp.capab_info &
2558 ieee80211_handle_pwr_constr(sdata, local->
oper_channel,
2584 ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->
len, rx_status);
2587 ieee80211_rx_mgmt_probe_resp(sdata, skb);
2590 rma = ieee80211_rx_mgmt_auth(sdata, mgmt, skb->
len);
2593 rma = ieee80211_rx_mgmt_deauth(sdata, mgmt, skb->
len);
2596 rma = ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->
len);
2600 rma = ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->
len, &bss);
2603 switch (mgmt->
u.action.category) {
2606 &mgmt->
u.action.u.chan_switch.sw_elem,
2634 WARN(1,
"unexpected: %d", rma);
2638 static void ieee80211_sta_timer(
unsigned long data)
2654 u8 *bssid,
u8 reason)
2691 sdata_info(sdata,
"authentication with %pM timed out\n",
2692 auth_data->
bss->bssid);
2703 drv_mgd_prepare_tx(local, sdata);
2705 if (auth_data->
bss->proberesp_ies) {
2706 sdata_info(sdata,
"send auth to %pM (try %d/%d)\n",
2707 auth_data->
bss->bssid, auth_data->
tries,
2713 auth_data->
bss->bssid,
2714 auth_data->
bss->bssid,
NULL, 0, 0);
2718 sdata_info(sdata,
"direct probe to %pM (try %d/%i)\n",
2719 auth_data->
bss->bssid, auth_data->
tries,
2730 NULL, 0, (
u32) -1,
true,
false,
2731 auth_data->
bss->channel);
2735 run_again(ifmgd, auth_data->
timeout);
2747 assoc_data->
tries++;
2749 sdata_info(sdata,
"association with %pM timed out\n",
2750 assoc_data->
bss->bssid);
2761 sdata_info(sdata,
"associate with %pM (try %d/%d)\n",
2762 assoc_data->
bss->bssid, assoc_data->
tries,
2764 ieee80211_send_assoc(sdata);
2786 ieee80211_destroy_auth_data(sdata,
false);
2787 }
else if (ieee80211_probe_auth(sdata)) {
2792 ieee80211_destroy_auth_data(sdata,
false);
2799 run_again(ifmgd, ifmgd->
auth_data->timeout);
2804 ieee80211_do_assoc(sdata)) {
2809 ieee80211_destroy_assoc_data(sdata,
false);
2816 run_again(ifmgd, ifmgd->
assoc_data->timeout);
2827 max_tries = max_nullfunc_tries;
2829 max_tries = max_probe_tries;
2833 ieee80211_reset_ap_probe(sdata);
2837 "No ack for nullfunc frame to AP %pM, try %d/%i\n",
2840 ieee80211_mgd_probe_ap_send(sdata);
2843 "No ack for nullfunc frame to AP %pM, disconnecting.\n",
2845 ieee80211_sta_connection_lost(sdata, bssid,
2852 "Failed to send nullfunc to AP %pM after %dms, disconnecting\n",
2853 bssid, probe_wait_ms);
2854 ieee80211_sta_connection_lost(sdata, bssid,
2858 "No probe response from AP %pM after %dms, try %d/%i\n",
2859 bssid, probe_wait_ms,
2861 ieee80211_mgd_probe_ap_send(sdata);
2868 "%s: No probe response from AP %pM"
2869 " after %dms, disconnecting.\n",
2871 bssid, probe_wait_ms);
2873 ieee80211_sta_connection_lost(sdata, bssid,
2885 static void ieee80211_sta_bcn_mon_timer(
unsigned long data)
2895 &sdata->
u.
mgd.beacon_connection_loss_work);
2898 static void ieee80211_sta_conn_mon_timer(
unsigned long data)
2911 static void ieee80211_sta_monitor_work(
struct work_struct *work)
2915 u.mgd.monitor_work);
2917 ieee80211_mgd_probe_ap(sdata,
false);
2925 __ieee80211_stop_poll(sdata);
2928 flags = sdata->
local->hw.flags;
2931 &sdata->
u.
mgd.monitor_work);
2977 "driver requested disconnect after resume\n");
2978 ieee80211_sta_connection_lost(sdata,
2994 ieee80211_restart_sta_timer(sdata);
3004 ifmgd = &sdata->
u.
mgd;
3008 ieee80211_beacon_connection_loss_work);
3010 ieee80211_csa_connection_drop_work);
3013 (
unsigned long) sdata);
3015 (
unsigned long) sdata);
3017 (
unsigned long) sdata);
3019 (
unsigned long) sdata);
3042 ieee80211_restart_sta_timer(sdata);
3047 unsigned long data,
void *
dummy)
3049 s32 latency_usec = (
s32) data;
3068 const u8 *ht_oper_ie;
3072 sband = local->
hw.wiphy->bands[cbss->
channel->band];
3076 if (sband->
ht_cap.ht_supported) {
3080 if (ht_oper_ie && ht_oper_ie[1] >=
sizeof(*ht_oper))
3081 ht_oper = (
void *)(ht_oper_ie + 2);
3088 if (cbss->
channel->center_freq != ht_cfreq) {
3097 "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n",
3115 switch (ht_oper->
ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
3117 if (cbss->
channel->flags & IEEE80211_CHAN_NO_HT40PLUS)
3135 "disabling 40 MHz due to multi-vif mismatch\n");
3154 bool have_sta =
false;
3177 u32 rates = 0, basic_rates = 0;
3178 bool have_higher_than_11mbit;
3179 int min_rate =
INT_MAX, min_rate_index = -1;
3182 sband = local->
hw.wiphy->bands[cbss->
channel->band];
3184 err = ieee80211_prep_channel(sdata, cbss);
3192 &rates, &basic_rates,
3193 &have_higher_than_11mbit,
3194 &min_rate, &min_rate_index);
3204 if (!basic_rates && min_rate_index >= 0) {
3206 "No basic rates, using min rate instead\n");
3207 basic_rates =
BIT(min_rate_index);
3210 new_sta->sta.supp_rates[cbss->
channel->band] = rates;
3211 sdata->
vif.bss_conf.basic_rates = basic_rates;
3215 have_higher_than_11mbit)
3224 sdata->
vif.bss_conf.sync_tsf = cbss->
tsf;
3239 "failed to insert STA entry for the AP (error %d)\n",
3284 auth_data->
bss = req->
bss;
3310 ieee80211_destroy_auth_data(sdata,
false);
3316 ieee80211_set_disassoc(sdata, 0, 0,
false,
NULL);
3318 sdata_info(sdata,
"authenticate with %pM\n", req->
bss->bssid);
3320 err = ieee80211_prep_connection(sdata, req->
bss,
false);
3324 err = ieee80211_probe_auth(sdata);
3355 const u8 *ssidie, *ht_ie;
3369 ieee80211_set_disassoc(sdata, 0, 0,
false,
NULL);
3385 match = ether_addr_equal(ifmgd->
bssid, req->
bss->bssid);
3386 ieee80211_destroy_auth_data(sdata, match);
3407 for (i = 0; i < req->
crypto.n_ciphers_pairwise; i++) {
3413 netdev_info(sdata->
dev,
3414 "disabling HT/VHT due to WEP/TKIP use\n");
3424 sband = local->
hw.wiphy->bands[req->
bss->channel->band];
3425 if (!sband->
ht_cap.ht_supported ||
3429 netdev_info(sdata->
dev,
3430 "disabling HT as WMM/QoS is not supported by the AP\n");
3434 if (!sband->
vht_cap.vht_supported ||
3438 netdev_info(sdata->
dev,
3439 "disabling VHT as WMM/QoS is not supported by the AP\n");
3451 assoc_data->
bss = req->
bss;
3459 ifmgd->ap_smps = ifmgd->req_smps;
3476 assoc_data->
uapsd =
true;
3479 assoc_data->
uapsd =
false;
3483 memcpy(assoc_data->
ssid, ssidie + 2, ssidie[1]);
3490 ifmgd->
mfp = IEEE80211_MFP_REQUIRED;
3493 ifmgd->
mfp = IEEE80211_MFP_DISABLED;
3497 if (req->
crypto.control_port)
3509 err = ieee80211_prep_connection(sdata, req->
bss,
true);
3519 sdata_info(sdata,
"waiting for beacon from %pM\n",
3527 run_again(ifmgd, assoc_data->
timeout);
3530 char *corrupt_type =
"data";
3534 corrupt_type =
"beacon and probe response";
3536 corrupt_type =
"beacon";
3538 corrupt_type =
"probe response";
3539 sdata_info(sdata,
"associating with AP with corrupt %s\n",
3567 ieee80211_destroy_auth_data(sdata,
false);
3573 "deauthenticating from %pM by local choice (reason=%d)\n",
3581 drv_mgd_prepare_tx(sdata->
local, sdata);
3621 "disassociating from %pM by local choice (reason=%d)\n",
3646 ieee80211_destroy_assoc_data(sdata,
false);
3648 ieee80211_destroy_auth_data(sdata,
false);
3659 trace_api_cqm_rssi_notify(sdata, rssi_event);