Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | 4377eba | 2018-12-26 21:31:32 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 20 | * This file lim_process_assoc_req_frame.c contains the code |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 21 | * for processing Re/Association Request Frame. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 22 | */ |
| 23 | #include "cds_api.h" |
| 24 | #include "ani_global.h" |
| 25 | #include "wni_cfg.h" |
| 26 | #include "sir_api.h" |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 27 | #include "cfg_ucfg_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 28 | |
| 29 | #include "sch_api.h" |
| 30 | #include "utils_api.h" |
| 31 | #include "lim_types.h" |
| 32 | #include "lim_utils.h" |
| 33 | #include "lim_assoc_utils.h" |
| 34 | #include "lim_security_utils.h" |
| 35 | #include "lim_ser_des_utils.h" |
| 36 | #include "lim_sta_hash_api.h" |
| 37 | #include "lim_admit_control.h" |
| 38 | #include "cds_packet.h" |
| 39 | #include "lim_session_utils.h" |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 40 | #include "utils_parser.h" |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 41 | #include "wlan_p2p_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 42 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 43 | #include "qdf_types.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 44 | #include "cds_utils.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 45 | #include "wlan_utility.h" |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 46 | #include "wlan_crypto_global_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * lim_convert_supported_channels - Parses channel support IE |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 50 | * @mac_ctx: A pointer to Global MAC structure |
| 51 | * @assoc_ind: A pointer to SME ASSOC/REASSOC IND |
| 52 | * @assoc_req: A pointer to ASSOC/REASSOC Request frame |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | * |
| 54 | * This function is called by lim_process_assoc_req_frame() to |
| 55 | * parse the channel support IE in the Assoc/Reassoc Request |
| 56 | * frame, and send relevant information in the SME_ASSOC_IND |
| 57 | * |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 58 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 59 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 60 | static void lim_convert_supported_channels(struct mac_context *mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 61 | tpLimMlmAssocInd assoc_ind, |
| 62 | tSirAssocReq *assoc_req) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | { |
| 64 | uint16_t i, j, index = 0; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 65 | uint8_t first_ch_no; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | uint8_t chn_count; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 67 | uint8_t next_ch_no; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | uint8_t channel_offset = 0; |
| 69 | |
| 70 | if (assoc_req->supportedChannels.length >= |
| 71 | SIR_MAX_SUPPORTED_CHANNEL_LIST) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 72 | pe_err("Number of supported channels: %d is more than MAX", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 73 | assoc_req->supportedChannels.length); |
| 74 | assoc_ind->supportedChannels.numChnl = 0; |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | for (i = 0; i < (assoc_req->supportedChannels.length); i++) { |
| 79 | /* Get First Channel Number */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 80 | first_ch_no = assoc_req->supportedChannels.supportedChannels[i]; |
| 81 | assoc_ind->supportedChannels.channelList[index] = first_ch_no; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 82 | i++; |
| 83 | index++; |
| 84 | |
| 85 | /* Get Number of Channels in a Subband */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 86 | chn_count = assoc_req->supportedChannels.supportedChannels[i]; |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 87 | pe_debug("Rcv assoc_req: chnl: %d numOfChnl: %d", |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 88 | first_ch_no, chn_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 89 | if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 90 | pe_warn("Ch count > max supported: %d", chn_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 91 | assoc_ind->supportedChannels.numChnl = 0; |
| 92 | return; |
| 93 | } |
| 94 | if (chn_count <= 1) |
| 95 | continue; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 96 | next_ch_no = first_ch_no; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 97 | if (BAND_5G == lim_get_rf_band(first_ch_no)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 98 | channel_offset = SIR_11A_FREQUENCY_OFFSET; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 99 | else if (BAND_2G == lim_get_rf_band(first_ch_no)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 100 | channel_offset = SIR_11B_FREQUENCY_OFFSET; |
| 101 | else |
| 102 | continue; |
| 103 | |
| 104 | for (j = 1; j < chn_count; j++) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 105 | next_ch_no += channel_offset; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 106 | assoc_ind->supportedChannels.channelList[index] |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 107 | = next_ch_no; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 108 | index++; |
| 109 | if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 110 | pe_warn("Ch count > supported: %d", chn_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 111 | assoc_ind->supportedChannels.numChnl = 0; |
| 112 | return; |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | assoc_ind->supportedChannels.numChnl = (uint8_t) index; |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 118 | pe_debug("Send AssocInd to WSM: minPwr: %d maxPwr: %d numChnl: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 119 | assoc_ind->powerCap.minTxPower, |
| 120 | assoc_ind->powerCap.maxTxPower, |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 121 | assoc_ind->supportedChannels.numChnl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 124 | /** |
| 125 | * lim_check_sta_in_pe_entries() - checks if sta exists in any dph tables. |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 126 | * @mac_ctx: Pointer to Global MAC structure |
| 127 | * @hdr: A pointer to the MAC header |
Poddar, Siddarth | 7ca1e08 | 2016-08-09 19:06:48 +0530 | [diff] [blame] | 128 | * @sessionid - session id for which session is initiated |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 129 | * @dup_entry: pointer for duplicate entry found |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 130 | * |
| 131 | * This function is called by lim_process_assoc_req_frame() to check if STA |
| 132 | * entry already exists in any of the PE entries of the AP. If it exists, deauth |
| 133 | * will be sent on that session and the STA deletion will happen. After this, |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 134 | * the ASSOC request will be processed. If the STA is already in deleting phase |
| 135 | * this will return failure so that assoc req will be rejected till STA is |
| 136 | * deleted. |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 137 | * |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 138 | * Return: QDF_STATUS. |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 139 | */ |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 140 | static QDF_STATUS lim_check_sta_in_pe_entries(struct mac_context *mac_ctx, |
| 141 | tpSirMacMgmtHdr hdr, |
| 142 | uint16_t sessionid, |
| 143 | bool *dup_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 144 | { |
| 145 | uint8_t i; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 146 | uint16_t assoc_id = 0; |
| 147 | tpDphHashNode sta_ds = NULL; |
Jeff Johnson | eac5aad | 2019-03-19 12:57:04 -0700 | [diff] [blame] | 148 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 149 | |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 150 | *dup_entry = false; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 151 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
Jeff Johnson | eac5aad | 2019-03-19 12:57:04 -0700 | [diff] [blame] | 152 | session = &mac_ctx->lim.gpSession[i]; |
| 153 | if (session->valid && |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 154 | (session->opmode == QDF_SAP_MODE)) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 155 | sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, |
| 156 | &assoc_id, &session->dph.dphHashTable); |
| 157 | if (sta_ds |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 158 | #ifdef WLAN_FEATURE_11W |
Poddar, Siddarth | 7ca1e08 | 2016-08-09 19:06:48 +0530 | [diff] [blame] | 159 | && (!sta_ds->rmfEnabled || |
| 160 | (sessionid != session->peSessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 161 | #endif |
| 162 | ) { |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 163 | if (sta_ds->mlmStaContext.mlmState == |
| 164 | eLIM_MLM_WT_DEL_STA_RSP_STATE || |
| 165 | sta_ds->mlmStaContext.mlmState == |
| 166 | eLIM_MLM_WT_DEL_BSS_RSP_STATE || |
| 167 | sta_ds->sta_deletion_in_progress) { |
| 168 | pe_debug( |
| 169 | "Deletion is in progress (%d) for peer:%pM in mlmState %d", |
| 170 | sta_ds->sta_deletion_in_progress, |
| 171 | sta_ds->staAddr, |
| 172 | sta_ds->mlmStaContext.mlmState); |
| 173 | *dup_entry = true; |
| 174 | return QDF_STATUS_E_AGAIN; |
| 175 | } |
| 176 | sta_ds->sta_deletion_in_progress = true; |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 177 | pe_err("Sending Disassoc and Deleting existing STA entry:" |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 178 | QDF_MAC_ADDR_STR, |
| 179 | QDF_MAC_ADDR_ARRAY( |
| 180 | session->self_mac_addr)); |
Sandeep Puligilla | 2eeaf6a | 2016-07-22 20:02:02 -0700 | [diff] [blame] | 181 | lim_send_disassoc_mgmt_frame(mac_ctx, |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 182 | eSIR_MAC_UNSPEC_FAILURE_REASON, |
| 183 | (uint8_t *) hdr->sa, session, false); |
Sandeep Puligilla | 2eeaf6a | 2016-07-22 20:02:02 -0700 | [diff] [blame] | 184 | /* |
| 185 | * Cleanup Rx path posts eWNI_SME_DISASSOC_RSP |
| 186 | * msg to SME after delete sta which will update |
| 187 | * the userspace with disconnect |
| 188 | */ |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 189 | sta_ds->mlmStaContext.cleanupTrigger = |
| 190 | eLIM_DUPLICATE_ENTRY; |
| 191 | sta_ds->mlmStaContext.disassocReason = |
| 192 | eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON; |
| 193 | lim_send_sme_disassoc_ind(mac_ctx, sta_ds, |
| 194 | session); |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 195 | *dup_entry = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 196 | break; |
| 197 | } |
| 198 | } |
| 199 | } |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 200 | |
| 201 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 202 | } |
| 203 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 204 | /** |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 205 | * lim_chk_sa_da() - checks source addr to destination addr of assoc req frame |
| 206 | * @mac_ctx: pointer to Global MAC structure |
| 207 | * @hdr: pointer to the MAC head |
| 208 | * @session: pointer to pe session entry |
| 209 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 210 | * |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 211 | * Checks source addr to destination addr of assoc req frame |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 212 | * |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 213 | * Return: true if source and destination address are different |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 214 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 215 | static bool lim_chk_sa_da(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 216 | struct pe_session *session, uint8_t sub_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 217 | { |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 218 | if (qdf_mem_cmp((uint8_t *) hdr->sa, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 219 | (uint8_t *) hdr->da, |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 220 | (uint8_t) (sizeof(tSirMacAddr)))) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 221 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 222 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 223 | pe_err("Assoc Req rejected: wlan.sa = wlan.da"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 224 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 225 | 1, hdr->sa, sub_type, 0, session); |
| 226 | return false; |
| 227 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 228 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 229 | /** |
| 230 | * lim_chk_tkip() - checks TKIP counter measure is active |
| 231 | * @mac_ctx: pointer to Global MAC structure |
| 232 | * @hdr: pointer to the MAC head |
| 233 | * @session: pointer to pe session entry |
| 234 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 235 | * |
| 236 | * Checks TKIP counter measure is active |
| 237 | * |
| 238 | * Return: true of no error, false otherwise |
| 239 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 240 | static bool lim_chk_tkip(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 241 | struct pe_session *session, uint8_t sub_type) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 242 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 243 | /* |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 244 | * If TKIP counter measures active send Assoc Rsp frame to station |
| 245 | * with eSIR_MAC_MIC_FAILURE_REASON |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 246 | */ |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 247 | if (!(session->bTkipCntrMeasActive && LIM_IS_AP_ROLE(session))) |
| 248 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 249 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 250 | pe_err("Assoc Req rejected: TKIP counter measure is active"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 251 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_MIC_FAILURE_REASON, 1, |
| 252 | hdr->sa, sub_type, 0, session); |
| 253 | return false; |
| 254 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 255 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 256 | /** |
| 257 | * lim_chk_assoc_req_parse_error() - checks for error in frame parsing |
| 258 | * @mac_ctx: pointer to Global MAC structure |
| 259 | * @hdr: pointer to the MAC head |
| 260 | * @session: pointer to pe session entry |
| 261 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 262 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 263 | * @frm_body: frame body |
| 264 | * @frame_len: frame len |
| 265 | * |
| 266 | * Checks for error in frame parsing |
| 267 | * |
| 268 | * Return: true of no error, false otherwise |
| 269 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 270 | static bool lim_chk_assoc_req_parse_error(struct mac_context *mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 271 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 272 | struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 273 | tpSirAssocReq assoc_req, |
| 274 | uint8_t sub_type, uint8_t *frm_body, |
Krishna Kumaar Natarajan | db582ec | 2016-03-08 17:37:04 -0800 | [diff] [blame] | 275 | uint32_t frame_len) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 276 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 277 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 278 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 279 | if (sub_type == LIM_ASSOC) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 280 | status = sir_convert_assoc_req_frame2_struct(mac_ctx, frm_body, |
Pragaspathi Thilagaraj | 0bd369d | 2019-04-08 00:07:53 +0530 | [diff] [blame] | 281 | frame_len, |
| 282 | assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 283 | else |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 284 | status = sir_convert_reassoc_req_frame2_struct(mac_ctx, |
| 285 | frm_body, frame_len, assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 286 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 287 | if (status == QDF_STATUS_SUCCESS) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 288 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 289 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 290 | pe_warn("Assoc Req rejected: frame parsing error. source addr:" |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 291 | QDF_MAC_ADDR_STR, QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 292 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 293 | 1, hdr->sa, sub_type, 0, session); |
| 294 | return false; |
| 295 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 296 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 297 | /** |
| 298 | * lim_chk_capab() - checks for capab match |
| 299 | * @mac_ctx: pointer to Global MAC structure |
| 300 | * @hdr: pointer to the MAC head |
| 301 | * @session: pointer to pe session entry |
| 302 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 303 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 304 | * @local_cap: local capabilities of SAP |
| 305 | * |
| 306 | * Checks for capab match |
| 307 | * |
| 308 | * Return: true of no error, false otherwise |
| 309 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 310 | static bool lim_chk_capab(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 311 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 312 | uint8_t sub_type, tSirMacCapabilityInfo *local_cap) |
| 313 | { |
| 314 | uint16_t temp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 315 | |
Wu Gao | 5c3d94b | 2019-01-17 21:15:54 +0800 | [diff] [blame] | 316 | if (lim_get_capability_info(mac_ctx, &temp, session) != |
| 317 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 318 | pe_err("could not retrieve Capabilities"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 319 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 320 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 321 | |
| 322 | lim_copy_u16((uint8_t *) local_cap, temp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 324 | if (lim_compare_capabilities(mac_ctx, assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 325 | local_cap, session) == false) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 326 | pe_warn("Rcvd %s Req with unsupported capab from" |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 327 | QDF_MAC_ADDR_STR, |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 328 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 329 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 330 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 331 | * Capabilities of requesting STA does not match with |
| 332 | * local capabilities. Respond with 'unsupported capabilities' |
| 333 | * status code. |
| 334 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 335 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 336 | eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 337 | 1, hdr->sa, sub_type, 0, session); |
| 338 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 340 | return true; |
| 341 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 342 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 343 | /** |
| 344 | * lim_chk_ssid() - checks for SSID match |
| 345 | * @mac_ctx: pointer to Global MAC structure |
| 346 | * @hdr: pointer to the MAC head |
| 347 | * @session: pointer to pe session entry |
| 348 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 349 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 350 | * |
| 351 | * Checks for SSID match |
| 352 | * |
| 353 | * Return: true of no error, false otherwise |
| 354 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 355 | static bool lim_chk_ssid(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 356 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 357 | uint8_t sub_type) |
| 358 | { |
| 359 | if (lim_cmp_ssid(&assoc_req->ssId, session) != true) |
| 360 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 361 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 362 | pe_err("%s Req with ssid wrong(Rcvd: %.*s self: %.*s) from " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 363 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 364 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
| 365 | assoc_req->ssId.length, assoc_req->ssId.ssId, |
| 366 | session->ssId.length, session->ssId.ssId, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 367 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 368 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 369 | /* |
| 370 | * Received Re/Association Request with either Broadcast SSID OR with |
| 371 | * SSID that does not match with local one. Respond with unspecified |
| 372 | * status code. |
| 373 | */ |
| 374 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 375 | 1, hdr->sa, sub_type, 0, session); |
| 376 | return false; |
| 377 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 378 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 379 | /** |
| 380 | * lim_chk_rates() - checks for supported rates |
| 381 | * @mac_ctx: pointer to Global MAC structure |
| 382 | * @hdr: pointer to the MAC head |
| 383 | * @session: pointer to pe session entry |
| 384 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 385 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 386 | * |
| 387 | * Checks for supported rates |
| 388 | * |
| 389 | * Return: true of no error, false otherwise |
| 390 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 391 | static bool lim_chk_rates(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 392 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 393 | uint8_t sub_type) |
| 394 | { |
| 395 | uint8_t i = 0, j = 0; |
| 396 | tSirMacRateSet basic_rates; |
| 397 | /* |
| 398 | * Verify if the requested rates are available in supported rate |
| 399 | * set or Extended rate set. Some APs are adding basic rates in |
| 400 | * Extended rateset IE |
| 401 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 402 | basic_rates.numRates = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 403 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 404 | for (i = 0; i < assoc_req->supportedRates.numRates |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 405 | && (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 406 | basic_rates.rate[i] = assoc_req->supportedRates.rate[i]; |
| 407 | basic_rates.numRates++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 408 | } |
| 409 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 410 | for (j = 0; (j < assoc_req->extendedRates.numRates) |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 411 | && (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++, j++) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 412 | basic_rates.rate[i] = assoc_req->extendedRates.rate[j]; |
| 413 | basic_rates.numRates++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 414 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 415 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 416 | if (lim_check_rx_basic_rates(mac_ctx, basic_rates, session) == true) |
| 417 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 418 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 419 | pe_warn("Assoc Req rejected: unsupported rates, soruce addr: %s" |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 420 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 421 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 422 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 423 | /* |
| 424 | * Requesting STA does not support ALL BSS basic rates. Respond with |
| 425 | * 'basic rates not supported' status code. |
| 426 | */ |
| 427 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 428 | eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS, 1, |
| 429 | hdr->sa, sub_type, 0, session); |
| 430 | return false; |
| 431 | } |
| 432 | |
| 433 | /** |
| 434 | * lim_chk_11g_only() - checks for non 11g STA |
| 435 | * @mac_ctx: pointer to Global MAC structure |
| 436 | * @hdr: pointer to the MAC head |
| 437 | * @session: pointer to pe session entry |
| 438 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 439 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 440 | * |
| 441 | * Checks for non 11g STA |
| 442 | * |
| 443 | * Return: true of no error, false otherwise |
| 444 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 445 | static bool lim_chk_11g_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 446 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 447 | uint8_t sub_type) |
| 448 | { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 449 | if (LIM_IS_AP_ROLE(session) && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 450 | (session->dot11mode == MLME_DOT11_MODE_11G_ONLY) && |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 451 | (assoc_req->HTCaps.present)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 452 | pe_err("SOFTAP was in 11G only mode, rejecting legacy STA: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 453 | QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 454 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 455 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 456 | eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 457 | 1, hdr->sa, sub_type, 0, session); |
| 458 | return false; |
| 459 | } |
| 460 | return true; |
| 461 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 462 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 463 | /** |
| 464 | * lim_chk_11n_only() - checks for non 11n STA |
| 465 | * @mac_ctx: pointer to Global MAC structure |
| 466 | * @hdr: pointer to the MAC head |
| 467 | * @session: pointer to pe session entry |
| 468 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 469 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 470 | * |
| 471 | * Checks for non 11n STA |
| 472 | * |
| 473 | * Return: true of no error, false otherwise |
| 474 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 475 | static bool lim_chk_11n_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 476 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 477 | uint8_t sub_type) |
| 478 | { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 479 | if (LIM_IS_AP_ROLE(session) && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 480 | (session->dot11mode == MLME_DOT11_MODE_11N_ONLY) && |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 481 | (!assoc_req->HTCaps.present)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 482 | pe_err("SOFTAP was in 11N only mode, rejecting legacy STA: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 483 | QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 484 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 485 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 486 | eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 487 | 1, hdr->sa, sub_type, 0, session); |
| 488 | return false; |
| 489 | } |
| 490 | return true; |
| 491 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 492 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 493 | /** |
| 494 | * lim_chk_11ac_only() - checks for non 11ac STA |
| 495 | * @mac_ctx: pointer to Global MAC structure |
| 496 | * @hdr: pointer to the MAC head |
| 497 | * @session: pointer to pe session entry |
| 498 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 499 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 500 | * |
| 501 | * Checks for non 11ac STA |
| 502 | * |
| 503 | * Return: true of no error, false otherwise |
| 504 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 505 | static bool lim_chk_11ac_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 506 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 507 | uint8_t sub_type) |
| 508 | { |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 509 | tDot11fIEVHTCaps *vht_caps; |
| 510 | |
| 511 | if (assoc_req->VHTCaps.present) |
| 512 | vht_caps = &assoc_req->VHTCaps; |
| 513 | else if (assoc_req->vendor_vht_ie.VHTCaps.present && |
| 514 | session->vendor_vht_sap) |
| 515 | vht_caps = &assoc_req->vendor_vht_ie.VHTCaps; |
| 516 | else |
| 517 | vht_caps = NULL; |
| 518 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 519 | if (LIM_IS_AP_ROLE(session) && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 520 | (session->dot11mode == MLME_DOT11_MODE_11AC_ONLY) && |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 521 | ((!vht_caps) || ((vht_caps) && (!vht_caps->present)))) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 522 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 523 | eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 524 | 1, hdr->sa, sub_type, 0, session); |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 525 | pe_err("SOFTAP was in 11AC only mode, reject"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 526 | return false; |
| 527 | } |
| 528 | return true; |
| 529 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 530 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 531 | /** |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 532 | * lim_chk_11ax_only() - checks for non 11ax STA |
| 533 | * @mac_ctx: pointer to Global MAC structure |
| 534 | * @hdr: pointer to the MAC head |
| 535 | * @session: pointer to pe session entry |
| 536 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 537 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 538 | * |
| 539 | * Checks for non 11ax STA |
| 540 | * |
| 541 | * Return: true of no error, false otherwise |
| 542 | */ |
| 543 | #ifdef WLAN_FEATURE_11AX |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 544 | static bool lim_chk_11ax_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 545 | struct pe_session *session, tpSirAssocReq assoc_req, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 546 | uint8_t sub_type) |
| 547 | { |
| 548 | if (LIM_IS_AP_ROLE(session) && |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 549 | (session->dot11mode == MLME_DOT11_MODE_11AX_ONLY) && |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 550 | !assoc_req->he_cap.present) { |
| 551 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 552 | eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 553 | 1, hdr->sa, sub_type, 0, session); |
| 554 | pe_err("SOFTAP was in 11AX only mode, reject"); |
| 555 | return false; |
| 556 | } |
| 557 | return true; |
| 558 | } |
| 559 | |
| 560 | /** |
| 561 | * lim_check_11ax_basic_mcs() - checks for 11ax basic MCS rates |
| 562 | * @mac_ctx: pointer to Global MAC structure |
| 563 | * @hdr: pointer to the MAC head |
| 564 | * @session: pointer to pe session entry |
| 565 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 566 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 567 | * |
| 568 | * Checks for non 11ax STA |
| 569 | * |
| 570 | * Return: true of no error, false otherwise |
| 571 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 572 | static bool lim_check_11ax_basic_mcs(struct mac_context *mac_ctx, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 573 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 574 | struct pe_session *session, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 575 | tpSirAssocReq assoc_req, |
| 576 | uint8_t sub_type) |
| 577 | { |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 578 | uint16_t basic_mcs, sta_mcs, rx_mcs, tx_mcs, final_mcs; |
| 579 | |
| 580 | if (LIM_IS_AP_ROLE(session) && |
| 581 | assoc_req->he_cap.present) { |
| 582 | rx_mcs = assoc_req->he_cap.rx_he_mcs_map_lt_80; |
| 583 | tx_mcs = assoc_req->he_cap.tx_he_mcs_map_lt_80; |
| 584 | sta_mcs = HE_INTERSECT_MCS(rx_mcs, tx_mcs); |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 585 | basic_mcs = |
| 586 | (uint16_t)mac_ctx->mlme_cfg->he_caps.he_ops_basic_mcs_nss; |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 587 | final_mcs = HE_INTERSECT_MCS(sta_mcs, basic_mcs); |
| 588 | if (final_mcs != basic_mcs) { |
| 589 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 590 | eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 591 | 1, hdr->sa, sub_type, 0, session); |
Jeff Johnson | a642ead | 2018-05-11 09:26:13 -0700 | [diff] [blame] | 592 | pe_err("STA did not support basic MCS required by SAP"); |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 593 | return false; |
| 594 | } |
| 595 | } |
| 596 | return true; |
| 597 | } |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 598 | |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 599 | #else |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 600 | static bool lim_chk_11ax_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 601 | struct pe_session *session, tpSirAssocReq assoc_req, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 602 | uint8_t sub_type) |
| 603 | { |
| 604 | return true; |
| 605 | } |
| 606 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 607 | static bool lim_check_11ax_basic_mcs(struct mac_context *mac_ctx, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 608 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 609 | struct pe_session *session, |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 610 | tpSirAssocReq assoc_req, |
| 611 | uint8_t sub_type) |
| 612 | { |
| 613 | return true; |
| 614 | } |
| 615 | #endif |
| 616 | |
| 617 | /** |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 618 | * lim_process_for_spectrum_mgmt() - process assoc req for spectrum mgmt |
| 619 | * @mac_ctx: pointer to Global MAC structure |
| 620 | * @hdr: pointer to the MAC head |
| 621 | * @session: pointer to pe session entry |
| 622 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 623 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 624 | * @local_cap: local capabilities of SAP |
| 625 | * |
| 626 | * Checks for SSID match |
| 627 | * |
| 628 | * process assoc req for spectrum mgmt |
| 629 | */ |
| 630 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 631 | lim_process_for_spectrum_mgmt(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 632 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 633 | uint8_t sub_type, tSirMacCapabilityInfo local_cap) |
| 634 | { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 635 | if (local_cap.spectrumMgt) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 636 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 637 | /* |
| 638 | * If station is 11h capable, then it SHOULD send all mandatory |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 639 | * IEs in assoc request frame. Let us verify that |
| 640 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 641 | if (assoc_req->capabilityInfo.spectrumMgt) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 642 | if (!((assoc_req->powerCapabilityPresent) |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 643 | && (assoc_req->supportedChannelsPresent))) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 644 | /* |
| 645 | * One or more required information elements are |
| 646 | * missing, log the peers error |
| 647 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 648 | if (!assoc_req->powerCapabilityPresent) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 649 | pe_warn("LIM Info: Missing Power capability IE in %s Req from " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 650 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 651 | (LIM_ASSOC == sub_type) ? |
| 652 | "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 653 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 654 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 655 | if (!assoc_req->supportedChannelsPresent) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 656 | pe_warn("LIM Info: Missing Supported channel IE in %s Req from " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 657 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 658 | (LIM_ASSOC == sub_type) ? |
| 659 | "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 660 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 661 | } |
| 662 | } else { |
| 663 | /* Assoc request has mandatory fields */ |
| 664 | status = |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 665 | lim_is_dot11h_power_capabilities_in_range( |
| 666 | mac_ctx, assoc_req, session); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 667 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 668 | pe_warn("LIM Info: MinTxPower(STA) > MaxTxPower(AP) in %s Req from " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 669 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 670 | (LIM_ASSOC == sub_type) ? |
| 671 | "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 672 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 673 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 674 | status = lim_is_dot11h_supported_channels_valid( |
| 675 | mac_ctx, assoc_req); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 676 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 677 | pe_warn("LIM Info: wrong supported channels (STA) in %s Req from " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 678 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 679 | (LIM_ASSOC == sub_type) ? |
| 680 | "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 681 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 682 | } |
| 683 | /* IEs are valid, use them if needed */ |
| 684 | } |
| 685 | } /* if(assoc.capabilityInfo.spectrumMgt) */ |
| 686 | else { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 687 | /* |
| 688 | * As per the capabiities, the spectrum management is |
| 689 | * not enabled on the station. The AP may allow the |
| 690 | * associations to happen even if spectrum management |
| 691 | * is not allowed, if the transmit power of station is |
| 692 | * below the regulatory maximum |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 693 | */ |
| 694 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 695 | /* |
| 696 | * TODO: presently, this is not handled. In the current |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 697 | * implementation, the AP would allow the station to |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 698 | * associate even if it doesn't support spectrum |
| 699 | * management. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 700 | */ |
| 701 | } |
| 702 | } /* end of spectrum management related processing */ |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 703 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 704 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 705 | /** |
| 706 | * lim_chk_mcs() - checks for supported MCS |
| 707 | * @mac_ctx: pointer to Global MAC structure |
| 708 | * @hdr: pointer to the MAC head |
| 709 | * @session: pointer to pe session entry |
| 710 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 711 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 712 | * |
| 713 | * Checks for supported MCS |
| 714 | * |
| 715 | * Return: true of no error, false otherwise |
| 716 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 717 | static bool lim_chk_mcs(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 718 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 719 | uint8_t sub_type) |
| 720 | { |
| 721 | if ((assoc_req->HTCaps.present) && (lim_check_mcs_set(mac_ctx, |
| 722 | assoc_req->HTCaps.supportedMCSSet) == false)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 723 | pe_warn("rcvd %s req with unsupported MCS Rate Set from " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 724 | QDF_MAC_ADDR_STR, |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 725 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 726 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 727 | /* |
| 728 | * Requesting STA does not support ALL BSS MCS basic Rate set |
| 729 | * rates. Spec does not define any status code for this |
| 730 | * scenario. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 731 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 732 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 733 | eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS, |
| 734 | 1, hdr->sa, sub_type, 0, session); |
| 735 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 737 | return true; |
| 738 | } |
| 739 | |
| 740 | /** |
| 741 | * lim_chk_is_11b_sta_supported() - checks if STA is 11b |
| 742 | * @mac_ctx: pointer to Global MAC structure |
| 743 | * @hdr: pointer to the MAC head |
| 744 | * @session: pointer to pe session entry |
| 745 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 746 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 747 | * @phy_mode: phy mode |
| 748 | * |
| 749 | * Checks if STA is 11b |
| 750 | * |
| 751 | * Return: true of no error, false otherwise |
| 752 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 753 | static bool lim_chk_is_11b_sta_supported(struct mac_context *mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 754 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 755 | struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 756 | tpSirAssocReq assoc_req, |
| 757 | uint8_t sub_type, uint32_t phy_mode) |
| 758 | { |
| 759 | uint32_t cfg_11g_only; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 760 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 761 | if (phy_mode == WNI_CFG_PHY_MODE_11G) { |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 762 | cfg_11g_only = mac_ctx->mlme_cfg->sap_cfg.sap_11g_policy; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 763 | if (!assoc_req->extendedRatesPresent && cfg_11g_only) { |
| 764 | /* |
| 765 | * Received Re/Association Request from 11b STA when 11g |
| 766 | * only policy option is set. Reject with unspecified |
| 767 | * status code. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 768 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 769 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 770 | eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS, |
| 771 | 1, hdr->sa, sub_type, 0, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 772 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 773 | pe_warn("Rejecting Re/Assoc req from 11b STA:"); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 774 | lim_print_mac_addr(mac_ctx, hdr->sa, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 775 | |
| 776 | #ifdef WLAN_DEBUG |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 777 | mac_ctx->lim.gLim11bStaAssocRejectCount++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 778 | #endif |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 779 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 780 | } |
| 781 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 782 | return true; |
| 783 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 784 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 785 | /** |
| 786 | * lim_print_ht_cap() - prints HT caps |
| 787 | * @mac_ctx: pointer to Global MAC structure |
| 788 | * @session: pointer to pe session entry |
| 789 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 790 | * |
| 791 | * Prints HT caps |
| 792 | * |
| 793 | * Return: void |
| 794 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 795 | static void lim_print_ht_cap(struct mac_context *mac_ctx, struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 796 | tpSirAssocReq assoc_req) |
| 797 | { |
| 798 | if (!session->htCapability) |
| 799 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 800 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 801 | if (assoc_req->HTCaps.present) { |
| 802 | /* The station *does* support 802.11n HT capability... */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 803 | pe_debug("AdvCodingCap:%d ChaWidthSet:%d PowerSave:%d greenField:%d shortGI20:%d shortGI40:%d txSTBC:%d rxSTBC:%d delayBA:%d maxAMSDUsize:%d DSSS/CCK:%d PSMP:%d stbcCntl:%d lsigTXProt:%d", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 804 | assoc_req->HTCaps.advCodingCap, |
| 805 | assoc_req->HTCaps.supportedChannelWidthSet, |
| 806 | assoc_req->HTCaps.mimoPowerSave, |
| 807 | assoc_req->HTCaps.greenField, |
| 808 | assoc_req->HTCaps.shortGI20MHz, |
| 809 | assoc_req->HTCaps.shortGI40MHz, |
| 810 | assoc_req->HTCaps.txSTBC, |
| 811 | assoc_req->HTCaps.rxSTBC, |
| 812 | assoc_req->HTCaps.delayedBA, |
| 813 | assoc_req->HTCaps.maximalAMSDUsize, |
| 814 | assoc_req->HTCaps.dsssCckMode40MHz, |
| 815 | assoc_req->HTCaps.psmp, |
| 816 | assoc_req->HTCaps.stbcControlFrame, |
| 817 | assoc_req->HTCaps.lsigTXOPProtection); |
| 818 | /* |
| 819 | * Make sure the STA's caps are compatible with our own: |
| 820 | * 11.15.2 Support of DSSS/CCK in 40 MHz the AP shall refuse |
| 821 | * association requests from an HT STA that has the DSSS/CCK |
| 822 | * Mode in 40 MHz subfield set to 1; |
| 823 | */ |
| 824 | } |
| 825 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 826 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 827 | #ifdef WLAN_CONV_CRYPTO_IE_SUPPORT |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 828 | static |
| 829 | enum mac_status_code lim_check_rsn_ie(struct pe_session *session, |
| 830 | struct mac_context *mac_ctx, |
| 831 | tpSirAssocReq assoc_req, |
| 832 | tDot11fIERSN *rsn, |
| 833 | bool *pmf_connection) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 834 | { |
| 835 | struct wlan_objmgr_vdev *vdev; |
| 836 | |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 837 | uint8_t buffer[WLAN_MAX_IE_LEN]; |
| 838 | uint32_t dot11f_status, written = 0, nbuffer = WLAN_MAX_IE_LEN; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 839 | tSirMacRsnInfo rsn_ie; |
| 840 | |
| 841 | dot11f_status = dot11f_pack_ie_rsn(mac_ctx, rsn, buffer, |
| 842 | nbuffer, &written); |
| 843 | if (DOT11F_FAILED(dot11f_status)) { |
| 844 | pe_err("Failed to re-pack the RSN IE (0x%0x8)", dot11f_status); |
| 845 | return eSIR_MAC_INVALID_IE_STATUS; |
| 846 | } |
| 847 | |
| 848 | rsn_ie.length = (uint8_t) written; |
| 849 | qdf_mem_copy(&rsn_ie.info[0], buffer, rsn_ie.length); |
| 850 | if (wlan_crypto_check_rsn_match(mac_ctx->psoc, session->smeSessionId, |
| 851 | &rsn_ie.info[0], rsn_ie.length)) { |
| 852 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc, |
| 853 | session->smeSessionId, |
| 854 | WLAN_LEGACY_MAC_ID); |
| 855 | if (!vdev) { |
| 856 | pe_err("vdev is NULL"); |
| 857 | return eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 858 | } |
| 859 | |
| 860 | *pmf_connection = wlan_crypto_vdev_is_pmf_enabled(vdev); |
| 861 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID); |
| 862 | } else { |
| 863 | return eSIR_MAC_INVALID_IE_STATUS; |
| 864 | } |
| 865 | |
| 866 | return eSIR_MAC_SUCCESS_STATUS; |
| 867 | } |
| 868 | |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 869 | static enum mac_status_code lim_check_wpa_ie(struct pe_session *session, |
| 870 | struct mac_context *mac_ctx, |
| 871 | tpSirAssocReq assoc_req, |
| 872 | tDot11fIEWPA *wpa) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 873 | { |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 874 | uint8_t buffer[WLAN_MAX_IE_LEN]; |
| 875 | uint32_t dot11f_status, written = 0, nbuffer = WLAN_MAX_IE_LEN; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 876 | tSirMacRsnInfo wpa_ie = {0}; |
| 877 | |
| 878 | dot11f_status = dot11f_pack_ie_wpa(mac_ctx, wpa, buffer, |
| 879 | nbuffer, &written); |
| 880 | if (DOT11F_FAILED(dot11f_status)) { |
| 881 | pe_err("Failed to re-pack the RSN IE (0x%0x8)", dot11f_status); |
| 882 | return eSIR_MAC_INVALID_IE_STATUS; |
| 883 | } |
| 884 | |
| 885 | wpa_ie.length = (uint8_t) written; |
| 886 | qdf_mem_copy(&wpa_ie.info[0], buffer, wpa_ie.length); |
| 887 | if (wlan_crypto_check_wpa_match(mac_ctx->psoc, session->smeSessionId, |
| 888 | &wpa_ie.info[0], wpa_ie.length)) |
| 889 | return eSIR_MAC_SUCCESS_STATUS; |
| 890 | |
| 891 | return eSIR_MAC_INVALID_IE_STATUS; |
| 892 | } |
| 893 | #else |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 894 | static enum mac_status_code lim_check_rsn_ie(struct pe_session *session, |
| 895 | struct mac_context *mac_ctx, |
| 896 | tpSirAssocReq assoc_req, |
| 897 | tDot11fIERSN *rsn, |
| 898 | bool *pmf_connection) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 899 | { |
| 900 | return lim_check_rx_rsn_ie_match(mac_ctx, rsn, session, |
| 901 | assoc_req->HTCaps.present, |
| 902 | pmf_connection); |
| 903 | } |
| 904 | |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 905 | static enum mac_status_code lim_check_wpa_ie(struct pe_session *session, |
| 906 | struct mac_context *mac_ctx, |
| 907 | tpSirAssocReq assoc_req, |
| 908 | tDot11fIEWPA *wpa) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 909 | { |
| 910 | return lim_check_rx_wpa_ie_match(mac_ctx, wpa, session, |
| 911 | assoc_req->HTCaps.present); |
| 912 | } |
| 913 | #endif |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 914 | |
| 915 | /** |
| 916 | * lim_check_sae_pmf_cap() - check pmf capability for SAE STA |
| 917 | * @session: pointer to pe session entry |
| 918 | * @rsn: pointer to RSN |
| 919 | * |
| 920 | * This function checks if SAE STA is pmf capable when SAE SAP is pmf |
| 921 | * capable. Reject with eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION |
| 922 | * if SAE STA is pmf disable. |
| 923 | * |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 924 | * Return: mac_status_code |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 925 | */ |
| 926 | #ifdef WLAN_FEATURE_SAE |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 927 | static enum mac_status_code lim_check_sae_pmf_cap(struct pe_session *session, |
| 928 | tDot11fIERSN *rsn) |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 929 | { |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 930 | enum mac_status_code status = eSIR_MAC_SUCCESS_STATUS; |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 931 | |
| 932 | if (session->pLimStartBssReq->pmfCapable && |
| 933 | (rsn->RSN_Cap[0] & WLAN_CRYPTO_RSN_CAP_MFP_ENABLED) == 0) |
| 934 | status = eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION_STATUS; |
| 935 | |
| 936 | return status; |
| 937 | } |
| 938 | #else |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 939 | static enum mac_status_code lim_check_sae_pmf_cap(struct pe_session *session, |
| 940 | tDot11fIERSN *rsn) |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 941 | { |
| 942 | return eSIR_MAC_SUCCESS_STATUS; |
| 943 | } |
| 944 | #endif |
| 945 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 946 | /** |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 947 | * lim_check_wpa_rsn_ie() - wpa and rsn ie related checks |
| 948 | * @session: pointer to pe session entry |
| 949 | * @mac_ctx: pointer to Global MAC structure |
| 950 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 951 | * @hdr: pointer to the MAC head |
| 952 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 953 | * @pmf_connection: flag indicating pmf connection |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 954 | * @akm_type: AKM type |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 955 | * |
| 956 | * This function checks if wpa/rsn IE is present and validates |
| 957 | * ie version, length and mismatch. |
| 958 | * |
| 959 | * Return: true if no error, false otherwise |
| 960 | */ |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 961 | static bool lim_check_wpa_rsn_ie(struct pe_session *session, |
| 962 | struct mac_context *mac_ctx, |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 963 | uint8_t sub_type, tpSirMacMgmtHdr hdr, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 964 | tpSirAssocReq assoc_req, bool *pmf_connection, |
| 965 | enum ani_akm_type *akm_type) |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 966 | { |
| 967 | uint32_t ret; |
| 968 | tDot11fIEWPA dot11f_ie_wpa = {0}; |
| 969 | tDot11fIERSN dot11f_ie_rsn = {0}; |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 970 | enum mac_status_code status = eSIR_MAC_SUCCESS_STATUS; |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 971 | |
| 972 | /* |
| 973 | * Clear the buffers so that frame parser knows that there isn't a |
| 974 | * previously decoded IE in these buffers |
| 975 | */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 976 | qdf_mem_zero((uint8_t *) &dot11f_ie_rsn, sizeof(dot11f_ie_rsn)); |
| 977 | qdf_mem_zero((uint8_t *) &dot11f_ie_wpa, sizeof(dot11f_ie_wpa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 978 | pe_err("RSN enabled auth, Re/Assoc req from STA: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 979 | QDF_MAC_ADDR_STR, QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 980 | |
| 981 | if (assoc_req->rsnPresent) { |
| 982 | if (!(assoc_req->rsn.length)) { |
| 983 | pe_warn("Re/Assoc rejected from: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 984 | QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 985 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 986 | /* |
| 987 | * rcvd Assoc req frame with RSN IE but |
| 988 | * length is zero |
| 989 | */ |
| 990 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 991 | eSIR_MAC_INVALID_IE_STATUS, 1, |
| 992 | hdr->sa, sub_type, 0, session); |
| 993 | return false; |
| 994 | } |
| 995 | |
| 996 | /* Unpack the RSN IE */ |
| 997 | ret = dot11f_unpack_ie_rsn(mac_ctx, |
| 998 | &assoc_req->rsn.info[0], |
| 999 | assoc_req->rsn.length, |
| 1000 | &dot11f_ie_rsn, false); |
| 1001 | if (!DOT11F_SUCCEEDED(ret)) { |
| 1002 | pe_err("Invalid RSN IE"); |
Liangwei Dong | 433a8db | 2018-08-14 01:43:23 -0400 | [diff] [blame] | 1003 | lim_send_assoc_rsp_mgmt_frame( |
| 1004 | mac_ctx, eSIR_MAC_INVALID_IE_STATUS, 1, |
| 1005 | hdr->sa, sub_type, 0, session); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1006 | return false; |
| 1007 | } |
| 1008 | |
| 1009 | /* Check if the RSN version is supported */ |
| 1010 | if (SIR_MAC_OUI_VERSION_1 == dot11f_ie_rsn.version) { |
| 1011 | /* check the groupwise and pairwise cipher suites */ |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 1012 | status = lim_check_rsn_ie(session, mac_ctx, assoc_req, |
| 1013 | &dot11f_ie_rsn, |
| 1014 | pmf_connection); |
| 1015 | if (eSIR_MAC_SUCCESS_STATUS != status) { |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1016 | pe_warn("Re/Assoc rejected from: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1017 | QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1018 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1019 | |
| 1020 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, status, |
| 1021 | 1, hdr->sa, sub_type, |
| 1022 | 0, session); |
| 1023 | return false; |
| 1024 | } |
| 1025 | } else { |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1026 | pe_warn("Re/Assoc rejected from: " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1027 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1028 | /* |
| 1029 | * rcvd Assoc req frame with RSN IE but |
| 1030 | * IE version is wrong |
| 1031 | */ |
| 1032 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 1033 | eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS, |
| 1034 | 1, hdr->sa, sub_type, 0, session); |
| 1035 | return false; |
| 1036 | } |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1037 | *akm_type = lim_translate_rsn_oui_to_akm_type( |
| 1038 | dot11f_ie_rsn.akm_suite[0]); |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 1039 | |
| 1040 | if (*akm_type == ANI_AKM_TYPE_SAE) |
| 1041 | status = lim_check_sae_pmf_cap(session, &dot11f_ie_rsn); |
| 1042 | if (eSIR_MAC_SUCCESS_STATUS != status) { |
| 1043 | /* Reject pmf disable SAE STA */ |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1044 | pe_warn("Re/Assoc rejected from: " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1045 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Min Liu | b3b222a | 2019-02-22 13:47:45 +0800 | [diff] [blame] | 1046 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, status, |
| 1047 | 1, hdr->sa, sub_type, |
| 1048 | 0, session); |
| 1049 | return false; |
| 1050 | } |
| 1051 | |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1052 | } else if (assoc_req->wpaPresent) { |
| 1053 | if (!(assoc_req->wpa.length)) { |
| 1054 | pe_warn("Re/Assoc rejected from: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1055 | QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1056 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1057 | |
| 1058 | /* rcvd Assoc req frame with invalid WPA IE length */ |
| 1059 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 1060 | eSIR_MAC_INVALID_IE_STATUS, 1, |
| 1061 | hdr->sa, sub_type, 0, session); |
| 1062 | return false; |
| 1063 | } |
| 1064 | /* Unpack the WPA IE */ |
| 1065 | ret = dot11f_unpack_ie_wpa(mac_ctx, |
| 1066 | &assoc_req->wpa.info[4], |
| 1067 | (assoc_req->wpa.length - 4), |
| 1068 | &dot11f_ie_wpa, false); |
| 1069 | if (!DOT11F_SUCCEEDED(ret)) { |
| 1070 | pe_err("Invalid WPA IE"); |
Liangwei Dong | 433a8db | 2018-08-14 01:43:23 -0400 | [diff] [blame] | 1071 | lim_send_assoc_rsp_mgmt_frame( |
| 1072 | mac_ctx, eSIR_MAC_INVALID_IE_STATUS, 1, |
| 1073 | hdr->sa, sub_type, 0, session); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1074 | return false; |
| 1075 | } |
| 1076 | |
| 1077 | /* check the groupwise and pairwise cipher suites*/ |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 1078 | status = lim_check_wpa_ie(session, mac_ctx, assoc_req, |
| 1079 | &dot11f_ie_wpa); |
| 1080 | if (eSIR_MAC_SUCCESS_STATUS != status) { |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1081 | pe_warn("Re/Assoc rejected from: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1082 | QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1083 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1084 | /* |
| 1085 | * rcvd Assoc req frame with WPA IE |
| 1086 | * but there is mismatch |
| 1087 | */ |
| 1088 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, status, 1, |
| 1089 | hdr->sa, sub_type, 0, session); |
| 1090 | return false; |
| 1091 | } |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1092 | *akm_type = lim_translate_rsn_oui_to_akm_type( |
| 1093 | dot11f_ie_wpa.auth_suites[0]); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1094 | } |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1095 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 1096 | return true; |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1097 | } |
| 1098 | |
| 1099 | /** |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1100 | * lim_chk_n_process_wpa_rsn_ie() - wpa ie related checks |
| 1101 | * @mac_ctx: pointer to Global MAC structure |
| 1102 | * @hdr: pointer to the MAC head |
| 1103 | * @session: pointer to pe session entry |
| 1104 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1105 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1106 | * @pmf_connection: flag indicating pmf connection |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1107 | * @akm_type: AKM type |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1108 | * |
| 1109 | * wpa ie related checks |
| 1110 | * |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1111 | * Return: true if no error, false otherwise |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1112 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1113 | static bool lim_chk_n_process_wpa_rsn_ie(struct mac_context *mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1114 | tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 1115 | struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1116 | tpSirAssocReq assoc_req, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1117 | uint8_t sub_type, |
| 1118 | bool *pmf_connection, |
| 1119 | enum ani_akm_type *akm_type) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1120 | { |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1121 | const uint8_t *wps_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1122 | |
| 1123 | /* if additional IE is present, check if it has WscIE */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1124 | if (assoc_req->addIEPresent && assoc_req->addIE.length) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1125 | wps_ie = limGetWscIEPtr(mac_ctx, assoc_req->addIE.addIEdata, |
| 1126 | assoc_req->addIE.length); |
| 1127 | else |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1128 | pe_debug("Assoc req addIEPresent: %d addIE length: %d", |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1129 | assoc_req->addIEPresent, assoc_req->addIE.length); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1130 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1131 | /* when wps_ie is present, RSN/WPA IE is ignored */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1132 | if (!wps_ie) { |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1133 | /* check whether RSN IE is present */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1134 | if (LIM_IS_AP_ROLE(session) && |
| 1135 | session->pLimStartBssReq->privacy && |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1136 | session->pLimStartBssReq->rsnIE.length) |
| 1137 | return lim_check_wpa_rsn_ie(session, mac_ctx, sub_type, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1138 | hdr, assoc_req, pmf_connection, |
| 1139 | akm_type); |
Pragaspathi Thilagaraj | 2d1b311 | 2018-07-06 15:54:42 +0530 | [diff] [blame] | 1140 | } else { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1141 | pe_debug("Assoc req WSE IE is present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1142 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1143 | return true; |
| 1144 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1145 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1146 | /** |
| 1147 | * lim_process_assoc_req_no_sta_ctx() - process assoc req for no sta ctx present |
| 1148 | * @mac_ctx: pointer to Global MAC structure |
| 1149 | * @hdr: pointer to the MAC head |
| 1150 | * @session: pointer to pe session entry |
| 1151 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1152 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1153 | * @sta_pre_auth_ctx: sta pre auth context |
| 1154 | * @sta_ds: station dph entry |
| 1155 | * @auth_type: indicates security type |
| 1156 | * |
| 1157 | * Process assoc req for no sta ctx present |
| 1158 | * |
| 1159 | * Return: true of no error, false otherwise |
| 1160 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1161 | static bool lim_process_assoc_req_no_sta_ctx(struct mac_context *mac_ctx, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 1162 | tpSirMacMgmtHdr hdr, struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1163 | tpSirAssocReq assoc_req, uint8_t sub_type, |
| 1164 | struct tLimPreAuthNode *sta_pre_auth_ctx, |
| 1165 | tpDphHashNode sta_ds, tAniAuthType *auth_type) |
| 1166 | { |
| 1167 | /* Requesting STA is not currently associated */ |
| 1168 | if (pe_get_current_stas_count(mac_ctx) == |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 1169 | mac_ctx->mlme_cfg->sap_cfg.assoc_sta_limit) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1170 | /* |
| 1171 | * Maximum number of STAs that AP can handle reached. |
| 1172 | * Send Association response to peer MAC entity |
| 1173 | */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1174 | pe_err("Max Sta count reached : %d", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1175 | mac_ctx->lim.maxStation); |
| 1176 | lim_reject_association(mac_ctx, hdr->sa, sub_type, false, |
| 1177 | (tAniAuthType) 0, 0, false, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1178 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1179 | session); |
| 1180 | return false; |
| 1181 | } |
| 1182 | /* Check if STA is pre-authenticated. */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1183 | if ((!sta_pre_auth_ctx) || (sta_pre_auth_ctx && |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1184 | (sta_pre_auth_ctx->mlmState != eLIM_MLM_AUTHENTICATED_STATE))) { |
| 1185 | /* |
| 1186 | * STA is not pre-authenticated yet requesting Re/Association |
| 1187 | * before Authentication. OR STA is in the process of getting |
| 1188 | * authenticated and sent Re/Association request. Send |
| 1189 | * Deauthentication frame with 'prior authentication required' |
| 1190 | * reason code. |
| 1191 | */ |
| 1192 | lim_send_deauth_mgmt_frame(mac_ctx, |
| 1193 | eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, |
| 1194 | hdr->sa, session, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1195 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1196 | pe_warn("rcvd %s req, sessionid: %d, without pre-auth ctx" |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1197 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1198 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1199 | session->peSessionId, QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1200 | return false; |
| 1201 | } |
| 1202 | /* Delete 'pre-auth' context of STA */ |
| 1203 | *auth_type = sta_pre_auth_ctx->authType; |
Srinivas Dasari | 5f52820 | 2019-02-11 17:29:43 +0530 | [diff] [blame] | 1204 | if (sta_pre_auth_ctx->authType == eSIR_AUTH_TYPE_SAE) |
| 1205 | assoc_req->is_sae_authenticated = true; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1206 | lim_delete_pre_auth_node(mac_ctx, hdr->sa); |
| 1207 | /* All is well. Assign AID (after else part) */ |
| 1208 | return true; |
| 1209 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1210 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1211 | /** |
| 1212 | * lim_process_assoc_req_sta_ctx() - process assoc req for sta context present |
| 1213 | * @mac_ctx: pointer to Global MAC structure |
| 1214 | * @hdr: pointer to the MAC head |
| 1215 | * @session: pointer to pe session entry |
| 1216 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1217 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1218 | * @sta_pre_auth_ctx: sta pre auth context |
| 1219 | * @sta_ds: station dph entry |
| 1220 | * @peer_idx: peer index |
| 1221 | * @auth_type: indicates security type |
| 1222 | * @update_ctx: indicates if STA context already exist |
| 1223 | * |
| 1224 | * Process assoc req for sta context present |
| 1225 | * |
| 1226 | * Return: true of no error, false otherwise |
| 1227 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1228 | static bool lim_process_assoc_req_sta_ctx(struct mac_context *mac_ctx, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 1229 | tpSirMacMgmtHdr hdr, struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1230 | tpSirAssocReq assoc_req, uint8_t sub_type, |
| 1231 | struct tLimPreAuthNode *sta_pre_auth_ctx, |
| 1232 | tpDphHashNode sta_ds, uint16_t peer_idx, |
| 1233 | tAniAuthType *auth_type, uint8_t *update_ctx) |
| 1234 | { |
| 1235 | /* STA context does exist for this STA */ |
| 1236 | if (sta_ds->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) { |
| 1237 | /* |
| 1238 | * Requesting STA is in some 'transient' state? Ignore the |
| 1239 | * Re/Assoc Req frame by incrementing debug counter & logging |
| 1240 | * error. |
| 1241 | */ |
| 1242 | if (sub_type == LIM_ASSOC) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1243 | #ifdef WLAN_DEBUG |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1244 | mac_ctx->lim.gLimNumAssocReqDropInvldState++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1245 | #endif |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1246 | pe_debug("received Assoc req in state: %X from", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1247 | sta_ds->mlmStaContext.mlmState); |
| 1248 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1249 | #ifdef WLAN_DEBUG |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1250 | mac_ctx->lim.gLimNumReassocReqDropInvldState++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1251 | #endif |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1252 | pe_debug("received ReAssoc req in state: %X from", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1253 | sta_ds->mlmStaContext.mlmState); |
| 1254 | } |
Nishank Aggarwal | ed4c1c5 | 2017-03-11 14:17:49 +0530 | [diff] [blame] | 1255 | lim_print_mac_addr(mac_ctx, hdr->sa, LOGD); |
| 1256 | lim_print_mlm_state(mac_ctx, LOGD, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1257 | (tLimMlmStates) sta_ds->mlmStaContext.mlmState); |
| 1258 | return false; |
| 1259 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1260 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1261 | /* STA sent assoc req frame while already in 'associated' state */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1262 | |
| 1263 | #ifdef WLAN_FEATURE_11W |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1264 | pe_debug("Re/Assoc request from station that is already associated"); |
| 1265 | pe_debug("PMF enabled: %d, SA Query state: %d", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1266 | sta_ds->rmfEnabled, sta_ds->pmfSaQueryState); |
| 1267 | if (sta_ds->rmfEnabled) { |
| 1268 | switch (sta_ds->pmfSaQueryState) { |
| 1269 | /* |
| 1270 | * start SA Query procedure, respond to Association Request with |
| 1271 | * try again later |
| 1272 | */ |
| 1273 | case DPH_SA_QUERY_NOT_IN_PROGRESS: |
| 1274 | /* |
| 1275 | * We should reset the retry counter before we start |
| 1276 | * the SA query procedure, otherwise in next set of SA |
| 1277 | * query procedure we will end up using the stale value. |
| 1278 | */ |
| 1279 | sta_ds->pmfSaQueryRetryCount = 0; |
| 1280 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 1281 | eSIR_MAC_TRY_AGAIN_LATER, 1, hdr->sa, |
| 1282 | sub_type, sta_ds, session); |
| 1283 | lim_send_sa_query_request_frame(mac_ctx, |
| 1284 | (uint8_t *) &(sta_ds->pmfSaQueryCurrentTransId), |
| 1285 | hdr->sa, session); |
| 1286 | sta_ds->pmfSaQueryStartTransId = |
| 1287 | sta_ds->pmfSaQueryCurrentTransId; |
| 1288 | sta_ds->pmfSaQueryCurrentTransId++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1289 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1290 | /* start timer for SA Query retry */ |
| 1291 | if (tx_timer_activate(&sta_ds->pmfSaQueryTimer) |
| 1292 | != TX_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1293 | pe_err("PMF SA Query timer start failed!"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1294 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1295 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1296 | sta_ds->pmfSaQueryState = DPH_SA_QUERY_IN_PROGRESS; |
| 1297 | return false; |
| 1298 | /* |
| 1299 | * SA Query procedure still going, respond to Association |
| 1300 | * Request with try again later |
| 1301 | */ |
| 1302 | case DPH_SA_QUERY_IN_PROGRESS: |
| 1303 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 1304 | eSIR_MAC_TRY_AGAIN_LATER, 1, |
| 1305 | hdr->sa, sub_type, 0, session); |
| 1306 | return false; |
| 1307 | |
| 1308 | /* |
| 1309 | * SA Query procedure timed out, accept Association |
| 1310 | * Request normally |
| 1311 | */ |
| 1312 | case DPH_SA_QUERY_TIMED_OUT: |
| 1313 | sta_ds->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; |
| 1314 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1315 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1316 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1317 | #endif |
| 1318 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1319 | /* no change in the capability so drop the frame */ |
| 1320 | if ((sub_type == LIM_ASSOC) && |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 1321 | (!qdf_mem_cmp(&sta_ds->mlmStaContext.capabilityInfo, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1322 | &assoc_req->capabilityInfo, |
| 1323 | sizeof(tSirMacCapabilityInfo)))) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1324 | pe_err("Received Assoc req in state: %X STAid: %d", |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1325 | sta_ds->mlmStaContext.mlmState, peer_idx); |
| 1326 | return false; |
| 1327 | } else { |
| 1328 | /* |
| 1329 | * STA sent Re/association Request frame while already in |
| 1330 | * 'associated' state. Update STA capabilities and send |
| 1331 | * Association response frame with same AID |
| 1332 | */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1333 | pe_debug("Rcvd Assoc req from STA already connected"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1334 | sta_ds->mlmStaContext.capabilityInfo = |
| 1335 | assoc_req->capabilityInfo; |
| 1336 | if (sta_pre_auth_ctx && (sta_pre_auth_ctx->mlmState == |
| 1337 | eLIM_MLM_AUTHENTICATED_STATE)) { |
| 1338 | /* STA has triggered pre-auth again */ |
| 1339 | *auth_type = sta_pre_auth_ctx->authType; |
| 1340 | lim_delete_pre_auth_node(mac_ctx, hdr->sa); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1341 | } else { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1342 | *auth_type = sta_ds->mlmStaContext.authType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1343 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1344 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1345 | *update_ctx = true; |
| 1346 | if (dph_init_sta_state(mac_ctx, hdr->sa, peer_idx, true, |
| 1347 | &session->dph.dphHashTable) == NULL) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1348 | pe_err("could not Init STAid: %d", peer_idx); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1349 | return false; |
| 1350 | } |
| 1351 | } |
| 1352 | return true; |
| 1353 | } |
| 1354 | |
| 1355 | /** |
| 1356 | * lim_chk_wmm() - wmm related checks |
| 1357 | * @mac_ctx: pointer to Global MAC structure |
| 1358 | * @hdr: pointer to the MAC head |
| 1359 | * @session: pointer to pe session entry |
| 1360 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1361 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1362 | * @qos_mode: qos mode |
| 1363 | * |
| 1364 | * wmm related checks |
| 1365 | * |
| 1366 | * Return: true of no error, false otherwise |
| 1367 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1368 | static bool lim_chk_wmm(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 1369 | struct pe_session *session, tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1370 | uint8_t sub_type, tHalBitVal qos_mode) |
| 1371 | { |
| 1372 | tHalBitVal wme_mode; |
Jeff Johnson | c742d8d | 2017-10-10 16:36:54 -0700 | [diff] [blame] | 1373 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1374 | limGetWmeMode(session, &wme_mode); |
| 1375 | if ((qos_mode == eHAL_SET) || (wme_mode == eHAL_SET)) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1376 | /* |
| 1377 | * for a qsta, check if the requested Traffic spec is admissible |
| 1378 | * for a non-qsta check if the sta can be admitted |
| 1379 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1380 | if (assoc_req->addtsPresent) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1381 | uint8_t tspecIdx = 0; |
Jeff Johnson | c742d8d | 2017-10-10 16:36:54 -0700 | [diff] [blame] | 1382 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1383 | if (lim_admit_control_add_ts(mac_ctx, hdr->sa, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1384 | &(assoc_req->addtsReq), |
| 1385 | &(assoc_req->qosCapability), |
| 1386 | 0, false, NULL, &tspecIdx, session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1387 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1388 | pe_warn("AdmitControl: TSPEC rejected"); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1389 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1390 | eSIR_MAC_QAP_NO_BANDWIDTH_REASON, |
| 1391 | 1, hdr->sa, sub_type, 0, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1392 | #ifdef WLAN_DEBUG |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1393 | mac_ctx->lim.gLimNumAssocReqDropACRejectTS++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1394 | #endif |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1395 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1396 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1397 | } else if (lim_admit_control_add_sta(mac_ctx, hdr->sa, false) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1398 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1399 | pe_warn("AdmitControl: Sta rejected"); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1400 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1401 | eSIR_MAC_QAP_NO_BANDWIDTH_REASON, 1, |
| 1402 | hdr->sa, sub_type, 0, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1403 | #ifdef WLAN_DEBUG |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1404 | mac_ctx->lim.gLimNumAssocReqDropACRejectSta++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1405 | #endif |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1406 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1407 | } |
| 1408 | /* else all ok */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1409 | pe_debug("AdmitControl: Sta OK!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1410 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1411 | return true; |
| 1412 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1413 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1414 | /** |
| 1415 | * lim_update_sta_ds() - updates ds dph entry |
| 1416 | * @mac_ctx: pointer to Global MAC structure |
| 1417 | * @hdr: pointer to the MAC head |
| 1418 | * @session: pointer to pe session entry |
Abhishek Singh | 6108498 | 2016-12-13 17:24:07 +0530 | [diff] [blame] | 1419 | * @assoc_req: pointer to ASSOC/REASSOC Request frame pointer |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1420 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1421 | * @sta_ds: station dph entry |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1422 | * @auth_type: indicates security type |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1423 | * @akm_type: indicates security type in akm |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1424 | * @assoc_req_copied: boolean to indicate if assoc req was copied to tmp above |
| 1425 | * @peer_idx: peer index |
| 1426 | * @qos_mode: qos mode |
| 1427 | * @pmf_connection: flag indicating pmf connection |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 1428 | * @force_1x1: Flag to check if the HT capable STA needs to be downgraded to 1x1 |
| 1429 | * nss. |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1430 | * |
| 1431 | * Updates ds dph entry |
| 1432 | * |
| 1433 | * Return: true of no error, false otherwise |
| 1434 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1435 | static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1436 | struct pe_session *session, |
| 1437 | tpSirAssocReq assoc_req, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1438 | uint8_t sub_type, tpDphHashNode sta_ds, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1439 | tAniAuthType auth_type, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1440 | enum ani_akm_type akm_type, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1441 | bool *assoc_req_copied, uint16_t peer_idx, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 1442 | tHalBitVal qos_mode, bool pmf_connection, |
| 1443 | bool force_1x1) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1444 | { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1445 | tHalBitVal wme_mode, wsm_mode; |
| 1446 | uint8_t *ht_cap_ie = NULL; |
| 1447 | #ifdef WLAN_FEATURE_11W |
| 1448 | tPmfSaQueryTimerId timer_id; |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1449 | uint16_t retry_interval; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1450 | #endif |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1451 | tDot11fIEVHTCaps *vht_caps; |
Abhishek Singh | 6108498 | 2016-12-13 17:24:07 +0530 | [diff] [blame] | 1452 | tpSirAssocReq tmp_assoc_req; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1453 | |
| 1454 | if (assoc_req->VHTCaps.present) |
| 1455 | vht_caps = &assoc_req->VHTCaps; |
| 1456 | else if (assoc_req->vendor_vht_ie.VHTCaps.present && |
| 1457 | session->vendor_vht_sap) |
| 1458 | vht_caps = &assoc_req->vendor_vht_ie.VHTCaps; |
| 1459 | else |
| 1460 | vht_caps = NULL; |
| 1461 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1462 | /* |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1463 | * check here if the parsedAssocReq already pointing to the assoc_req |
| 1464 | * and free it before assigning this new assoc_req |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1465 | */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1466 | if (session->parsedAssocReq) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1467 | tmp_assoc_req = session->parsedAssocReq[sta_ds->assocId]; |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1468 | if (tmp_assoc_req) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1469 | if (tmp_assoc_req->assocReqFrame) { |
| 1470 | qdf_mem_free(tmp_assoc_req->assocReqFrame); |
| 1471 | tmp_assoc_req->assocReqFrame = NULL; |
| 1472 | tmp_assoc_req->assocReqFrameLength = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1473 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1474 | qdf_mem_free(tmp_assoc_req); |
| 1475 | tmp_assoc_req = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1476 | } |
| 1477 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1478 | session->parsedAssocReq[sta_ds->assocId] = assoc_req; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1479 | *assoc_req_copied = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1480 | } |
| 1481 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1482 | sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present; |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1483 | if ((vht_caps) && vht_caps->present) |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1484 | sta_ds->mlmStaContext.vhtCapability = vht_caps->present; |
| 1485 | else |
| 1486 | sta_ds->mlmStaContext.vhtCapability = false; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1487 | lim_update_stads_he_capable(sta_ds, assoc_req); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1488 | sta_ds->qos.addtsPresent = |
| 1489 | (assoc_req->addtsPresent == 0) ? false : true; |
| 1490 | sta_ds->qos.addts = assoc_req->addtsReq; |
| 1491 | sta_ds->qos.capability = assoc_req->qosCapability; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1492 | /* |
| 1493 | * short slot and short preamble should be updated before doing |
| 1494 | * limaddsta |
| 1495 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1496 | sta_ds->shortPreambleEnabled = |
| 1497 | (uint8_t) assoc_req->capabilityInfo.shortPreamble; |
| 1498 | sta_ds->shortSlotTimeEnabled = |
| 1499 | (uint8_t) assoc_req->capabilityInfo.shortSlotTime; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1500 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1501 | sta_ds->valid = 0; |
| 1502 | sta_ds->mlmStaContext.authType = auth_type; |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1503 | sta_ds->mlmStaContext.akm_type = akm_type; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1504 | sta_ds->staType = STA_ENTRY_PEER; |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 1505 | sta_ds->mlmStaContext.force_1x1 = force_1x1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1506 | |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1507 | pe_debug("auth_type = %d, akm_type = %d", auth_type, akm_type); |
| 1508 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1509 | /* |
| 1510 | * TODO: If listen interval is more than certain limit, reject the |
| 1511 | * association. Need to check customer requirements and then implement. |
| 1512 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1513 | sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval; |
| 1514 | sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1515 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1516 | if (IS_DOT11_MODE_HT(session->dot11mode) && |
| 1517 | assoc_req->HTCaps.present && assoc_req->wmeInfoPresent) { |
| 1518 | sta_ds->htGreenfield = (uint8_t) assoc_req->HTCaps.greenField; |
| 1519 | sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity; |
| 1520 | sta_ds->htDsssCckRate40MHzSupport = |
| 1521 | (uint8_t) assoc_req->HTCaps.dsssCckMode40MHz; |
| 1522 | sta_ds->htLsigTXOPProtection = |
| 1523 | (uint8_t) assoc_req->HTCaps.lsigTXOPProtection; |
| 1524 | sta_ds->htMaxAmsduLength = |
| 1525 | (uint8_t) assoc_req->HTCaps.maximalAMSDUsize; |
| 1526 | sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor; |
| 1527 | sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1528 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1529 | /* assoc_req will be copied to session->parsedAssocReq later */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1530 | ht_cap_ie = ((uint8_t *) &assoc_req->HTCaps) + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1531 | |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 1532 | if (session->ht_config.ht_sgi20) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1533 | sta_ds->htShortGI20Mhz = |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1534 | (uint8_t)assoc_req->HTCaps.shortGI20MHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1535 | } else { |
| 1536 | /* Unset htShortGI20Mhz in ht_caps*/ |
| 1537 | *ht_cap_ie &= ~(1 << SIR_MAC_HT_CAP_SHORTGI20MHZ_S); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1538 | sta_ds->htShortGI20Mhz = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1539 | } |
| 1540 | |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 1541 | if (session->ht_config.ht_sgi40) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1542 | sta_ds->htShortGI40Mhz = |
| 1543 | (uint8_t)assoc_req->HTCaps.shortGI40MHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1544 | } else { |
| 1545 | /* Unset htShortGI40Mhz in ht_caps */ |
| 1546 | *ht_cap_ie &= ~(1 << SIR_MAC_HT_CAP_SHORTGI40MHZ_S); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1547 | sta_ds->htShortGI40Mhz = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1548 | } |
| 1549 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1550 | sta_ds->htSupportedChannelWidthSet = |
| 1551 | (uint8_t) assoc_req->HTCaps.supportedChannelWidthSet; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1552 | /* |
| 1553 | * peer just follows AP; so when we are softAP/GO, |
| 1554 | * we just store our session entry's secondary channel offset |
| 1555 | * here in peer INFRA STA. However, if peer's 40MHz channel |
| 1556 | * width support is disabled then secondary channel will be zero |
| 1557 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1558 | sta_ds->htSecondaryChannelOffset = |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1559 | (sta_ds->htSupportedChannelWidthSet) ? |
| 1560 | session->htSecondaryChannelOffset : 0; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1561 | if (assoc_req->operMode.present) { |
Abhishek Singh | 1d8bd62 | 2018-11-13 11:43:55 +0530 | [diff] [blame] | 1562 | enum phy_ch_width ch_width; |
| 1563 | |
| 1564 | ch_width = assoc_req->operMode.chanWidth; |
| 1565 | if (session->ch_width < ch_width) |
| 1566 | ch_width = session->ch_width; |
| 1567 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1568 | sta_ds->vhtSupportedChannelWidthSet = |
Abhishek Singh | 1d8bd62 | 2018-11-13 11:43:55 +0530 | [diff] [blame] | 1569 | (uint8_t) ((ch_width == CH_WIDTH_80MHZ) ? |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1570 | WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : |
| 1571 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1572 | sta_ds->htSupportedChannelWidthSet = |
Abhishek Singh | 1d8bd62 | 2018-11-13 11:43:55 +0530 | [diff] [blame] | 1573 | (uint8_t) (ch_width ? |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1574 | eHT_CHANNEL_WIDTH_40MHZ : |
| 1575 | eHT_CHANNEL_WIDTH_20MHZ); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1576 | } else if ((vht_caps) && vht_caps->present) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1577 | /* |
| 1578 | * Check if STA has enabled it's channel bonding mode. |
| 1579 | * If channel bonding mode is enabled, we decide based |
| 1580 | * on SAP's current configuration. else, we set it to |
Jeff Johnson | c742d8d | 2017-10-10 16:36:54 -0700 | [diff] [blame] | 1581 | * VHT20. |
| 1582 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1583 | sta_ds->vhtSupportedChannelWidthSet = |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1584 | (uint8_t) ((sta_ds->htSupportedChannelWidthSet |
| 1585 | == eHT_CHANNEL_WIDTH_20MHZ) ? |
| 1586 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ : |
| 1587 | session->ch_width - 1); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1588 | sta_ds->htMaxRxAMpduFactor = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1589 | vht_caps->maxAMPDULenExp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1590 | } |
| 1591 | /* Lesser among the AP and STA bandwidth of operation. */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1592 | sta_ds->htSupportedChannelWidthSet = |
| 1593 | (sta_ds->htSupportedChannelWidthSet < |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1594 | session->htSupportedChannelWidthSet) ? |
| 1595 | sta_ds->htSupportedChannelWidthSet : |
| 1596 | session->htSupportedChannelWidthSet; |
Abhishek Singh | 1d8bd62 | 2018-11-13 11:43:55 +0530 | [diff] [blame] | 1597 | |
| 1598 | if (!sta_ds->htSupportedChannelWidthSet) |
| 1599 | sta_ds->vhtSupportedChannelWidthSet = |
| 1600 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ; |
| 1601 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1602 | sta_ds->htLdpcCapable = |
| 1603 | (uint8_t) assoc_req->HTCaps.advCodingCap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1604 | } |
| 1605 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1606 | if ((vht_caps) && vht_caps->present && |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1607 | assoc_req->wmeInfoPresent) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1608 | sta_ds->vhtLdpcCapable = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1609 | (uint8_t) vht_caps->ldpcCodingCap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1610 | } |
| 1611 | |
gaolez | 7bb1e74 | 2017-03-21 16:37:38 +0800 | [diff] [blame] | 1612 | if (assoc_req->ExtCap.present) |
| 1613 | sta_ds->non_ecsa_capable = |
| 1614 | !((struct s_ext_cap *)assoc_req->ExtCap.bytes)-> |
| 1615 | ext_chan_switch; |
| 1616 | else |
| 1617 | sta_ds->non_ecsa_capable = 1; |
| 1618 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1619 | if (!assoc_req->wmeInfoPresent) { |
| 1620 | sta_ds->mlmStaContext.htCapability = 0; |
| 1621 | sta_ds->mlmStaContext.vhtCapability = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1622 | } |
Naveen Rawat | 2eb4c83 | 2018-02-15 10:47:38 -0800 | [diff] [blame] | 1623 | |
| 1624 | if (sta_ds->mlmStaContext.vhtCapability && vht_caps) { |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 1625 | if (session->vht_config.su_beam_formee && |
Naveen Rawat | 2eb4c83 | 2018-02-15 10:47:38 -0800 | [diff] [blame] | 1626 | vht_caps->suBeamFormerCap) |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1627 | sta_ds->vhtBeamFormerCapable = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1628 | else |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1629 | sta_ds->vhtBeamFormerCapable = 0; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 1630 | if (session->vht_config.su_beam_former && |
Naveen Rawat | 2eb4c83 | 2018-02-15 10:47:38 -0800 | [diff] [blame] | 1631 | vht_caps->suBeamformeeCap) |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1632 | sta_ds->vht_su_bfee_capable = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1633 | else |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1634 | sta_ds->vht_su_bfee_capable = 0; |
Naveen Rawat | 2eb4c83 | 2018-02-15 10:47:38 -0800 | [diff] [blame] | 1635 | |
| 1636 | pe_debug("peer_caps: suBformer: %d, suBformee: %d", |
| 1637 | vht_caps->suBeamFormerCap, |
| 1638 | vht_caps->suBeamformeeCap); |
| 1639 | pe_debug("self_cap: suBformer: %d, suBformee: %d", |
| 1640 | session->vht_config.su_beam_former, |
| 1641 | session->vht_config.su_beam_formee); |
| 1642 | pe_debug("connection's final cap: suBformer: %d, suBformee: %d", |
| 1643 | sta_ds->vhtBeamFormerCapable, |
| 1644 | sta_ds->vht_su_bfee_capable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1645 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1646 | |
| 1647 | lim_intersect_sta_he_caps(assoc_req, session, sta_ds); |
| 1648 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1649 | if (lim_populate_matching_rate_set(mac_ctx, sta_ds, |
| 1650 | &(assoc_req->supportedRates), |
| 1651 | &(assoc_req->extendedRates), |
| 1652 | assoc_req->HTCaps.supportedMCSSet, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1653 | session, vht_caps, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1654 | &assoc_req->he_cap) != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1655 | /* Could not update hash table entry at DPH with rateset */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1656 | pe_err("Couldn't update hash entry for aid: %d MacAddr: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1657 | QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1658 | peer_idx, QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1659 | |
| 1660 | /* Release AID */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1661 | lim_release_peer_idx(mac_ctx, peer_idx, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1662 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1663 | lim_reject_association(mac_ctx, hdr->sa, |
Abhishek Singh | 0bc46d1 | 2017-01-09 13:05:54 +0530 | [diff] [blame] | 1664 | sub_type, true, auth_type, peer_idx, false, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1665 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1666 | session); |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1667 | pe_err("Delete dph hash entry"); |
Abhishek Singh | 0bc46d1 | 2017-01-09 13:05:54 +0530 | [diff] [blame] | 1668 | if (dph_delete_hash_entry(mac_ctx, hdr->sa, sta_ds->assocId, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1669 | &session->dph.dphHashTable) != QDF_STATUS_SUCCESS) |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1670 | pe_err("error deleting hash entry"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1671 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1672 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1673 | if (assoc_req->operMode.present) { |
| 1674 | sta_ds->vhtSupportedRxNss = assoc_req->operMode.rxNSS + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | } else { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1676 | sta_ds->vhtSupportedRxNss = |
| 1677 | ((sta_ds->supportedRates.vhtRxMCSMap & MCSMAPMASK2x2) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1678 | == MCSMAPMASK2x2) ? 1 : 2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1679 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1680 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1681 | /* Add STA context at MAC HW (BMU, RHP & TFP) */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1682 | sta_ds->qosMode = false; |
| 1683 | sta_ds->lleEnabled = false; |
| 1684 | if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET)) { |
| 1685 | sta_ds->lleEnabled = true; |
| 1686 | sta_ds->qosMode = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1687 | } |
| 1688 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1689 | sta_ds->wmeEnabled = false; |
| 1690 | sta_ds->wsmEnabled = false; |
| 1691 | limGetWmeMode(session, &wme_mode); |
| 1692 | if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent |
| 1693 | && (wme_mode == eHAL_SET)) { |
| 1694 | sta_ds->wmeEnabled = true; |
| 1695 | sta_ds->qosMode = true; |
| 1696 | limGetWsmMode(session, &wsm_mode); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1697 | /* |
| 1698 | * WMM_APSD - WMM_SA related processing should be separate; |
| 1699 | * WMM_SA and WMM_APSD can coexist |
| 1700 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1701 | if (assoc_req->WMMInfoStation.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1702 | /* check whether AP supports or not */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1703 | if (LIM_IS_AP_ROLE(session) && |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1704 | (session->apUapsdEnable == 0) && |
| 1705 | (assoc_req->WMMInfoStation.acbe_uapsd || |
| 1706 | assoc_req->WMMInfoStation.acbk_uapsd || |
| 1707 | assoc_req->WMMInfoStation.acvo_uapsd || |
| 1708 | assoc_req->WMMInfoStation.acvi_uapsd)) { |
| 1709 | /* |
| 1710 | * Rcvd Re/Assoc Req from STA when UPASD is |
| 1711 | * not supported. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1712 | */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1713 | pe_err("UAPSD not supported, reply accordingly"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1714 | /* update UAPSD and send it to LIM to add STA */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1715 | sta_ds->qos.capability.qosInfo.acbe_uapsd = 0; |
| 1716 | sta_ds->qos.capability.qosInfo.acbk_uapsd = 0; |
| 1717 | sta_ds->qos.capability.qosInfo.acvo_uapsd = 0; |
| 1718 | sta_ds->qos.capability.qosInfo.acvi_uapsd = 0; |
| 1719 | sta_ds->qos.capability.qosInfo.maxSpLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1720 | } else { |
| 1721 | /* update UAPSD and send it to LIM to add STA */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1722 | sta_ds->qos.capability.qosInfo.acbe_uapsd = |
| 1723 | assoc_req->WMMInfoStation.acbe_uapsd; |
| 1724 | sta_ds->qos.capability.qosInfo.acbk_uapsd = |
| 1725 | assoc_req->WMMInfoStation.acbk_uapsd; |
| 1726 | sta_ds->qos.capability.qosInfo.acvo_uapsd = |
| 1727 | assoc_req->WMMInfoStation.acvo_uapsd; |
| 1728 | sta_ds->qos.capability.qosInfo.acvi_uapsd = |
| 1729 | assoc_req->WMMInfoStation.acvi_uapsd; |
| 1730 | sta_ds->qos.capability.qosInfo.maxSpLen = |
| 1731 | assoc_req->WMMInfoStation.max_sp_length; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1732 | } |
| 1733 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1734 | if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET)) |
| 1735 | sta_ds->wsmEnabled = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1736 | } |
| 1737 | /* Re/Assoc Response frame to requesting STA */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1738 | sta_ds->mlmStaContext.subType = sub_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1739 | |
| 1740 | #ifdef WLAN_FEATURE_11W |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1741 | sta_ds->rmfEnabled = (pmf_connection) ? 1 : 0; |
| 1742 | sta_ds->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; |
| 1743 | timer_id.fields.sessionId = session->peSessionId; |
| 1744 | timer_id.fields.peerIdx = peer_idx; |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 1745 | retry_interval = mac_ctx->mlme_cfg->gen.pmf_sa_query_retry_interval; |
| 1746 | if (cfg_min(CFG_PMF_SA_QUERY_RETRY_INTERVAL) > retry_interval) { |
| 1747 | retry_interval = cfg_default(CFG_PMF_SA_QUERY_RETRY_INTERVAL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | } |
Krunal Soni | a59e8a4 | 2017-11-19 09:00:56 -0800 | [diff] [blame] | 1749 | if (sta_ds->rmfEnabled && |
| 1750 | tx_timer_create(mac_ctx, &sta_ds->pmfSaQueryTimer, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1751 | "PMF SA Query timer", lim_pmf_sa_query_timer_handler, |
| 1752 | timer_id.value, |
| 1753 | SYS_MS_TO_TICKS((retry_interval * 1024) / 1000), |
| 1754 | 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1755 | pe_err("could not create PMF SA Query timer"); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1756 | lim_reject_association(mac_ctx, hdr->sa, sub_type, |
| 1757 | true, auth_type, peer_idx, false, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1758 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1759 | session); |
| 1760 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1761 | } |
Krunal Soni | a59e8a4 | 2017-11-19 09:00:56 -0800 | [diff] [blame] | 1762 | if (sta_ds->rmfEnabled) |
| 1763 | pe_debug("Created pmf timer sta-idx:%d assoc-id:%d", |
| 1764 | sta_ds->staIndex, sta_ds->assocId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1765 | #endif |
| 1766 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1767 | if (assoc_req->ExtCap.present) { |
| 1768 | lim_set_stads_rtt_cap(sta_ds, |
| 1769 | (struct s_ext_cap *) assoc_req->ExtCap.bytes, mac_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1770 | } else { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1771 | sta_ds->timingMeasCap = 0; |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1772 | pe_debug("ExtCap not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1773 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1774 | return true; |
| 1775 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1776 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1777 | /** |
| 1778 | * lim_update_sta_ctx() - add/del sta depending on connection state machine |
| 1779 | * @mac_ctx: pointer to Global MAC structure |
| 1780 | * @session: pointer to pe session entry |
| 1781 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1782 | * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe |
| 1783 | * @sta_ds: station dph entry |
| 1784 | * @update_ctx: indicates if STA context already exist |
| 1785 | * |
| 1786 | * Checks for SSID match |
| 1787 | * |
| 1788 | * Return: true of no error, false otherwise |
| 1789 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1790 | static bool lim_update_sta_ctx(struct mac_context *mac_ctx, struct pe_session *session, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1791 | tpSirAssocReq assoc_req, uint8_t sub_type, |
| 1792 | tpDphHashNode sta_ds, uint8_t update_ctx) |
| 1793 | { |
| 1794 | tLimMlmStates mlm_prev_state; |
| 1795 | /* |
| 1796 | * BTAMP: If STA context already exist (ie. update_ctx = 1) for this STA |
| 1797 | * then we should delete the old one, and add the new STA. This is taken |
| 1798 | * care of in the lim_del_sta() routine. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1799 | * |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1800 | * Prior to BTAMP, we were setting this flag so that when PE receives |
| 1801 | * SME_ASSOC_CNF, and if this flag is set, then PE shall delete the old |
| 1802 | * station and then add. But now in BTAMP, we're directly adding station |
| 1803 | * before waiting for SME_ASSOC_CNF, so we can do this now. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1804 | */ |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1805 | if (!(update_ctx)) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1806 | sta_ds->mlmStaContext.updateContext = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1807 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1808 | /* |
| 1809 | * BTAMP: Add STA context at HW - issue WMA_ADD_STA_REQ to HAL |
| 1810 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1811 | if (lim_add_sta(mac_ctx, sta_ds, false, session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1812 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1813 | pe_err("could not Add STA with assocId: %d", |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1814 | sta_ds->assocId); |
| 1815 | lim_reject_association(mac_ctx, sta_ds->staAddr, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1816 | sta_ds->mlmStaContext.subType, true, |
| 1817 | sta_ds->mlmStaContext.authType, |
| 1818 | sta_ds->assocId, true, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1819 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1820 | session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1821 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1822 | if (session->parsedAssocReq) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1823 | assoc_req = |
| 1824 | session->parsedAssocReq[sta_ds->assocId]; |
| 1825 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | } |
| 1827 | } else { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1828 | sta_ds->mlmStaContext.updateContext = 1; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1829 | mlm_prev_state = sta_ds->mlmStaContext.mlmState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1830 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1831 | /* |
| 1832 | * As per the HAL/FW needs the reassoc req need not be calling |
| 1833 | * lim_del_sta |
| 1834 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1835 | if (sub_type != LIM_REASSOC) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1836 | /* |
| 1837 | * we need to set the mlmState here in order |
| 1838 | * differentiate in lim_del_sta. |
| 1839 | */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1840 | sta_ds->mlmStaContext.mlmState = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1841 | eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1842 | if (lim_del_sta(mac_ctx, sta_ds, true, session) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1843 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1844 | pe_err("Couldn't DEL STA, assocId: %d staId: %d", |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1845 | sta_ds->assocId, sta_ds->staIndex); |
| 1846 | lim_reject_association(mac_ctx, sta_ds->staAddr, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1847 | sta_ds->mlmStaContext.subType, true, |
| 1848 | sta_ds->mlmStaContext.authType, |
| 1849 | sta_ds->assocId, true, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1850 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1851 | session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1852 | |
| 1853 | /* Restoring the state back. */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1854 | sta_ds->mlmStaContext.mlmState = mlm_prev_state; |
| 1855 | if (session->parsedAssocReq) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1856 | assoc_req = session->parsedAssocReq[ |
| 1857 | sta_ds->assocId]; |
| 1858 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1859 | } |
| 1860 | } else { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1861 | /* |
| 1862 | * mlmState is changed in lim_add_sta context use the |
| 1863 | * same AID, already allocated |
| 1864 | */ |
| 1865 | if (lim_add_sta(mac_ctx, sta_ds, false, session) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1866 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 1867 | pe_err("UPASD not supported, REASSOC Failed"); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1868 | lim_reject_association(mac_ctx, sta_ds->staAddr, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1869 | sta_ds->mlmStaContext.subType, true, |
| 1870 | sta_ds->mlmStaContext.authType, |
| 1871 | sta_ds->assocId, true, |
Varun Reddy Yeturu | 725185d | 2017-11-17 14:14:55 -0800 | [diff] [blame] | 1872 | eSIR_MAC_WME_REFUSED_STATUS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1873 | session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1874 | |
| 1875 | /* Restoring the state back. */ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1876 | sta_ds->mlmStaContext.mlmState = mlm_prev_state; |
| 1877 | if (session->parsedAssocReq) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1878 | assoc_req = session->parsedAssocReq[ |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1879 | sta_ds->assocId]; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1880 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1881 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1882 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1883 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1884 | return true; |
| 1885 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1886 | |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1887 | void lim_process_assoc_cleanup(struct mac_context *mac_ctx, |
| 1888 | struct pe_session *session, |
| 1889 | tpSirAssocReq assoc_req, |
| 1890 | tpDphHashNode sta_ds, |
| 1891 | bool assoc_req_copied) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1892 | { |
Abhishek Singh | 6108498 | 2016-12-13 17:24:07 +0530 | [diff] [blame] | 1893 | tpSirAssocReq tmp_assoc_req; |
| 1894 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1895 | if (assoc_req) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1896 | if (assoc_req->assocReqFrame) { |
| 1897 | qdf_mem_free(assoc_req->assocReqFrame); |
| 1898 | assoc_req->assocReqFrame = NULL; |
| 1899 | assoc_req->assocReqFrameLength = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1900 | } |
| 1901 | |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1902 | qdf_mem_free(assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1903 | /* to avoid double free */ |
sheenam monga | d756ff1 | 2019-04-15 15:43:18 +0530 | [diff] [blame] | 1904 | if (assoc_req_copied && session->parsedAssocReq && sta_ds) |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1905 | session->parsedAssocReq[sta_ds->assocId] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1906 | } |
| 1907 | |
| 1908 | /* If it is not duplicate Assoc request then only make to Null */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1909 | if ((sta_ds) && |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1910 | (sta_ds->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE)) { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1911 | if (session->parsedAssocReq) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1912 | tmp_assoc_req = |
| 1913 | session->parsedAssocReq[sta_ds->assocId]; |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1914 | if (tmp_assoc_req) { |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1915 | if (tmp_assoc_req->assocReqFrame) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1916 | qdf_mem_free( |
| 1917 | tmp_assoc_req->assocReqFrame); |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1918 | tmp_assoc_req->assocReqFrame = NULL; |
| 1919 | tmp_assoc_req->assocReqFrameLength = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1920 | } |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 1921 | qdf_mem_free(tmp_assoc_req); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1922 | session->parsedAssocReq[sta_ds->assocId] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1923 | } |
| 1924 | } |
| 1925 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 1926 | } |
| 1927 | |
| 1928 | /** |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1929 | * lim_defer_sme_indication() - Defer assoc indication to SME |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 1930 | * @mac_ctx: Pointer to Global MAC structure |
| 1931 | * @session: pe session entry |
| 1932 | * @sub_type: Indicates whether it is Association Request(=0) or Reassociation |
| 1933 | * Request(=1) frame |
| 1934 | * @hdr: A pointer to the MAC header |
| 1935 | * @assoc_req: pointer to ASSOC/REASSOC Request frame |
| 1936 | * @pmf_connection: flag indicating pmf connection |
| 1937 | * @assoc_req_copied: boolean to indicate if assoc req was copied to tmp above |
| 1938 | * @dup_entry: flag indicating if duplicate entry found |
| 1939 | * |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1940 | * Defer Initialization of PE data structures and wait for an external event. |
| 1941 | * lim_send_assoc_ind_to_sme() will be called to initialize PE data structures |
| 1942 | * when the expected event is received. |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 1943 | * |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1944 | * Return: void |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 1945 | */ |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1946 | static void lim_defer_sme_indication(struct mac_context *mac_ctx, |
| 1947 | struct pe_session *session, |
| 1948 | uint8_t sub_type, |
| 1949 | tpSirMacMgmtHdr hdr, |
| 1950 | struct sSirAssocReq *assoc_req, |
| 1951 | bool pmf_connection, |
| 1952 | bool assoc_req_copied, |
| 1953 | bool dup_entry, |
| 1954 | struct sDphHashNode *sta_ds) |
| 1955 | { |
| 1956 | struct tLimPreAuthNode *sta_pre_auth_ctx; |
| 1957 | /* Extract pre-auth context for the STA, if any. */ |
| 1958 | sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, hdr->sa); |
| 1959 | sta_pre_auth_ctx->assoc_req.present = true; |
| 1960 | sta_pre_auth_ctx->assoc_req.sub_type = sub_type; |
| 1961 | qdf_mem_copy(&sta_pre_auth_ctx->assoc_req.hdr, hdr, |
| 1962 | sizeof(tSirMacMgmtHdr)); |
| 1963 | sta_pre_auth_ctx->assoc_req.assoc_req = assoc_req; |
| 1964 | sta_pre_auth_ctx->assoc_req.pmf_connection = pmf_connection; |
| 1965 | sta_pre_auth_ctx->assoc_req.assoc_req_copied = assoc_req_copied; |
| 1966 | sta_pre_auth_ctx->assoc_req.dup_entry = dup_entry; |
| 1967 | sta_pre_auth_ctx->assoc_req.sta_ds = sta_ds; |
| 1968 | } |
| 1969 | |
| 1970 | bool lim_send_assoc_ind_to_sme(struct mac_context *mac_ctx, |
| 1971 | struct pe_session *session, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 1972 | uint8_t sub_type, tpSirMacMgmtHdr hdr, |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 1973 | tpSirAssocReq assoc_req, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 1974 | enum ani_akm_type akm_type, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 1975 | bool pmf_connection, bool *assoc_req_copied, |
| 1976 | bool dup_entry, bool force_1x1) |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 1977 | { |
| 1978 | uint16_t peer_idx; |
| 1979 | struct tLimPreAuthNode *sta_pre_auth_ctx; |
| 1980 | tpDphHashNode sta_ds = NULL; |
| 1981 | tHalBitVal qos_mode; |
| 1982 | tAniAuthType auth_type; |
| 1983 | uint8_t update_ctx = false; |
| 1984 | |
| 1985 | limGetQosMode(session, &qos_mode); |
| 1986 | /* Extract 'associated' context for STA, if any. */ |
| 1987 | sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, &peer_idx, |
| 1988 | &session->dph.dphHashTable); |
| 1989 | |
| 1990 | /* Extract pre-auth context for the STA, if any. */ |
| 1991 | sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, hdr->sa); |
| 1992 | |
| 1993 | if (!sta_ds) { |
| 1994 | if (!lim_process_assoc_req_no_sta_ctx(mac_ctx, hdr, session, |
| 1995 | assoc_req, sub_type, |
| 1996 | sta_pre_auth_ctx, sta_ds, |
| 1997 | &auth_type)) |
| 1998 | return false; |
| 1999 | } else { |
| 2000 | if (!lim_process_assoc_req_sta_ctx(mac_ctx, hdr, session, |
| 2001 | assoc_req, sub_type, |
| 2002 | sta_pre_auth_ctx, sta_ds, |
| 2003 | peer_idx, &auth_type, |
| 2004 | &update_ctx)) |
| 2005 | return false; |
| 2006 | goto send_ind_to_sme; |
| 2007 | } |
| 2008 | |
| 2009 | /* check if sta is allowed per QoS AC rules */ |
| 2010 | if (!lim_chk_wmm(mac_ctx, hdr, session, assoc_req, sub_type, qos_mode)) |
| 2011 | return false; |
| 2012 | |
| 2013 | /* STA is Associated ! */ |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2014 | pe_debug("Received: %s Req successful from " QDF_MAC_ADDR_STR, |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2015 | (sub_type == LIM_ASSOC) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2016 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2017 | |
| 2018 | /* |
| 2019 | * AID for this association will be same as the peer Index used in DPH |
| 2020 | * table. Assign unused/least recently used peer Index from perStaDs. |
| 2021 | * NOTE: lim_assign_peer_idx() assigns AID values ranging between |
| 2022 | * 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT) |
| 2023 | */ |
| 2024 | |
| 2025 | peer_idx = lim_assign_peer_idx(mac_ctx, session); |
| 2026 | |
| 2027 | if (!peer_idx) { |
| 2028 | /* Could not assign AID. Reject association */ |
| 2029 | pe_err("PeerIdx not avaialble. Reject associaton"); |
| 2030 | lim_reject_association(mac_ctx, hdr->sa, sub_type, |
| 2031 | true, auth_type, peer_idx, false, |
| 2032 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2033 | session); |
| 2034 | return false; |
| 2035 | } |
| 2036 | |
| 2037 | /* Add an entry to hash table maintained by DPH module */ |
| 2038 | |
| 2039 | sta_ds = dph_add_hash_entry(mac_ctx, hdr->sa, peer_idx, |
| 2040 | &session->dph.dphHashTable); |
| 2041 | |
| 2042 | if (!sta_ds) { |
| 2043 | /* Could not add hash table entry at DPH */ |
| 2044 | pe_err("couldn't add hash entry at DPH for aid: %d MacAddr:" |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2045 | QDF_MAC_ADDR_STR, peer_idx, QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2046 | |
| 2047 | /* Release AID */ |
| 2048 | lim_release_peer_idx(mac_ctx, peer_idx, session); |
| 2049 | |
| 2050 | lim_reject_association(mac_ctx, hdr->sa, sub_type, |
| 2051 | true, auth_type, peer_idx, false, |
| 2052 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2053 | session); |
| 2054 | return false; |
| 2055 | } |
| 2056 | |
| 2057 | send_ind_to_sme: |
| 2058 | if (!lim_update_sta_ds(mac_ctx, hdr, session, assoc_req, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2059 | sub_type, sta_ds, auth_type, akm_type, |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2060 | assoc_req_copied, peer_idx, qos_mode, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 2061 | pmf_connection, force_1x1)) |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2062 | return false; |
| 2063 | |
| 2064 | /* BTAMP: Storing the parsed assoc request in the session array */ |
| 2065 | if (session->parsedAssocReq) |
| 2066 | session->parsedAssocReq[sta_ds->assocId] = assoc_req; |
| 2067 | *assoc_req_copied = true; |
| 2068 | |
| 2069 | /* If it is duplicate entry wait till the peer is deleted */ |
| 2070 | if (!dup_entry) { |
| 2071 | if (!lim_update_sta_ctx(mac_ctx, session, assoc_req, |
| 2072 | sub_type, sta_ds, update_ctx)) |
| 2073 | return false; |
| 2074 | } |
| 2075 | |
| 2076 | /* AddSta is success here */ |
| 2077 | if (LIM_IS_AP_ROLE(session) && IS_DOT11_MODE_HT(session->dot11mode) && |
| 2078 | assoc_req->HTCaps.present && assoc_req->wmeInfoPresent) { |
| 2079 | /* |
| 2080 | * Update in the HAL Sta Table for the Update of the Protection |
| 2081 | * Mode |
| 2082 | */ |
| 2083 | lim_post_sm_state_update(mac_ctx, sta_ds->staIndex, |
| 2084 | sta_ds->htMIMOPSState, sta_ds->staAddr, |
| 2085 | session->smeSessionId); |
| 2086 | } |
| 2087 | |
| 2088 | return true; |
| 2089 | } |
| 2090 | |
| 2091 | /** |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2092 | * lim_process_assoc_req_frame() - Process RE/ASSOC Request frame. |
| 2093 | * @mac_ctx: Pointer to Global MAC structure |
| 2094 | * @rx_pkt_info: A pointer to Buffer descriptor + associated PDUs |
| 2095 | * @sub_type: Indicates whether it is Association Request(=0) or Reassociation |
| 2096 | * Request(=1) frame |
| 2097 | * @session: pe session entry |
| 2098 | * |
| 2099 | * This function is called to process RE/ASSOC Request frame. |
| 2100 | * |
| 2101 | * @Return: void |
| 2102 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2103 | void lim_process_assoc_req_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 2104 | uint8_t sub_type, struct pe_session *session) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2105 | { |
| 2106 | bool pmf_connection = false, assoc_req_copied = false; |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2107 | uint8_t *frm_body; |
| 2108 | uint16_t assoc_id = 0; |
Krishna Kumaar Natarajan | db582ec | 2016-03-08 17:37:04 -0800 | [diff] [blame] | 2109 | uint32_t frame_len; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2110 | uint32_t phy_mode; |
| 2111 | tHalBitVal qos_mode; |
| 2112 | tpSirMacMgmtHdr hdr; |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2113 | struct tLimPreAuthNode *sta_pre_auth_ctx; |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2114 | enum ani_akm_type akm_type = ANI_AKM_TYPE_NONE; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2115 | tSirMacCapabilityInfo local_cap; |
| 2116 | tpDphHashNode sta_ds = NULL; |
Abhishek Singh | 6108498 | 2016-12-13 17:24:07 +0530 | [diff] [blame] | 2117 | tpSirAssocReq assoc_req; |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 2118 | bool dup_entry = false, force_1x1 = false; |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 2119 | QDF_STATUS status; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2120 | |
| 2121 | lim_get_phy_mode(mac_ctx, &phy_mode, session); |
| 2122 | |
| 2123 | limGetQosMode(session, &qos_mode); |
| 2124 | |
| 2125 | hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 2126 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 2127 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2128 | pe_debug("Rcvd: %s Req Frame sessionid: %d systemrole: %d MlmState: %d from: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2129 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2130 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
| 2131 | session->peSessionId, GET_LIM_SYSTEM_ROLE(session), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2132 | session->limMlmState, QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2133 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 2134 | if (LIM_IS_STA_ROLE(session)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2135 | pe_err("Rcvd unexpected ASSOC REQ, sessionid: %d sys sub_type: %d for role: %d from: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2136 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2137 | session->peSessionId, sub_type, |
| 2138 | GET_LIM_SYSTEM_ROLE(session), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2139 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2140 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 2141 | WMA_GET_RX_MPDU_DATA(rx_pkt_info), |
| 2142 | frame_len); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2143 | return; |
| 2144 | } |
Liangwei Dong | 9028d75 | 2016-10-17 02:00:17 -0400 | [diff] [blame] | 2145 | if (session->limMlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2146 | pe_err("drop ASSOC REQ on sessionid: %d " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2147 | "role: %d from: "QDF_MAC_ADDR_STR" in limMlmState: %d", |
Liangwei Dong | 9028d75 | 2016-10-17 02:00:17 -0400 | [diff] [blame] | 2148 | session->peSessionId, |
| 2149 | GET_LIM_SYSTEM_ROLE(session), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2150 | QDF_MAC_ADDR_ARRAY(hdr->sa), |
Liangwei Dong | 9028d75 | 2016-10-17 02:00:17 -0400 | [diff] [blame] | 2151 | eLIM_MLM_WT_DEL_BSS_RSP_STATE); |
| 2152 | return; |
| 2153 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2154 | |
| 2155 | /* |
| 2156 | * If a STA is already present in DPH and it is initiating a Assoc |
| 2157 | * re-transmit, do not process it. This can happen when first Assoc Req |
| 2158 | * frame is received but ACK lost at STA side. The ACK for this dropped |
| 2159 | * Assoc Req frame should be sent by HW. Host simply does not process it |
| 2160 | * once the entry for the STA is already present in DPH. |
| 2161 | */ |
| 2162 | sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, &assoc_id, |
| 2163 | &session->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2164 | if (sta_ds) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2165 | if (hdr->fc.retry > 0) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2166 | pe_err("STA is initiating Assoc Req after ACK lost. Do not process sessionid: %d sys sub_type=%d for role=%d from: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2167 | QDF_MAC_ADDR_STR, session->peSessionId, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2168 | sub_type, GET_LIM_SYSTEM_ROLE(session), |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2169 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Abhishek Singh | a0b4dc1 | 2017-03-09 15:29:31 +0530 | [diff] [blame] | 2170 | return; |
Krunal Soni | 1718426 | 2017-06-07 16:42:38 -0700 | [diff] [blame] | 2171 | } else if (!sta_ds->rmfEnabled && (sub_type == LIM_REASSOC)) { |
| 2172 | /* |
| 2173 | * SAP should send reassoc response with reject code |
| 2174 | * to avoid IOT issues. as per the specification SAP |
| 2175 | * should do 4-way handshake after reassoc response and |
| 2176 | * some STA doesn't like 4way handshake after reassoc |
| 2177 | * where some STA does expect 4-way handshake. |
| 2178 | */ |
| 2179 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 2180 | eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS, |
| 2181 | sta_ds->assocId, sta_ds->staAddr, |
| 2182 | sub_type, sta_ds, session); |
| 2183 | pe_err("Rejecting reassoc req from STA"); |
| 2184 | return; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2185 | } else if (!sta_ds->rmfEnabled) { |
| 2186 | /* |
| 2187 | * Do this only for non PMF case. |
| 2188 | * STA might have missed the assoc response, so it is |
| 2189 | * sending assoc request frame again. |
| 2190 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2191 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, QDF_STATUS_SUCCESS, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2192 | sta_ds->assocId, sta_ds->staAddr, |
Krunal Soni | 90ba954 | 2017-03-01 19:45:40 -0800 | [diff] [blame] | 2193 | sub_type, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2194 | sta_ds, session); |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2195 | pe_err("DUT already received an assoc request frame and STA is sending another assoc req.So, do not Process sessionid: %d sys sub_type: %d for role: %d from: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2196 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2197 | session->peSessionId, sub_type, |
| 2198 | session->limSystemRole, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2199 | QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Abhishek Singh | a0b4dc1 | 2017-03-09 15:29:31 +0530 | [diff] [blame] | 2200 | return; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2201 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2202 | } |
| 2203 | |
Jianmin Zhu | fc2cef1 | 2019-01-14 21:23:51 +0800 | [diff] [blame] | 2204 | status = lim_check_sta_in_pe_entries(mac_ctx, hdr, session->peSessionId, |
| 2205 | &dup_entry); |
| 2206 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2207 | pe_err("Reject assoc as duplicate entry is present and is already being deleted, assoc will be accepted once deletion is completed"); |
| 2208 | /* |
| 2209 | * This mean that the duplicate entry is present on other vdev |
| 2210 | * and is already being deleted, so reject the assoc and lets |
| 2211 | * peer try again to connect, once peer is deleted from |
| 2212 | * other vdev. |
| 2213 | */ |
| 2214 | lim_send_assoc_rsp_mgmt_frame( |
| 2215 | mac_ctx, |
| 2216 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2217 | 1, hdr->sa, |
| 2218 | sub_type, 0, session); |
| 2219 | return; |
| 2220 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2221 | |
| 2222 | /* Get pointer to Re/Association Request frame body */ |
| 2223 | frm_body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 2224 | |
Srinivas Girigowda | b971ba2 | 2019-03-04 15:56:28 -0800 | [diff] [blame] | 2225 | if (IEEE80211_IS_MULTICAST(hdr->sa)) { |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2226 | /* |
| 2227 | * Rcvd Re/Assoc Req frame from BC/MC address Log error and |
| 2228 | * ignore it |
| 2229 | */ |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2230 | pe_err("Rcvd: %s Req, sessionid: %d from a BC/MC address" |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2231 | QDF_MAC_ADDR_STR, |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2232 | (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2233 | session->peSessionId, QDF_MAC_ADDR_ARRAY(hdr->sa)); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2234 | return; |
| 2235 | } |
| 2236 | |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2237 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 2238 | (uint8_t *) frm_body, frame_len); |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2239 | |
| 2240 | if (false == lim_chk_sa_da(mac_ctx, hdr, session, sub_type)) |
| 2241 | return; |
| 2242 | |
| 2243 | if (false == lim_chk_tkip(mac_ctx, hdr, session, sub_type)) |
| 2244 | return; |
| 2245 | |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 2246 | /* check for the presence of vendor IE */ |
| 2247 | if ((session->access_policy_vendor_ie) && |
| 2248 | (session->access_policy == |
| 2249 | LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT)) { |
Abhinav Kumar | db3c6f5 | 2018-06-20 15:02:00 +0530 | [diff] [blame] | 2250 | if (frame_len <= LIM_ASSOC_REQ_IE_OFFSET) { |
| 2251 | pe_debug("Received action frame of invalid len %d", |
| 2252 | frame_len); |
| 2253 | return; |
| 2254 | } |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2255 | if (!wlan_get_vendor_ie_ptr_from_oui( |
| 2256 | &session->access_policy_vendor_ie[2], |
| 2257 | 3, frm_body + LIM_ASSOC_REQ_IE_OFFSET, |
Yeshwanth Sriram Guntuka | 9dea24e | 2018-06-14 18:44:41 +0530 | [diff] [blame] | 2258 | frame_len - LIM_ASSOC_REQ_IE_OFFSET)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2259 | pe_err("Vendor ie not present and access policy is %x, Rejected association", |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 2260 | session->access_policy); |
| 2261 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 2262 | eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, hdr->sa, |
| 2263 | sub_type, 0, session); |
| 2264 | return; |
| 2265 | } |
| 2266 | } |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2267 | /* Allocate memory for the Assoc Request frame */ |
| 2268 | assoc_req = qdf_mem_malloc(sizeof(*assoc_req)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2269 | if (!assoc_req) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2270 | return; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2271 | |
| 2272 | /* Parse Assoc Request frame */ |
| 2273 | if (false == lim_chk_assoc_req_parse_error(mac_ctx, hdr, session, |
| 2274 | assoc_req, sub_type, frm_body, frame_len)) |
| 2275 | goto error; |
| 2276 | |
| 2277 | assoc_req->assocReqFrame = qdf_mem_malloc(frame_len); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2278 | if (!assoc_req->assocReqFrame) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2279 | goto error; |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2280 | |
| 2281 | qdf_mem_copy((uint8_t *) assoc_req->assocReqFrame, |
| 2282 | (uint8_t *) frm_body, frame_len); |
| 2283 | assoc_req->assocReqFrameLength = frame_len; |
| 2284 | |
| 2285 | if (false == lim_chk_capab(mac_ctx, hdr, session, assoc_req, |
| 2286 | sub_type, &local_cap)) |
| 2287 | goto error; |
| 2288 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2289 | if (false == lim_chk_ssid(mac_ctx, hdr, session, assoc_req, sub_type)) |
| 2290 | goto error; |
| 2291 | |
| 2292 | if (false == lim_chk_rates(mac_ctx, hdr, session, assoc_req, sub_type)) |
| 2293 | goto error; |
| 2294 | |
| 2295 | if (false == lim_chk_11g_only(mac_ctx, hdr, session, assoc_req, |
| 2296 | sub_type)) |
| 2297 | goto error; |
| 2298 | |
| 2299 | if (false == lim_chk_11n_only(mac_ctx, hdr, session, assoc_req, |
| 2300 | sub_type)) |
| 2301 | goto error; |
| 2302 | |
| 2303 | if (false == lim_chk_11ac_only(mac_ctx, hdr, session, assoc_req, |
| 2304 | sub_type)) |
| 2305 | goto error; |
| 2306 | |
Naveen Rawat | 441bc87 | 2017-12-11 17:25:27 -0800 | [diff] [blame] | 2307 | if (false == lim_chk_11ax_only(mac_ctx, hdr, session, assoc_req, |
| 2308 | sub_type)) |
| 2309 | goto error; |
| 2310 | |
| 2311 | if (false == lim_check_11ax_basic_mcs(mac_ctx, hdr, session, assoc_req, |
| 2312 | sub_type)) |
| 2313 | goto error; |
| 2314 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2315 | /* Spectrum Management (11h) specific checks */ |
| 2316 | lim_process_for_spectrum_mgmt(mac_ctx, hdr, session, |
| 2317 | assoc_req, sub_type, local_cap); |
| 2318 | |
| 2319 | if (false == lim_chk_mcs(mac_ctx, hdr, session, assoc_req, sub_type)) |
| 2320 | goto error; |
| 2321 | |
| 2322 | if (false == lim_chk_is_11b_sta_supported(mac_ctx, hdr, session, |
| 2323 | assoc_req, sub_type, phy_mode)) |
| 2324 | goto error; |
| 2325 | |
| 2326 | /* |
| 2327 | * Check for 802.11n HT caps compatibility; are HT Capabilities |
| 2328 | * turned on in lim? |
| 2329 | */ |
| 2330 | lim_print_ht_cap(mac_ctx, session, assoc_req); |
| 2331 | |
| 2332 | if (false == lim_chk_n_process_wpa_rsn_ie(mac_ctx, hdr, session, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2333 | assoc_req, sub_type, |
| 2334 | &pmf_connection, |
| 2335 | &akm_type)) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2336 | goto error; |
| 2337 | |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2338 | /* Extract pre-auth context for the STA, if any. */ |
| 2339 | sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, hdr->sa); |
| 2340 | |
| 2341 | /* SAE authentication is offloaded to hostapd. Hostapd sends |
| 2342 | * authentication status to driver after completing SAE |
| 2343 | * authentication (after sending out 4/4 SAE auth frame). |
| 2344 | * There is a possible race condition where driver gets |
| 2345 | * assoc request from SAE station before getting authentication |
| 2346 | * status from hostapd. Don't reject the association in such |
| 2347 | * cases and defer the processing of assoc request frame by caching |
| 2348 | * the frame and process it when the auth status is received. |
| 2349 | */ |
| 2350 | if (sta_pre_auth_ctx && |
| 2351 | sta_pre_auth_ctx->authType == eSIR_AUTH_TYPE_SAE && |
| 2352 | sta_pre_auth_ctx->mlmState == eLIM_MLM_WT_SAE_AUTH_STATE) { |
| 2353 | pe_debug("Received assoc request frame while SAE authentication is in progress; Defer association request handling till SAE auth status is received"); |
| 2354 | lim_defer_sme_indication(mac_ctx, session, sub_type, hdr, |
| 2355 | assoc_req, pmf_connection, |
| 2356 | assoc_req_copied, dup_entry, sta_ds); |
| 2357 | return; |
| 2358 | } |
| 2359 | |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 2360 | if (session->opmode == QDF_P2P_GO_MODE) { |
| 2361 | /* |
| 2362 | * WAR: In P2P GO mode, if the P2P client device |
| 2363 | * is only HT capable and not VHT capable, but the P2P |
| 2364 | * GO device is VHT capable and advertises 2x2 NSS with |
| 2365 | * HT capablity client device, which results in IOT |
| 2366 | * issues. |
| 2367 | * When GO is operating in DBS mode, GO beacons |
| 2368 | * advertise 2x2 capability but include OMN IE to |
| 2369 | * indicate current operating mode of 1x1. But here |
| 2370 | * peer device is only HT capable and will not |
| 2371 | * understand OMN IE. |
| 2372 | */ |
| 2373 | force_1x1 = wlan_p2p_check_oui_and_force_1x1( |
| 2374 | frm_body + LIM_ASSOC_REQ_IE_OFFSET, |
| 2375 | frame_len - LIM_ASSOC_REQ_IE_OFFSET); |
| 2376 | } |
| 2377 | |
Srinivas Dasari | 0d9eff1 | 2019-01-07 19:46:46 +0530 | [diff] [blame] | 2378 | /* Send assoc indication to SME */ |
| 2379 | if (!lim_send_assoc_ind_to_sme(mac_ctx, session, sub_type, hdr, |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2380 | assoc_req, akm_type, pmf_connection, |
Pragaspathi Thilagaraj | b3472f0 | 2019-06-04 14:10:44 +0530 | [diff] [blame^] | 2381 | &assoc_req_copied, dup_entry, force_1x1)) |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2382 | goto error; |
| 2383 | |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2384 | return; |
| 2385 | |
| 2386 | error: |
Krunal Soni | 99752a1 | 2016-04-12 17:44:45 -0700 | [diff] [blame] | 2387 | lim_process_assoc_cleanup(mac_ctx, session, assoc_req, sta_ds, |
Srinivas Dasari | 3e54a4a | 2019-01-28 12:02:35 +0530 | [diff] [blame] | 2388 | assoc_req_copied); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2389 | return; |
Naveen Rawat | ada5fac | 2016-01-28 16:24:32 -0800 | [diff] [blame] | 2390 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2391 | |
| 2392 | #ifdef FEATURE_WLAN_WAPI |
| 2393 | /** |
| 2394 | * lim_fill_assoc_ind_wapi_info()- Updates WAPI data in assoc indication |
| 2395 | * @mac_ctx: Global Mac context |
| 2396 | * @assoc_req: pointer to association request |
| 2397 | * @assoc_ind: Pointer to association indication |
| 2398 | * @wpsie: WPS IE |
| 2399 | * |
| 2400 | * This function updates WAPI meta data in association indication message |
| 2401 | * sent to SME. |
| 2402 | * |
| 2403 | * Return: None |
| 2404 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2405 | static void lim_fill_assoc_ind_wapi_info(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2406 | tpSirAssocReq assoc_req, tpLimMlmAssocInd assoc_ind, |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2407 | const uint8_t *wpsie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2408 | { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2409 | if (assoc_req->wapiPresent && (!wpsie)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2410 | pe_debug("Received WAPI IE length in Assoc Req is %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2411 | assoc_req->wapi.length); |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2412 | assoc_ind->wapiIE.wapiIEdata[0] = WLAN_ELEMID_WAPI; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2413 | assoc_ind->wapiIE.wapiIEdata[1] = assoc_req->wapi.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2414 | qdf_mem_copy(&assoc_ind->wapiIE.wapiIEdata[2], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2415 | assoc_req->wapi.info, assoc_req->wapi.length); |
| 2416 | assoc_ind->wapiIE.length = |
| 2417 | 2 + assoc_req->wapi.length; |
| 2418 | } |
| 2419 | return; |
| 2420 | } |
| 2421 | #endif |
| 2422 | |
| 2423 | /** |
| 2424 | * lim_fill_assoc_ind_vht_info() - Updates VHT information in assoc indication |
| 2425 | * @mac_ctx: Global Mac context |
| 2426 | * @assoc_req: pointer to association request |
| 2427 | * @session_entry: PE session entry |
| 2428 | * @assoc_ind: Pointer to association indication |
| 2429 | * |
| 2430 | * This function updates VHT information in association indication message |
| 2431 | * sent to SME. |
| 2432 | * |
| 2433 | * Return: None |
| 2434 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2435 | static void lim_fill_assoc_ind_vht_info(struct mac_context *mac_ctx, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 2436 | struct pe_session *session_entry, |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2437 | tpSirAssocReq assoc_req, |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2438 | tpLimMlmAssocInd assoc_ind, |
| 2439 | tpDphHashNode sta_ds) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2440 | { |
| 2441 | uint8_t chan; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2442 | uint8_t i; |
| 2443 | bool nw_type_11b = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2444 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2445 | if (session_entry->limRFBand == BAND_2G) { |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2446 | if (session_entry->vhtCapability && assoc_req->VHTCaps.present) |
Krishna Kumaar Natarajan | 294da81 | 2016-04-28 14:39:30 -0700 | [diff] [blame] | 2447 | assoc_ind->chan_info.info = MODE_11AC_VHT20_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2448 | else if (session_entry->htCapability |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2449 | && assoc_req->HTCaps.present) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2450 | assoc_ind->chan_info.info = MODE_11NG_HT20; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2451 | else { |
| 2452 | for (i = 0; i < SIR_NUM_11A_RATES; i++) { |
| 2453 | if (sirIsArate(sta_ds-> |
| 2454 | supportedRates.llaRates[i] |
| 2455 | & 0x7F)) { |
| 2456 | assoc_ind->chan_info.info = MODE_11G; |
| 2457 | nw_type_11b = false; |
| 2458 | break; |
| 2459 | } |
| 2460 | } |
| 2461 | if (nw_type_11b) |
| 2462 | assoc_ind->chan_info.info = MODE_11B; |
| 2463 | } |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2464 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2465 | } |
Naveen Rawat | 6186ff9 | 2015-10-12 14:33:53 -0700 | [diff] [blame] | 2466 | |
| 2467 | if (session_entry->vhtCapability && assoc_req->VHTCaps.present) { |
| 2468 | if ((session_entry->ch_width > CH_WIDTH_40MHZ) |
| 2469 | && assoc_req->HTCaps.supportedChannelWidthSet) { |
| 2470 | chan = session_entry->ch_center_freq_seg0; |
| 2471 | assoc_ind->chan_info.band_center_freq1 = |
| 2472 | cds_chan_to_freq(chan); |
| 2473 | assoc_ind->chan_info.info = MODE_11AC_VHT80; |
| 2474 | return; |
| 2475 | } |
| 2476 | |
| 2477 | if ((session_entry->ch_width == CH_WIDTH_40MHZ) |
| 2478 | && assoc_req->HTCaps.supportedChannelWidthSet) { |
| 2479 | assoc_ind->chan_info.info = MODE_11AC_VHT40; |
| 2480 | if (session_entry->htSecondaryChannelOffset == |
| 2481 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 2482 | assoc_ind->chan_info.band_center_freq1 += 10; |
| 2483 | else |
| 2484 | assoc_ind->chan_info.band_center_freq1 -= 10; |
| 2485 | return; |
| 2486 | } |
| 2487 | |
| 2488 | assoc_ind->chan_info.info = MODE_11AC_VHT20; |
| 2489 | return; |
| 2490 | } |
| 2491 | |
| 2492 | if (session_entry->htCapability && assoc_req->HTCaps.present) { |
| 2493 | if ((session_entry->ch_width == CH_WIDTH_40MHZ) |
| 2494 | && assoc_req->HTCaps.supportedChannelWidthSet) { |
| 2495 | assoc_ind->chan_info.info = MODE_11NA_HT40; |
| 2496 | if (session_entry->htSecondaryChannelOffset == |
| 2497 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 2498 | assoc_ind->chan_info.band_center_freq1 += 10; |
| 2499 | else |
| 2500 | assoc_ind->chan_info.band_center_freq1 -= 10; |
| 2501 | return; |
| 2502 | } |
| 2503 | |
| 2504 | assoc_ind->chan_info.info = MODE_11NA_HT20; |
| 2505 | return; |
| 2506 | } |
| 2507 | |
| 2508 | assoc_ind->chan_info.info = MODE_11A; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2509 | return; |
| 2510 | } |
| 2511 | |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2512 | static uint8_t lim_get_max_rate_idx(tSirMacRateSet *rateset) |
| 2513 | { |
| 2514 | uint8_t maxidx; |
| 2515 | int i; |
| 2516 | |
| 2517 | maxidx = rateset->rate[0] & 0x7f; |
| 2518 | for (i = 1; i < rateset->numRates; i++) { |
| 2519 | if ((rateset->rate[i] & 0x7f) > maxidx) |
| 2520 | maxidx = rateset->rate[i] & 0x7f; |
| 2521 | } |
| 2522 | |
| 2523 | return maxidx; |
| 2524 | } |
| 2525 | |
| 2526 | static void fill_mlm_assoc_ind_vht(tpSirAssocReq assocreq, |
| 2527 | tpDphHashNode stads, |
| 2528 | tpLimMlmAssocInd assocind) |
| 2529 | { |
| 2530 | if (stads->mlmStaContext.vhtCapability) { |
| 2531 | /* ampdu */ |
| 2532 | assocind->ampdu = true; |
| 2533 | |
| 2534 | /* sgi */ |
| 2535 | if (assocreq->VHTCaps.shortGI80MHz || |
| 2536 | assocreq->VHTCaps.shortGI160and80plus80MHz) |
| 2537 | assocind->sgi_enable = true; |
| 2538 | |
| 2539 | /* stbc */ |
| 2540 | assocind->tx_stbc = assocreq->VHTCaps.txSTBC; |
| 2541 | assocind->rx_stbc = assocreq->VHTCaps.rxSTBC; |
| 2542 | |
| 2543 | /* ch width */ |
| 2544 | assocind->ch_width = stads->vhtSupportedChannelWidthSet ? |
| 2545 | eHT_CHANNEL_WIDTH_80MHZ : |
| 2546 | stads->htSupportedChannelWidthSet ? |
| 2547 | eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ; |
| 2548 | |
| 2549 | /* mode */ |
| 2550 | assocind->mode = SIR_SME_PHY_MODE_VHT; |
| 2551 | assocind->rx_mcs_map = assocreq->VHTCaps.rxMCSMap & 0xff; |
| 2552 | assocind->tx_mcs_map = assocreq->VHTCaps.txMCSMap & 0xff; |
| 2553 | } |
| 2554 | } |
| 2555 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2556 | /** |
| 2557 | * lim_send_mlm_assoc_ind() - Sends assoc indication to SME |
| 2558 | * @mac_ctx: Global Mac context |
| 2559 | * @sta_ds: Station DPH hash entry |
| 2560 | * @session_entry: PE session entry |
| 2561 | * |
| 2562 | * This function sends either LIM_MLM_ASSOC_IND |
| 2563 | * or LIM_MLM_REASSOC_IND to SME. |
| 2564 | * |
| 2565 | * Return: None |
| 2566 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2567 | void lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, |
Jeff Johnson | 5b574dd | 2018-11-19 06:49:34 -0800 | [diff] [blame] | 2568 | tpDphHashNode sta_ds, struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2569 | { |
| 2570 | tpLimMlmAssocInd assoc_ind = NULL; |
| 2571 | tpSirAssocReq assoc_req; |
| 2572 | uint16_t temp, rsn_len; |
| 2573 | uint32_t phy_mode; |
| 2574 | uint8_t sub_type; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2575 | const uint8_t *wpsie = NULL; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2576 | uint8_t maxidx, i; |
Pragaspathi Thilagaraj | ec7dc25 | 2018-09-06 15:38:49 +0530 | [diff] [blame] | 2577 | bool wme_enable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2578 | |
Pragaspathi Thilagaraj | aba1b5d | 2018-11-13 14:29:44 +0530 | [diff] [blame] | 2579 | if (!session_entry->parsedAssocReq) { |
| 2580 | pe_err(" Parsed Assoc req is NULL"); |
| 2581 | return; |
| 2582 | } |
| 2583 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2584 | /* Get a copy of the already parsed Assoc Request */ |
| 2585 | assoc_req = |
| 2586 | (tpSirAssocReq) session_entry->parsedAssocReq[sta_ds->assocId]; |
| 2587 | |
Pragaspathi Thilagaraj | aba1b5d | 2018-11-13 14:29:44 +0530 | [diff] [blame] | 2588 | if (!assoc_req) { |
| 2589 | pe_err("assoc req for assoc_id:%d is NULL", sta_ds->assocId); |
| 2590 | return; |
| 2591 | } |
| 2592 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2593 | /* Get the phy_mode */ |
| 2594 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 2595 | |
| 2596 | /* Determine if its Assoc or ReAssoc Request */ |
| 2597 | if (assoc_req->reassocRequest == 1) |
| 2598 | sub_type = LIM_REASSOC; |
| 2599 | else |
| 2600 | sub_type = LIM_ASSOC; |
| 2601 | |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2602 | pe_debug("Sessionid: %d ssid: %s sub_type: %d Associd: %d staAddr: " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2603 | QDF_MAC_ADDR_STR, session_entry->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2604 | assoc_req->ssId.ssId, sub_type, sta_ds->assocId, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2605 | QDF_MAC_ADDR_ARRAY(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2606 | |
| 2607 | if (sub_type == LIM_ASSOC || sub_type == LIM_REASSOC) { |
| 2608 | temp = sizeof(tLimMlmAssocInd); |
| 2609 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2610 | assoc_ind = qdf_mem_malloc(temp); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2611 | if (!assoc_ind) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2612 | lim_release_peer_idx(mac_ctx, sta_ds->assocId, |
| 2613 | session_entry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2614 | return; |
| 2615 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2616 | qdf_mem_copy((uint8_t *) assoc_ind->peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2617 | (uint8_t *) sta_ds->staAddr, sizeof(tSirMacAddr)); |
| 2618 | assoc_ind->aid = sta_ds->assocId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2619 | qdf_mem_copy((uint8_t *) &assoc_ind->ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2620 | (uint8_t *) &(assoc_req->ssId), |
| 2621 | assoc_req->ssId.length + 1); |
| 2622 | assoc_ind->sessionId = session_entry->peSessionId; |
| 2623 | assoc_ind->authType = sta_ds->mlmStaContext.authType; |
Min Liu | ddd2330 | 2018-12-05 16:17:48 +0800 | [diff] [blame] | 2624 | assoc_ind->akm_type = sta_ds->mlmStaContext.akm_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2625 | assoc_ind->capabilityInfo = assoc_req->capabilityInfo; |
| 2626 | |
| 2627 | /* Fill in RSN IE information */ |
| 2628 | assoc_ind->rsnIE.length = 0; |
| 2629 | /* if WPS IE is present, ignore RSN IE */ |
| 2630 | if (assoc_req->addIEPresent && assoc_req->addIE.length) { |
| 2631 | wpsie = limGetWscIEPtr(mac_ctx, |
| 2632 | assoc_req->addIE.addIEdata, |
| 2633 | assoc_req->addIE.length); |
| 2634 | } |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2635 | if (assoc_req->rsnPresent && (!wpsie)) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2636 | pe_debug("Assoc Req RSN IE len: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2637 | assoc_req->rsn.length); |
| 2638 | assoc_ind->rsnIE.length = 2 + assoc_req->rsn.length; |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2639 | assoc_ind->rsnIE.rsnIEdata[0] = WLAN_ELEMID_RSN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2640 | assoc_ind->rsnIE.rsnIEdata[1] = |
| 2641 | assoc_req->rsn.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2642 | qdf_mem_copy(&assoc_ind->rsnIE.rsnIEdata[2], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2643 | assoc_req->rsn.info, |
| 2644 | assoc_req->rsn.length); |
| 2645 | } |
| 2646 | /* Fill in 802.11h related info */ |
| 2647 | if (assoc_req->powerCapabilityPresent |
| 2648 | && assoc_req->supportedChannelsPresent) { |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 2649 | assoc_ind->spectrumMgtIndicator = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2650 | assoc_ind->powerCap.minTxPower = |
| 2651 | assoc_req->powerCapability.minTxPower; |
| 2652 | assoc_ind->powerCap.maxTxPower = |
| 2653 | assoc_req->powerCapability.maxTxPower; |
| 2654 | lim_convert_supported_channels(mac_ctx, assoc_ind, |
| 2655 | assoc_req); |
| 2656 | } else { |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 2657 | assoc_ind->spectrumMgtIndicator = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2658 | } |
| 2659 | |
| 2660 | /* This check is to avoid extra Sec IEs present incase of WPS */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2661 | if (assoc_req->wpaPresent && (!wpsie)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2662 | rsn_len = assoc_ind->rsnIE.length; |
| 2663 | if ((rsn_len + assoc_req->wpa.length) |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 2664 | >= WLAN_MAX_IE_LEN) { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2665 | pe_err("rsnIEdata index out of bounds: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2666 | rsn_len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2667 | qdf_mem_free(assoc_ind); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2668 | return; |
| 2669 | } |
| 2670 | assoc_ind->rsnIE.rsnIEdata[rsn_len] = |
| 2671 | SIR_MAC_WPA_EID; |
| 2672 | assoc_ind->rsnIE.rsnIEdata[rsn_len + 1] |
| 2673 | = assoc_req->wpa.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2674 | qdf_mem_copy( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2675 | &assoc_ind->rsnIE.rsnIEdata[rsn_len + 2], |
| 2676 | assoc_req->wpa.info, assoc_req->wpa.length); |
| 2677 | assoc_ind->rsnIE.length += 2 + assoc_req->wpa.length; |
| 2678 | } |
| 2679 | #ifdef FEATURE_WLAN_WAPI |
| 2680 | lim_fill_assoc_ind_wapi_info(mac_ctx, assoc_req, assoc_ind, |
| 2681 | wpsie); |
| 2682 | #endif |
| 2683 | |
| 2684 | assoc_ind->addIE.length = 0; |
| 2685 | if (assoc_req->addIEPresent) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2686 | qdf_mem_copy(&assoc_ind->addIE.addIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2687 | assoc_req->addIE.addIEdata, |
| 2688 | assoc_req->addIE.length); |
| 2689 | assoc_ind->addIE.length = assoc_req->addIE.length; |
| 2690 | } |
| 2691 | /* |
| 2692 | * Add HT Capabilities into addIE for OBSS |
| 2693 | * processing in hostapd |
| 2694 | */ |
| 2695 | if (assoc_req->HTCaps.present) { |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2696 | qdf_mem_copy(&assoc_ind->ht_caps, &assoc_req->HTCaps, |
| 2697 | sizeof(tDot11fIEHTCaps)); |
| 2698 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2699 | rsn_len = assoc_ind->addIE.length; |
| 2700 | if (assoc_ind->addIE.length + DOT11F_IE_HTCAPS_MIN_LEN |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 2701 | + 2 < WLAN_MAX_IE_LEN) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2702 | assoc_ind->addIE.addIEdata[rsn_len] = |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2703 | WLAN_ELEMID_HTCAP_ANA; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2704 | assoc_ind->addIE.addIEdata[rsn_len + 1] = |
| 2705 | DOT11F_IE_HTCAPS_MIN_LEN; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2706 | qdf_mem_copy( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2707 | &assoc_ind->addIE.addIEdata[rsn_len+2], |
| 2708 | ((uint8_t *)&assoc_req->HTCaps) + 1, |
| 2709 | DOT11F_IE_HTCAPS_MIN_LEN); |
| 2710 | assoc_ind->addIE.length += |
| 2711 | 2 + DOT11F_IE_HTCAPS_MIN_LEN; |
| 2712 | } else { |
Nishank Aggarwal | 8935e44 | 2017-03-23 19:11:08 +0530 | [diff] [blame] | 2713 | pe_err("Fail:HT capabilities IE to addIE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2714 | } |
| 2715 | } |
| 2716 | |
| 2717 | if (assoc_req->wmeInfoPresent) { |
Pragaspathi Thilagaraj | ec7dc25 | 2018-09-06 15:38:49 +0530 | [diff] [blame] | 2718 | /* Set whether AP is enabled with WMM or not */ |
| 2719 | wme_enable = mac_ctx->mlme_cfg->wmm_params.wme_enabled; |
| 2720 | assoc_ind->WmmStaInfoPresent = wme_enable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2721 | /* |
| 2722 | * Note: we are not rejecting association here |
| 2723 | * because IOT will fail |
| 2724 | */ |
| 2725 | } |
| 2726 | /* Required for indicating the frames to upper layer */ |
| 2727 | assoc_ind->assocReqLength = assoc_req->assocReqFrameLength; |
| 2728 | assoc_ind->assocReqPtr = assoc_req->assocReqFrame; |
| 2729 | |
| 2730 | assoc_ind->beaconPtr = session_entry->beacon; |
| 2731 | assoc_ind->beaconLength = session_entry->bcnLen; |
| 2732 | |
| 2733 | assoc_ind->chan_info.chan_id = |
| 2734 | session_entry->currentOperChannel; |
| 2735 | assoc_ind->chan_info.mhz = |
| 2736 | cds_chan_to_freq(session_entry->currentOperChannel); |
| 2737 | assoc_ind->chan_info.band_center_freq1 = |
| 2738 | cds_chan_to_freq(session_entry->currentOperChannel); |
| 2739 | assoc_ind->chan_info.band_center_freq2 = 0; |
| 2740 | assoc_ind->chan_info.reg_info_1 = |
| 2741 | (session_entry->maxTxPower << 16); |
| 2742 | assoc_ind->chan_info.reg_info_2 = |
| 2743 | (session_entry->maxTxPower << 8); |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 2744 | assoc_ind->chan_info.nss = sta_ds->nss; |
| 2745 | assoc_ind->chan_info.rate_flags = |
| 2746 | lim_get_max_rate_flags(mac_ctx, sta_ds); |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2747 | assoc_ind->ampdu = false; |
| 2748 | assoc_ind->sgi_enable = false; |
| 2749 | assoc_ind->tx_stbc = false; |
| 2750 | assoc_ind->rx_stbc = false; |
| 2751 | assoc_ind->ch_width = eHT_CHANNEL_WIDTH_20MHZ; |
| 2752 | assoc_ind->mode = SIR_SME_PHY_MODE_LEGACY; |
| 2753 | assoc_ind->max_supp_idx = 0xff; |
| 2754 | assoc_ind->max_ext_idx = 0xff; |
| 2755 | assoc_ind->max_mcs_idx = 0xff; |
| 2756 | assoc_ind->rx_mcs_map = 0xff; |
| 2757 | assoc_ind->tx_mcs_map = 0xff; |
| 2758 | |
| 2759 | if (assoc_req->supportedRates.numRates) |
| 2760 | assoc_ind->max_supp_idx = |
| 2761 | lim_get_max_rate_idx( |
| 2762 | &assoc_req->supportedRates); |
| 2763 | if (assoc_req->extendedRates.numRates) |
| 2764 | assoc_ind->max_ext_idx = |
| 2765 | lim_get_max_rate_idx( |
| 2766 | &assoc_req->extendedRates); |
| 2767 | |
| 2768 | if (sta_ds->mlmStaContext.htCapability) { |
| 2769 | /* ampdu */ |
| 2770 | assoc_ind->ampdu = true; |
| 2771 | |
| 2772 | /* sgi */ |
| 2773 | if (sta_ds->htShortGI20Mhz || sta_ds->htShortGI40Mhz) |
| 2774 | assoc_ind->sgi_enable = true; |
| 2775 | |
| 2776 | /* stbc */ |
| 2777 | assoc_ind->tx_stbc = assoc_req->HTCaps.txSTBC; |
| 2778 | assoc_ind->rx_stbc = assoc_req->HTCaps.rxSTBC; |
| 2779 | |
| 2780 | /* ch width */ |
| 2781 | assoc_ind->ch_width = |
| 2782 | sta_ds->htSupportedChannelWidthSet ? |
| 2783 | eHT_CHANNEL_WIDTH_40MHZ : |
| 2784 | eHT_CHANNEL_WIDTH_20MHZ; |
| 2785 | |
| 2786 | /* mode */ |
| 2787 | assoc_ind->mode = SIR_SME_PHY_MODE_HT; |
| 2788 | maxidx = 0; |
| 2789 | for (i = 0; i < 8; i++) { |
| 2790 | if (assoc_req->HTCaps.supportedMCSSet[0] & |
| 2791 | (1 << i)) |
| 2792 | maxidx = i; |
| 2793 | } |
| 2794 | assoc_ind->max_mcs_idx = maxidx; |
| 2795 | } |
| 2796 | fill_mlm_assoc_ind_vht(assoc_req, sta_ds, assoc_ind); |
gaolez | 7bb1e74 | 2017-03-21 16:37:38 +0800 | [diff] [blame] | 2797 | if (assoc_req->ExtCap.present) |
| 2798 | assoc_ind->ecsa_capable = |
| 2799 | ((struct s_ext_cap *)assoc_req->ExtCap.bytes)-> |
| 2800 | ext_chan_switch; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2801 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2802 | /* updates VHT information in assoc indication */ |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2803 | qdf_mem_copy(&assoc_ind->vht_caps, &assoc_req->VHTCaps, |
| 2804 | sizeof(tDot11fIEVHTCaps)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2805 | lim_fill_assoc_ind_vht_info(mac_ctx, session_entry, assoc_req, |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2806 | assoc_ind, sta_ds); |
Ashish Kumar Dhanotiya | 6025c70 | 2019-03-20 18:48:49 +0530 | [diff] [blame] | 2807 | assoc_ind->he_caps_present = assoc_req->he_cap.present; |
Srinivas Dasari | 5f52820 | 2019-02-11 17:29:43 +0530 | [diff] [blame] | 2808 | assoc_ind->is_sae_authenticated = |
| 2809 | assoc_req->is_sae_authenticated; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2810 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_IND, |
| 2811 | (uint32_t *) assoc_ind); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2812 | qdf_mem_free(assoc_ind); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2813 | } |
| 2814 | return; |
| 2815 | } |