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