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