Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Pankaj Singh | be225ca | 2020-06-04 10:45:24 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2015, 2017-2018, 2020 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 28 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 29 | * This file limProcessAuthFrame.cc contains the code |
| 30 | * for processing received Authentication Frame. |
| 31 | * Author: Chandra Modumudi |
| 32 | * Date: 03/11/02 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * -------------------------------------------------------------------- |
| 36 | * 05/12/2010 js To support Shared key authentication at AP side |
| 37 | * |
| 38 | */ |
| 39 | |
| 40 | #include "wniApi.h" |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 41 | #include "wniCfg.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | #include "aniGlobal.h" |
| 43 | #include "cfgApi.h" |
| 44 | |
| 45 | #include "utilsApi.h" |
| 46 | #include "limUtils.h" |
| 47 | #include "limAssocUtils.h" |
| 48 | #include "limSecurityUtils.h" |
| 49 | #include "limSerDesUtils.h" |
| 50 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 51 | #include "limFT.h" |
| 52 | #endif |
| 53 | #include "vos_utils.h" |
Padma, Santhosh Kumar | 67f479b | 2016-12-28 15:43:42 +0530 | [diff] [blame] | 54 | #ifdef WLAN_FEATURE_LFR_MBB |
| 55 | #include "lim_mbb.h" |
| 56 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | |
| 58 | |
| 59 | /** |
| 60 | * isAuthValid |
| 61 | * |
| 62 | *FUNCTION: |
| 63 | * This function is called by limProcessAuthFrame() upon Authentication |
| 64 | * frame reception. |
| 65 | * |
| 66 | *LOGIC: |
| 67 | * This function is used to test validity of auth frame: |
| 68 | * - AUTH1 and AUTH3 must be received in AP mode |
| 69 | * - AUTH2 and AUTH4 must be received in STA mode |
| 70 | * - AUTH3 and AUTH4 must have challenge text IE, that is,'type' field has been set to |
| 71 | * SIR_MAC_CHALLENGE_TEXT_EID by parser |
| 72 | * - |
| 73 | * |
| 74 | *ASSUMPTIONS: |
| 75 | * |
| 76 | *NOTE: |
| 77 | * |
| 78 | * @param *auth - Pointer to extracted auth frame body |
| 79 | * |
| 80 | * @return 0 or 1 (Valid) |
| 81 | */ |
| 82 | |
| 83 | |
| 84 | static inline unsigned int isAuthValid(tpAniSirGlobal pMac, tpSirMacAuthFrameBody auth,tpPESession sessionEntry) { |
| 85 | unsigned int valid; |
| 86 | valid=1; |
| 87 | |
| 88 | if ( ((auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_1)|| |
| 89 | (auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_3)) && |
| 90 | ((sessionEntry->limSystemRole == eLIM_STA_ROLE)||(sessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))) |
| 91 | valid=0; |
| 92 | |
| 93 | if ( ((auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_2)||(auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_4))&& |
| 94 | ((sessionEntry->limSystemRole == eLIM_AP_ROLE)||(sessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))) |
| 95 | valid=0; |
| 96 | |
| 97 | if ( ((auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_3)||(auth->authTransactionSeqNumber==SIR_MAC_AUTH_FRAME_4))&& |
| 98 | (auth->type!=SIR_MAC_CHALLENGE_TEXT_EID)&&(auth->authAlgoNumber != eSIR_SHARED_KEY)) |
| 99 | valid=0; |
| 100 | |
| 101 | return valid; |
| 102 | } |
| 103 | |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 104 | #ifdef WLAN_FEATURE_SAE |
| 105 | /** |
Pankaj Singh | f9c4ca7 | 2020-06-05 01:09:07 +0530 | [diff] [blame] | 106 | * lim_external_auth_add_pre_auth_node()- Add preauth node for the peer |
| 107 | * performing external authentication |
| 108 | * @mac_ctx: MAC context |
| 109 | * @mac_hdr: Mac header of the packet |
| 110 | * @mlm_state: MLM state to be marked to track SAE authentication |
| 111 | * |
| 112 | * Return: None |
| 113 | */ |
| 114 | static void lim_external_auth_add_pre_auth_node(tpAniSirGlobal mac_ctx, |
| 115 | tpSirMacMgmtHdr mac_hdr, |
| 116 | tLimMlmStates mlm_state) |
| 117 | { |
| 118 | struct tLimPreAuthNode *auth_node; |
| 119 | tpLimPreAuthTable preauth_table = &mac_ctx->lim.gLimPreAuthTimerTable; |
| 120 | |
| 121 | limLog(mac_ctx, LOG1, FL("=======> eSIR_AUTH_TYPE_SAE")); |
| 122 | /* Create entry for this STA in pre-auth list */ |
| 123 | auth_node = limAcquireFreePreAuthNode(mac_ctx, preauth_table); |
| 124 | if (!auth_node) { |
| 125 | limLog(mac_ctx, LOG1, |
| 126 | "Max pre-auth nodes reached " MAC_ADDRESS_STR, |
| 127 | MAC_ADDR_ARRAY(mac_hdr->sa)); |
| 128 | return; |
| 129 | } |
| 130 | limLog(mac_ctx, LOG1, |
| 131 | "Creating preauth node for SAE peer " MAC_ADDRESS_STR, |
| 132 | MAC_ADDR_ARRAY(mac_hdr->sa)); |
| 133 | vos_mem_copy((uint8_t *)auth_node->peerMacAddr, |
| 134 | mac_hdr->sa, sizeof(tSirMacAddr)); |
| 135 | auth_node->mlmState = mlm_state; |
| 136 | auth_node->authType = eSIR_AUTH_TYPE_SAE; |
| 137 | auth_node->timestamp = vos_timer_get_system_ticks(); |
| 138 | auth_node->seqNo = ((mac_hdr->seqControl.seqNumHi << 4) | |
| 139 | (mac_hdr->seqControl.seqNumLo)); |
| 140 | auth_node->assoc_req.present = false; |
| 141 | limAddPreAuthNode(mac_ctx, auth_node); |
| 142 | } |
| 143 | |
| 144 | |
| 145 | /** |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 146 | * lim_process_sae_auth_frame()-Process SAE authentication frame |
| 147 | * @mac_ctx: MAC context |
| 148 | * @rx_pkt_info: Rx packet |
| 149 | * @pe_session: PE session |
| 150 | * |
| 151 | * Return: None |
| 152 | */ |
| 153 | static void lim_process_sae_auth_frame(tpAniSirGlobal mac_ctx, |
| 154 | uint8_t *rx_pkt_info, |
| 155 | tpPESession pe_session) |
| 156 | { |
| 157 | tpSirMacMgmtHdr mac_hdr; |
Pankaj Singh | 33205b8 | 2020-06-05 00:27:49 +0530 | [diff] [blame] | 158 | enum rxmgmt_flags rx_flags = RXMGMT_FLAG_NONE; |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 159 | |
| 160 | mac_hdr = WDA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 161 | |
| 162 | limLog(mac_ctx, LOG1, FL("Received SAE Auth frame type %d subtype %d"), |
| 163 | mac_hdr->fc.type, mac_hdr->fc.subType); |
| 164 | |
Pankaj Singh | 33205b8 | 2020-06-05 00:27:49 +0530 | [diff] [blame] | 165 | if (LIM_IS_STA_ROLE(pe_session) && |
| 166 | pe_session->limMlmState != eLIM_MLM_WT_SAE_AUTH_STATE) |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 167 | limLog(mac_ctx, LOGE, |
| 168 | FL("received SAE auth response in unexpected state %x"), |
| 169 | pe_session->limMlmState); |
| 170 | |
Pankaj Singh | f9c4ca7 | 2020-06-05 01:09:07 +0530 | [diff] [blame] | 171 | if(LIM_IS_AP_ROLE(pe_session)) { |
| 172 | struct tLimPreAuthNode *sta_pre_auth_ctx; |
| 173 | |
| 174 | rx_flags = RXMGMT_FLAG_EXTERNAL_AUTH; |
| 175 | /* Add preauth node when the first SAE authentication frame |
| 176 | * is received and mark state as authenticating. |
| 177 | * It's not good to track SAE authentication frames with |
| 178 | * authTransactionSeqNumber as it's subjected to |
| 179 | * SAE protocol optimizations. |
| 180 | */ |
| 181 | /* Extract pre-auth context for the STA, if any. */ |
| 182 | sta_pre_auth_ctx = limSearchPreAuthList(mac_ctx, |
| 183 | mac_hdr->sa); |
| 184 | if (!sta_pre_auth_ctx || |
| 185 | (sta_pre_auth_ctx->mlmState != eLIM_MLM_WT_SAE_AUTH_STATE && |
| 186 | sta_pre_auth_ctx->mlmState != |
| 187 | eLIM_MLM_AUTHENTICATED_STATE)) { |
| 188 | lim_external_auth_add_pre_auth_node(mac_ctx, mac_hdr, |
| 189 | eLIM_MLM_WT_SAE_AUTH_STATE); |
| 190 | } |
| 191 | } |
Pankaj Singh | 33205b8 | 2020-06-05 00:27:49 +0530 | [diff] [blame] | 192 | |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 193 | limSendSmeMgmtFrameInd(mac_ctx, pe_session->peSessionId, |
| 194 | rx_pkt_info, pe_session, |
Pankaj Singh | 33205b8 | 2020-06-05 00:27:49 +0530 | [diff] [blame] | 195 | WDA_GET_RX_RSSI_DB(rx_pkt_info), rx_flags); |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 196 | } |
| 197 | #else |
| 198 | static void lim_process_sae_auth_frame(tpAniSirGlobal mac_ctx, |
| 199 | uint8_t *rx_pkt_info, |
| 200 | tpPESession pe_session) |
| 201 | {} |
| 202 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 203 | |
| 204 | /** |
| 205 | * limProcessAuthFrame |
| 206 | * |
| 207 | *FUNCTION: |
| 208 | * This function is called by limProcessMessageQueue() upon Authentication |
| 209 | * frame reception. |
| 210 | * |
| 211 | *LOGIC: |
| 212 | * This function processes received Authentication frame and responds |
| 213 | * with either next Authentication frame in sequence to peer MAC entity |
| 214 | * or LIM_MLM_AUTH_IND on AP or LIM_MLM_AUTH_CNF on STA. |
| 215 | * |
| 216 | *ASSUMPTIONS: |
| 217 | * |
| 218 | *NOTE: |
| 219 | * 1. Authentication failures are reported to SME with same status code |
| 220 | * received from the peer MAC entity. |
| 221 | * 2. Authentication frame2/4 received with alogirthm number other than |
| 222 | * one requested in frame1/3 are logged with an error and auth confirm |
| 223 | * will be sent to SME only after auth failure timeout. |
| 224 | * 3. Inconsistency in the spec: |
| 225 | * On receiving Auth frame2, specs says that if WEP key mapping key |
| 226 | * or default key is NULL, Auth frame3 with a status code 15 (challenge |
| 227 | * failure to be returned to peer entity. However, section 7.2.3.10, |
| 228 | * table 14 says that status code field is 'reserved' for frame3 ! |
| 229 | * In the current implementation, Auth frame3 is returned with status |
| 230 | * code 15 overriding section 7.2.3.10. |
| 231 | * 4. If number pre-authentications reach configrable max limit, |
| 232 | * Authentication frame with 'unspecified failure' status code is |
| 233 | * returned to requesting entity. |
| 234 | * |
| 235 | * @param pMac - Pointer to Global MAC structure |
| 236 | * @param *pRxPacketInfo - A pointer to Rx packet info structure |
| 237 | * @return None |
| 238 | */ |
| 239 | |
| 240 | void |
| 241 | limProcessAuthFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry) |
| 242 | { |
| 243 | tANI_U8 *pBody, keyId, cfgPrivacyOptImp, |
| 244 | defaultKey[SIR_MAC_KEY_LENGTH], |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 245 | *encrAuthFrame = NULL, |
| 246 | *plainBody = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 247 | tANI_U16 frameLen; |
| 248 | //tANI_U32 authRspTimeout, maxNumPreAuth, val; |
| 249 | tANI_U32 maxNumPreAuth, val; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 250 | tSirMacAuthFrameBody *pRxAuthFrameBody, |
| 251 | *rxAuthFrame = NULL, |
| 252 | *authFrame = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 253 | tpSirMacMgmtHdr pHdr; |
| 254 | tCfgWepKeyEntry *pKeyMapEntry = NULL; |
| 255 | struct tLimPreAuthNode *pAuthNode; |
| 256 | tLimMlmAuthInd mlmAuthInd; |
| 257 | tANI_U8 decryptResult; |
| 258 | tANI_U8 *pChallenge; |
| 259 | tANI_U32 key_length=8; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 260 | tANI_U8 *challengeTextArray = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | tpDphHashNode pStaDs = NULL; |
| 262 | tANI_U16 assocId = 0; |
Sushant Kaushik | f9c963c | 2015-01-28 12:50:26 +0530 | [diff] [blame] | 263 | tANI_U16 currSeqNo = 0; |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 264 | tANI_U16 auth_alg = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | /* Added For BT -AMP support */ |
| 266 | // Get pointer to Authentication frame header and body |
| 267 | |
| 268 | |
| 269 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 270 | frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 271 | |
| 272 | if (!frameLen) |
| 273 | { |
| 274 | // Log error |
| 275 | limLog(pMac, LOGE, |
| 276 | FL("received Authentication frame with no body from ")); |
| 277 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 278 | |
| 279 | return; |
| 280 | } |
| 281 | |
| 282 | if (limIsGroupAddr(pHdr->sa)) |
| 283 | { |
| 284 | // Received Auth frame from a BC/MC address |
| 285 | // Log error and ignore it |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 286 | limLog(pMac, LOGE, |
| 287 | FL("received Auth frame from a BC/MC address - ")); |
| 288 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 289 | |
| 290 | return; |
| 291 | } |
Sushant Kaushik | f9c963c | 2015-01-28 12:50:26 +0530 | [diff] [blame] | 292 | currSeqNo = (pHdr->seqControl.seqNumHi << 4) | (pHdr->seqControl.seqNumLo); |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 293 | limLog(pMac, LOG1, |
| 294 | FL("Sessionid: %d System role : %d limMlmState: %d :Auth " |
| 295 | "Frame Received: BSSID: "MAC_ADDRESS_STR " (RSSI %d)"), |
| 296 | psessionEntry->peSessionId, psessionEntry->limSystemRole, |
| 297 | psessionEntry->limMlmState, MAC_ADDR_ARRAY(pHdr->bssId), |
| 298 | (uint)abs((tANI_S8)WDA_GET_RX_RSSI_DB(pRxPacketInfo))); |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 300 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 301 | |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 302 | auth_alg = *(uint16_t *)pBody; |
| 303 | limLog(pMac, LOG1, FL("auth_alg %d "), auth_alg); |
| 304 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 305 | //PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8*)pBd, ((tpHalBufDesc) pBd)->mpduDataOffset + frameLen);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 306 | |
Madan Mohan Koyyalamudi | 666d33a | 2012-11-29 11:32:59 -0800 | [diff] [blame] | 307 | //Restore default failure timeout |
| 308 | if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona && psessionEntry->defaultAuthFailureTimeout) |
| 309 | { |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 310 | limLog(pMac, LOG1, FL("Restore default failure timeout")); |
Madan Mohan Koyyalamudi | 666d33a | 2012-11-29 11:32:59 -0800 | [diff] [blame] | 311 | ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT , |
| 312 | psessionEntry->defaultAuthFailureTimeout, NULL, eANI_BOOLEAN_FALSE); |
| 313 | } |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 314 | |
| 315 | rxAuthFrame = vos_mem_malloc(sizeof(tSirMacAuthFrameBody)); |
| 316 | if (!rxAuthFrame) { |
| 317 | limLog(pMac, LOGE, FL("Failed to allocate memory")); |
| 318 | return; |
| 319 | } |
| 320 | |
| 321 | authFrame = vos_mem_malloc(sizeof(tSirMacAuthFrameBody)); |
| 322 | if (!authFrame) { |
| 323 | limLog(pMac, LOGE, FL("failed to allocate memory")); |
| 324 | goto free; |
| 325 | } |
| 326 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 327 | plainBody = vos_mem_malloc(LIM_ENCR_AUTH_BODY_LEN); |
| 328 | if (!plainBody) { |
| 329 | limLog(pMac, LOGE, FL("failed to allocate memory")); |
| 330 | goto free; |
| 331 | } |
| 332 | |
yeshwanth sriram guntuka | 9771105 | 2017-09-08 12:16:08 +0530 | [diff] [blame] | 333 | challengeTextArray = vos_mem_malloc(SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 334 | if(!challengeTextArray) { |
| 335 | limLog(pMac, LOGE, FL("failed to allocate memory")); |
| 336 | goto free; |
| 337 | } |
| 338 | |
| 339 | vos_mem_set(rxAuthFrame, sizeof(tSirMacAuthFrameBody), 0); |
| 340 | vos_mem_set(authFrame, sizeof(tSirMacAuthFrameBody), 0); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 341 | vos_mem_set(plainBody, LIM_ENCR_AUTH_BODY_LEN, 0); |
yeshwanth sriram guntuka | 9771105 | 2017-09-08 12:16:08 +0530 | [diff] [blame] | 342 | vos_mem_set(challengeTextArray, SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 343 | |
| 344 | /// Determine if WEP bit is set in the FC or received MAC header |
| 345 | if (pHdr->fc.wep) |
| 346 | { |
| 347 | /** |
| 348 | * WEP bit is set in FC of MAC header. |
| 349 | */ |
| 350 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | // If TKIP counter measures enabled issue Deauth frame to station |
| 352 | if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)) |
| 353 | { |
| 354 | PELOGE( limLog(pMac, LOGE, |
| 355 | FL("Tkip counter measures Enabled, sending Deauth frame to")); ) |
| 356 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 357 | |
| 358 | limSendDeauthMgmtFrame( pMac, eSIR_MAC_MIC_FAILURE_REASON, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 359 | pHdr->sa, psessionEntry, FALSE ); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 360 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 361 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 362 | |
| 363 | // Extract key ID from IV (most 2 bits of 4th byte of IV) |
| 364 | |
| 365 | keyId = (*(pBody + 3)) >> 6; |
| 366 | |
| 367 | /** |
| 368 | * On STA in infrastructure BSS, Authentication frames received |
| 369 | * with WEP bit set in the FC must be rejected with challenge |
| 370 | * failure status code (wierd thing in the spec - this should have |
| 371 | * been rejected with unspecified failure or unexpected assertion |
| 372 | * of wep bit (this status code does not exist though) or |
| 373 | * Out-of-sequence-Authentication-Frame status code. |
| 374 | */ |
| 375 | |
| 376 | if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) |
| 377 | { |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 378 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 379 | authFrame->authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_4; |
| 380 | authFrame->authStatusCode = eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 381 | // Log error |
| 382 | PELOGE(limLog(pMac, LOGE, |
| 383 | FL("received Authentication frame with wep bit set on " |
| 384 | "role=%d "MAC_ADDRESS_STR), |
| 385 | psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa) );) |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 386 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 387 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 388 | LIM_NO_WEP_IN_FC, |
| 389 | psessionEntry, eSIR_FALSE); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 390 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | } |
| 392 | |
Vignesh Viswanathan | 5ab5cde | 2017-11-21 16:21:34 +0530 | [diff] [blame] | 393 | if ((frameLen < LIM_ENCR_AUTH_BODY_LEN_SAP) || |
| 394 | (frameLen > LIM_ENCR_AUTH_BODY_LEN)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | { |
| 396 | // Log error |
| 397 | limLog(pMac, LOGE, |
| 398 | FL("Not enough size [%d] to decrypt received Auth frame"), |
| 399 | frameLen); |
| 400 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 401 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 402 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 404 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 405 | { |
| 406 | val = psessionEntry->privacy; |
| 407 | } |
| 408 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 409 | // Accept Authentication frame only if Privacy is implemented |
| 410 | if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, |
| 411 | &val) != eSIR_SUCCESS) |
| 412 | { |
| 413 | /** |
| 414 | * Could not get Privacy option |
| 415 | * from CFG. Log error. |
| 416 | */ |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 417 | limLog(pMac, LOGP, FL("could not retrieve Privacy option")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 418 | } |
| 419 | |
| 420 | cfgPrivacyOptImp = (tANI_U8)val; |
| 421 | if (cfgPrivacyOptImp) |
| 422 | { |
| 423 | /** |
| 424 | * Privacy option is implemented. |
| 425 | * Check if the received frame is Authentication |
| 426 | * frame3 and there is a context for requesting STA. |
| 427 | * If not, reject with unspecified failure status code |
| 428 | */ |
| 429 | pAuthNode = limSearchPreAuthList(pMac, pHdr->sa); |
| 430 | |
| 431 | if (pAuthNode == NULL) |
| 432 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 433 | // Log error |
| 434 | PELOGE(limLog(pMac, LOGE, |
| 435 | FL("received Authentication frame from peer that has " |
| 436 | "no preauth context with WEP bit set "MAC_ADDRESS_STR), |
| 437 | MAC_ADDR_ARRAY(pHdr->sa));) |
| 438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 439 | /** |
| 440 | * No 'pre-auth' context exists for this STA that sent |
| 441 | * an Authentication frame with FC bit set. |
| 442 | * Send Auth frame4 with 'out of sequence' status code. |
| 443 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 444 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 445 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 446 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 447 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 448 | eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS; |
| 449 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 450 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 451 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 452 | LIM_NO_WEP_IN_FC, |
| 453 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 454 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 455 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 456 | } |
| 457 | else |
| 458 | { |
| 459 | /// Change the auth-response timeout |
| 460 | limDeactivateAndChangePerStaIdTimer(pMac, |
| 461 | eLIM_AUTH_RSP_TIMER, |
| 462 | pAuthNode->authNodeIdx); |
| 463 | |
| 464 | /// 'Pre-auth' status exists for STA |
| 465 | if ((pAuthNode->mlmState != |
| 466 | eLIM_MLM_WT_AUTH_FRAME3_STATE) && |
| 467 | (pAuthNode->mlmState != |
| 468 | eLIM_MLM_AUTH_RSP_TIMEOUT_STATE)) |
| 469 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 470 | // Log error |
| 471 | PELOGE(limLog(pMac, LOGE, |
| 472 | FL("received Authentication frame from peer that is " |
| 473 | "in state %d "MAC_ADDRESS_STR), |
| 474 | pAuthNode->mlmState, MAC_ADDR_ARRAY(pHdr->sa));) |
| 475 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 476 | /** |
| 477 | * Should not have received Authentication frame |
| 478 | * with WEP bit set in FC in other states. |
| 479 | * Reject by sending Authenticaton frame with |
| 480 | * out of sequence Auth frame status code. |
| 481 | */ |
| 482 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 483 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 484 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 485 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 486 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 487 | eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS; |
| 488 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 489 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 490 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 491 | LIM_NO_WEP_IN_FC, |
| 492 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 494 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 495 | } |
| 496 | } |
| 497 | |
| 498 | /** |
| 499 | * Check if there exists a key mappping key |
| 500 | * for the STA that sent Authentication frame |
| 501 | */ |
| 502 | pKeyMapEntry = limLookUpKeyMappings(pHdr->sa); |
| 503 | |
| 504 | if (pKeyMapEntry) |
| 505 | { |
| 506 | if (!pKeyMapEntry->wepOn) |
| 507 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 508 | // Log error |
| 509 | PELOGE(limLog(pMac, LOGE, |
| 510 | FL("received Auth frame3 from peer that has NULL " |
| 511 | "key map entry " |
| 512 | MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));) |
| 513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 514 | /** |
| 515 | * Key Mapping entry has null key. |
| 516 | * Send Authentication frame |
| 517 | * with challenge failure status code |
| 518 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 519 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 520 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 521 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 522 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 523 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
| 524 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 525 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 526 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 527 | LIM_NO_WEP_IN_FC, |
| 528 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 529 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 530 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 531 | } // if (!pKeyMapEntry->wepOn) |
| 532 | else |
| 533 | { |
| 534 | decryptResult = limDecryptAuthFrame(pMac, pKeyMapEntry->key, |
| 535 | pBody, |
| 536 | plainBody, |
| 537 | key_length, |
| 538 | (tANI_U16) (frameLen-SIR_MAC_WEP_IV_LENGTH)); |
| 539 | if (decryptResult == LIM_DECRYPT_ICV_FAIL) |
| 540 | { |
| 541 | /// ICV failure |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 542 | PELOGW(limLog(pMac, LOGW, FL("=====> decryptResult == " |
| 543 | "LIM_DECRYPT_ICV_FAIL ..."));) |
| 544 | // Log error |
| 545 | PELOGE(limLog(pMac, LOGE, |
| 546 | FL("received Authentication frame from peer " |
| 547 | "that failed decryption, Addr " |
| 548 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));) |
| 549 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 550 | limDeletePreAuthNode(pMac, |
| 551 | pHdr->sa); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 552 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 553 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 554 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 555 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 556 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
| 557 | |
| 558 | limSendAuthMgmtFrame( |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 559 | pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 560 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 561 | LIM_NO_WEP_IN_FC, |
| 562 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 563 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 564 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 565 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | } |
| 567 | |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 568 | if ( ( sirConvertAuthFrame2Struct(pMac, plainBody, frameLen-8, |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 569 | rxAuthFrame)!=eSIR_SUCCESS ) || |
| 570 | ( !isAuthValid(pMac, rxAuthFrame,psessionEntry) ) ) |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 571 | { |
| 572 | PELOGE(limLog(pMac, LOGE, |
| 573 | FL("failed to convert Auth Frame to structure " |
| 574 | "or Auth is not valid "));) |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 575 | goto free; |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 576 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 577 | |
| 578 | |
| 579 | } // end if (pKeyMapEntry->key == NULL) |
| 580 | } // if keyMappings has entry |
| 581 | else |
| 582 | { |
| 583 | |
| 584 | val = SIR_MAC_KEY_LENGTH; |
| 585 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 586 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 587 | { |
| 588 | tpSirKeys pKey; |
| 589 | pKey = &psessionEntry->WEPKeyMaterial[keyId].key[0]; |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 590 | vos_mem_copy(defaultKey, pKey->key, pKey->keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 591 | val = pKey->keyLength; |
| 592 | } |
| 593 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 594 | if (wlan_cfgGetStr(pMac, (tANI_U16) (WNI_CFG_WEP_DEFAULT_KEY_1 + keyId), |
| 595 | defaultKey, &val) != eSIR_SUCCESS) |
| 596 | { |
| 597 | /// Could not get Default key from CFG. |
| 598 | //Log error. |
| 599 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 600 | FL("could not retrieve Default key")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 601 | |
| 602 | /** |
| 603 | * Send Authentication frame |
| 604 | * with challenge failure status code |
| 605 | */ |
| 606 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 607 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 608 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 609 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 610 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
| 612 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 613 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 614 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 615 | LIM_NO_WEP_IN_FC, |
| 616 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 617 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 618 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 619 | } |
| 620 | |
| 621 | key_length=val; |
| 622 | |
| 623 | decryptResult = limDecryptAuthFrame(pMac, defaultKey, |
| 624 | pBody, |
| 625 | plainBody, |
| 626 | key_length, |
| 627 | (tANI_U16) (frameLen-SIR_MAC_WEP_IV_LENGTH)); |
| 628 | if (decryptResult == LIM_DECRYPT_ICV_FAIL) |
| 629 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 630 | PELOGW(limLog(pMac, LOGW, FL("=====> decryptResult == " |
| 631 | "LIM_DECRYPT_ICV_FAIL ..."));) |
| 632 | // Log error |
| 633 | PELOGE(limLog(pMac, LOGE, |
| 634 | FL("received Authentication frame from peer that " |
| 635 | "failed decryption: " |
| 636 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 637 | /// ICV failure |
| 638 | limDeletePreAuthNode(pMac, |
| 639 | pHdr->sa); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 640 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 641 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 642 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 643 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 644 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
| 645 | |
| 646 | limSendAuthMgmtFrame( |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 647 | pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 648 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 649 | LIM_NO_WEP_IN_FC, |
| 650 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 651 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 652 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 653 | } |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 654 | if ( ( sirConvertAuthFrame2Struct(pMac, plainBody, frameLen-8, |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 655 | rxAuthFrame)!=eSIR_SUCCESS ) || |
| 656 | ( !isAuthValid(pMac, rxAuthFrame, psessionEntry) ) ) |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 657 | { |
| 658 | limLog(pMac, LOGE, |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 659 | FL("failed to convert Auth Frame to structure " |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 660 | "or Auth is not valid ")); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 661 | goto free; |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 662 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 663 | } // End of check for Key Mapping/Default key presence |
| 664 | } |
| 665 | else |
| 666 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 667 | // Log error |
| 668 | PELOGE(limLog(pMac, LOGE, |
| 669 | FL("received Authentication frame3 from peer that while " |
| 670 | "privacy option is turned OFF " |
| 671 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 672 | /** |
| 673 | * Privacy option is not implemented. |
| 674 | * So reject Authentication frame received with |
| 675 | * WEP bit set by sending Authentication frame |
| 676 | * with 'challenge failure' status code. This is |
| 677 | * another strange thing in the spec. Status code |
| 678 | * should have been 'unsupported algorithm' status code. |
| 679 | */ |
| 680 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 681 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 682 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 683 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 684 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 685 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
| 686 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 687 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 688 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 689 | LIM_NO_WEP_IN_FC, |
| 690 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 692 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 693 | } // else if (wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED)) |
Pankaj Singh | be225ca | 2020-06-04 10:45:24 +0530 | [diff] [blame] | 694 | } else if (auth_alg == eSIR_AUTH_TYPE_SAE) { |
| 695 | if (LIM_IS_STA_ROLE(psessionEntry) || |
| 696 | LIM_IS_AP_ROLE(psessionEntry)) |
| 697 | lim_process_sae_auth_frame(pMac, pRxPacketInfo, psessionEntry); |
Abhinav Kumar | d5eacfa | 2019-08-05 14:56:21 +0530 | [diff] [blame] | 698 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 699 | } // if (fc.wep) |
| 700 | else |
| 701 | { |
| 702 | |
| 703 | |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 704 | if ( ( sirConvertAuthFrame2Struct(pMac, pBody, |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 705 | frameLen, rxAuthFrame)!=eSIR_SUCCESS ) || |
| 706 | ( !isAuthValid(pMac, rxAuthFrame,psessionEntry) ) ) |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 707 | { |
| 708 | PELOGE(limLog(pMac, LOGE, |
| 709 | FL("failed to convert Auth Frame to structure or Auth is " |
| 710 | "not valid "));) |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 711 | goto free; |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 712 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 713 | } |
| 714 | |
| 715 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 716 | pRxAuthFrameBody = rxAuthFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 717 | |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 718 | PELOGW(limLog(pMac, LOGW, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 719 | FL("Received Auth frame with type=%d seqnum=%d, status=%d (%d)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 720 | (tANI_U32) pRxAuthFrameBody->authAlgoNumber, |
| 721 | (tANI_U32) pRxAuthFrameBody->authTransactionSeqNumber, |
| 722 | (tANI_U32) pRxAuthFrameBody->authStatusCode,(tANI_U32)pMac->lim.gLimNumPreAuthContexts);) |
| 723 | |
Wang Hu | 4506bae | 2015-12-07 14:15:19 +0800 | [diff] [blame] | 724 | // IOT Workaround: with invalid WEP password, some APs reply AUTH frame 4 |
| 725 | // with invalid seqNumber. This AUTH frame will be dropped by driver, |
| 726 | // thus driver sends the generic status code instead of protocol status code. |
| 727 | // As a workaround, assign the correct seqNumber for the AUTH frame 4. |
| 728 | if (psessionEntry->limMlmState == eLIM_MLM_WT_AUTH_FRAME4_STATE && |
| 729 | pRxAuthFrameBody->authTransactionSeqNumber != SIR_MAC_AUTH_FRAME_1 && |
| 730 | pRxAuthFrameBody->authTransactionSeqNumber != SIR_MAC_AUTH_FRAME_2 && |
| 731 | pRxAuthFrameBody->authTransactionSeqNumber != SIR_MAC_AUTH_FRAME_3) { |
| 732 | PELOGE(limLog(pMac, LOGE, FL("Workaround: Assign a correct seqNumber=4 " |
| 733 | "for AUTH frame 4"));) |
| 734 | pRxAuthFrameBody->authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_4; |
| 735 | } |
| 736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 737 | switch (pRxAuthFrameBody->authTransactionSeqNumber) |
| 738 | { |
| 739 | case SIR_MAC_AUTH_FRAME_1: |
| 740 | // AuthFrame 1 |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 741 | |
| 742 | pStaDs = dphLookupHashEntry(pMac, pHdr->sa, |
| 743 | &assocId, &psessionEntry->dph.dphHashTable); |
| 744 | if (pStaDs) |
| 745 | { |
Abhishek Singh | b1c829a | 2014-05-05 11:06:54 +0530 | [diff] [blame] | 746 | tLimMlmDisassocReq *pMlmDisassocReq = NULL; |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 747 | tLimMlmDeauthReq *pMlmDeauthReq = NULL; |
Abhishek Singh | b1c829a | 2014-05-05 11:06:54 +0530 | [diff] [blame] | 748 | tAniBool isConnected = eSIR_TRUE; |
| 749 | |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 750 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 751 | if (pMlmDisassocReq && |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 752 | (vos_mem_compare((tANI_U8 *) pHdr->sa, |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 753 | (tANI_U8 *) &pMlmDisassocReq->peerMacAddr, |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 754 | sizeof(tSirMacAddr)))) |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 755 | { |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 756 | PELOGE(limLog(pMac, LOGE, FL("TODO:Ack for disassoc " |
| 757 | "frame is pending Issue delsta for " |
| 758 | MAC_ADDRESS_STR), |
| 759 | MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr));) |
Sudhir Sattayappa Kohalli | 446de94 | 2013-07-24 18:20:02 -0700 | [diff] [blame] | 760 | limProcessDisassocAckTimeout(pMac); |
Abhishek Singh | b1c829a | 2014-05-05 11:06:54 +0530 | [diff] [blame] | 761 | isConnected = eSIR_FALSE; |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 762 | } |
| 763 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 764 | if (pMlmDeauthReq && |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 765 | (vos_mem_compare((tANI_U8 *) pHdr->sa, |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 766 | (tANI_U8 *) &pMlmDeauthReq->peerMacAddr, |
| 767 | sizeof(tSirMacAddr)))) |
| 768 | { |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 769 | PELOGE(limLog(pMac, LOGE, FL("TODO:Ack for deauth frame " |
Sudhir Sattayappa Kohalli | 446de94 | 2013-07-24 18:20:02 -0700 | [diff] [blame] | 770 | "is pending Issue delsta for " |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 771 | MAC_ADDRESS_STR), |
| 772 | MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr));) |
Sudhir Sattayappa Kohalli | 446de94 | 2013-07-24 18:20:02 -0700 | [diff] [blame] | 773 | limProcessDeauthAckTimeout(pMac); |
Abhishek Singh | b1c829a | 2014-05-05 11:06:54 +0530 | [diff] [blame] | 774 | isConnected = eSIR_FALSE; |
| 775 | } |
| 776 | |
| 777 | /* pStaDS != NULL and isConnected = 1 means the STA is already |
| 778 | * connected, But SAP received the Auth from that station. |
Abhishek Singh | 0496a52 | 2015-12-14 23:39:23 -0800 | [diff] [blame] | 779 | * For non PMF connection send Deauth frame as STA will retry |
| 780 | * to connect back. |
Abhishek Singh | 13fbb1d | 2014-06-04 19:51:05 +0530 | [diff] [blame] | 781 | * |
| 782 | * For PMF connection the AP should not tear down or otherwise |
| 783 | * modify the state of the existing association until the |
| 784 | * SA-Query procedure determines that the original SA is |
| 785 | * invalid. |
Abhishek Singh | b1c829a | 2014-05-05 11:06:54 +0530 | [diff] [blame] | 786 | */ |
gaurank kathpalia | 6641489 | 2018-03-21 20:24:39 +0530 | [diff] [blame] | 787 | if (isConnected && pStaDs->PrevAuthSeqno != currSeqNo |
Abhishek Singh | 13fbb1d | 2014-06-04 19:51:05 +0530 | [diff] [blame] | 788 | #ifdef WLAN_FEATURE_11W |
| 789 | && !pStaDs->rmfEnabled |
| 790 | #endif |
gaurank kathpalia | 6641489 | 2018-03-21 20:24:39 +0530 | [diff] [blame] | 791 | ) |
Abhishek Singh | b1c829a | 2014-05-05 11:06:54 +0530 | [diff] [blame] | 792 | { |
Abhishek Singh | 0496a52 | 2015-12-14 23:39:23 -0800 | [diff] [blame] | 793 | limLog(pMac, LOGE, |
Yeshwanth Sriram Guntuka | b74fadf | 2019-08-21 21:09:57 +0530 | [diff] [blame] | 794 | FL("Auth frame received in mlm state: %d(staId: %d, assocId: %d)"), |
| 795 | pStaDs->mlmStaContext.mlmState, |
Abhishek Singh | 0496a52 | 2015-12-14 23:39:23 -0800 | [diff] [blame] | 796 | pStaDs->staIndex, assocId); |
Yeshwanth Sriram Guntuka | b74fadf | 2019-08-21 21:09:57 +0530 | [diff] [blame] | 797 | if (pStaDs->mlmStaContext.mlmState == |
| 798 | eLIM_MLM_LINK_ESTABLISHED_STATE) { |
| 799 | limLog(pMac, LOGE, |
| 800 | FL("STA is already connected but received auth frame" |
| 801 | "Send the Deauth and lim Delete Station Context" |
| 802 | "(staId: %d, assocId: %d) "), |
| 803 | pStaDs->staIndex, assocId); |
| 804 | limSendDeauthMgmtFrame(pMac, |
| 805 | eSIR_MAC_UNSPEC_FAILURE_REASON, |
| 806 | (tANI_U8 *) pHdr->sa, |
| 807 | psessionEntry, FALSE); |
| 808 | limTriggerSTAdeletion(pMac, pStaDs, psessionEntry); |
| 809 | } |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 810 | goto free; |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 811 | } |
| 812 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | |
| 814 | /// Check if there exists pre-auth context for this STA |
| 815 | pAuthNode = limSearchPreAuthList(pMac, pHdr->sa); |
| 816 | if (pAuthNode) |
| 817 | { |
| 818 | /// Pre-auth context exists for the STA |
gaurank kathpalia | 6641489 | 2018-03-21 20:24:39 +0530 | [diff] [blame] | 819 | if (pAuthNode->seqNo != currSeqNo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 820 | { |
| 821 | /** |
| 822 | * STA is initiating brand-new Authentication |
| 823 | * sequence after local Auth Response timeout. |
| 824 | * Or STA retrying to transmit First Auth frame due to packet drop OTA |
| 825 | * Delete Pre-auth node and fall through. |
| 826 | */ |
| 827 | if(pAuthNode->fTimerStarted) |
| 828 | { |
| 829 | limDeactivateAndChangePerStaIdTimer(pMac, |
| 830 | eLIM_AUTH_RSP_TIMER, |
| 831 | pAuthNode->authNodeIdx); |
| 832 | } |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 833 | PELOGE(limLog(pMac, LOGE, FL("STA is initiating brand-new " |
| 834 | "Authentication ..."));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 835 | limDeletePreAuthNode(pMac, |
| 836 | pHdr->sa); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 837 | /** |
| 838 | * SAP Mode:Disassociate the station and |
| 839 | * delete its entry if we have its entry |
| 840 | * already and received "auth" from the |
| 841 | * same station. |
| 842 | */ |
| 843 | |
| 844 | for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8 |
| 845 | { |
| 846 | pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable); |
| 847 | |
| 848 | if (NULL == pStaDs) |
| 849 | continue; |
| 850 | |
| 851 | if (pStaDs->valid) |
| 852 | { |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 853 | if (vos_mem_compare((tANI_U8 *) &pStaDs->staAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 854 | (tANI_U8 *) &(pHdr->sa), (tANI_U8) (sizeof(tSirMacAddr))) ) |
| 855 | break; |
| 856 | } |
Edhar, Mahesh Kumar | 29013e8 | 2014-02-05 10:38:08 +0530 | [diff] [blame] | 857 | |
| 858 | pStaDs = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 859 | } |
| 860 | |
Abhishek Singh | e941749 | 2014-09-25 15:55:36 +0530 | [diff] [blame] | 861 | if (NULL != pStaDs |
| 862 | #ifdef WLAN_FEATURE_11W |
| 863 | && !pStaDs->rmfEnabled |
| 864 | #endif |
| 865 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | { |
Abhishek Singh | 0496a52 | 2015-12-14 23:39:23 -0800 | [diff] [blame] | 867 | PELOGE(limLog(pMac, LOGE, FL("lim Delete Station " |
| 868 | "Context (staId: %d, assocId: %d) "),pStaDs->staIndex, |
| 869 | assocId);) |
| 870 | limSendDeauthMgmtFrame(pMac, |
| 871 | eSIR_MAC_UNSPEC_FAILURE_REASON, (tANI_U8 *) pAuthNode->peerMacAddr, psessionEntry, FALSE); |
| 872 | limTriggerSTAdeletion(pMac, pStaDs, psessionEntry); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 873 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 874 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 875 | } |
| 876 | else |
| 877 | { |
| 878 | /* |
| 879 | * This can happen when first authentication frame is received |
| 880 | * but ACK lost at STA side, in this case 2nd auth frame is already |
| 881 | * in transmission queue |
| 882 | * */ |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 883 | PELOGE(limLog(pMac, LOGE, FL("STA is initiating " |
| 884 | "Authentication after ACK lost..."));) |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 885 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 886 | } |
| 887 | } |
| 888 | if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH, |
| 889 | (tANI_U32 *) &maxNumPreAuth) != eSIR_SUCCESS) |
| 890 | { |
| 891 | /** |
| 892 | * Could not get MaxNumPreAuth |
| 893 | * from CFG. Log error. |
| 894 | */ |
| 895 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 896 | FL("could not retrieve MaxNumPreAuth")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | } |
Edhar, Mahesh Kumar | 0d82c21 | 2015-02-03 17:47:16 +0530 | [diff] [blame] | 898 | |
| 899 | if (pMac->lim.gLimNumPreAuthContexts == maxNumPreAuth && |
| 900 | !limDeleteOpenAuthPreAuthNode(pMac)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 901 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 902 | PELOGE(limLog(pMac, LOGE, FL("Max number of " |
| 903 | "preauth context reached"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 904 | /** |
| 905 | * Maximum number of pre-auth contexts |
| 906 | * reached. Send Authentication frame |
| 907 | * with unspecified failure |
| 908 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 909 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 910 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 911 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 912 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 913 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 914 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 915 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 916 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 917 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 918 | LIM_NO_WEP_IN_FC, |
| 919 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 920 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 921 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 922 | } |
| 923 | /// No Pre-auth context exists for the STA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 924 | if (limIsAuthAlgoSupported( |
| 925 | pMac, |
| 926 | (tAniAuthType) |
| 927 | pRxAuthFrameBody->authAlgoNumber, psessionEntry)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 928 | { |
| 929 | switch (pRxAuthFrameBody->authAlgoNumber) |
| 930 | { |
| 931 | case eSIR_OPEN_SYSTEM: |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 932 | PELOGW(limLog(pMac, LOGW, FL("=======> eSIR_OPEN_SYSTEM ..."));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | /// Create entry for this STA in pre-auth list |
| 934 | pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable); |
| 935 | if (pAuthNode == NULL) |
| 936 | { |
| 937 | // Log error |
| 938 | limLog(pMac, LOGW, |
| 939 | FL("Max pre-auth nodes reached ")); |
| 940 | limPrintMacAddr(pMac, pHdr->sa, LOGW); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 941 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 942 | } |
| 943 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 944 | limLog(pMac, LOG1, |
| 945 | FL("Alloc new data: peer "MAC_ADDRESS_STR), |
| 946 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 947 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 948 | vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr, |
| 949 | pHdr->sa, |
| 950 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 951 | |
| 952 | pAuthNode->mlmState = |
| 953 | eLIM_MLM_AUTHENTICATED_STATE; |
| 954 | pAuthNode->authType = (tAniAuthType) |
| 955 | pRxAuthFrameBody->authAlgoNumber; |
| 956 | pAuthNode->fSeen = 0; |
| 957 | pAuthNode->fTimerStarted = 0; |
Sushant Kaushik | f9c963c | 2015-01-28 12:50:26 +0530 | [diff] [blame] | 958 | pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) | |
| 959 | (pHdr->seqControl.seqNumLo)); |
Edhar, Mahesh Kumar | 0d82c21 | 2015-02-03 17:47:16 +0530 | [diff] [blame] | 960 | pAuthNode->timestamp = vos_timer_get_system_ticks(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 961 | limAddPreAuthNode(pMac, pAuthNode); |
| 962 | |
| 963 | /** |
| 964 | * Send Authenticaton frame with Success |
| 965 | * status code. |
| 966 | */ |
| 967 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 968 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 969 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 970 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 971 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 972 | authFrame->authStatusCode = eSIR_MAC_SUCCESS_STATUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 973 | limSendAuthMgmtFrame( |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 974 | pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 976 | LIM_NO_WEP_IN_FC, |
| 977 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 978 | |
| 979 | /// Send Auth indication to SME |
| 980 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 981 | vos_mem_copy((tANI_U8 *) mlmAuthInd.peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | (tANI_U8 *) pHdr->sa, |
| 983 | sizeof(tSirMacAddr)); |
| 984 | mlmAuthInd.authType = (tAniAuthType) |
| 985 | pRxAuthFrameBody->authAlgoNumber; |
| 986 | mlmAuthInd.sessionId = psessionEntry->smeSessionId; |
| 987 | |
| 988 | limPostSmeMessage(pMac, |
| 989 | LIM_MLM_AUTH_IND, |
| 990 | (tANI_U32 *) &mlmAuthInd); |
| 991 | break; |
| 992 | |
| 993 | case eSIR_SHARED_KEY: |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 994 | PELOGW(limLog(pMac, LOGW, FL("=======> eSIR_SHARED_KEY ..."));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 996 | { |
| 997 | val = psessionEntry->privacy; |
| 998 | } |
| 999 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1000 | if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, |
| 1001 | &val) != eSIR_SUCCESS) |
| 1002 | { |
| 1003 | /** |
| 1004 | * Could not get Privacy option |
| 1005 | * from CFG. Log error. |
| 1006 | */ |
| 1007 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1008 | FL("could not retrieve Privacy option")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1009 | } |
| 1010 | cfgPrivacyOptImp = (tANI_U8)val; |
| 1011 | if (!cfgPrivacyOptImp) |
| 1012 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1013 | // Log error |
| 1014 | PELOGE(limLog(pMac, LOGE, |
| 1015 | FL("received Auth frame for unsupported auth algorithm %d " |
| 1016 | MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, |
| 1017 | MAC_ADDR_ARRAY(pHdr->sa));) |
| 1018 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1019 | /** |
| 1020 | * Authenticator does not have WEP |
| 1021 | * implemented. |
| 1022 | * Reject by sending Authentication frame |
| 1023 | * with Auth algorithm not supported status |
| 1024 | * code. |
| 1025 | */ |
| 1026 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1027 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1028 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1029 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1030 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1031 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS; |
| 1033 | |
| 1034 | limSendAuthMgmtFrame( |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1035 | pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1037 | LIM_NO_WEP_IN_FC, |
| 1038 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1039 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1040 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1041 | } |
| 1042 | else |
| 1043 | { |
| 1044 | // Create entry for this STA |
| 1045 | //in pre-auth list |
| 1046 | pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable); |
| 1047 | if (pAuthNode == NULL) |
| 1048 | { |
| 1049 | // Log error |
| 1050 | limLog(pMac, LOGW, |
| 1051 | FL("Max pre-auth nodes reached ")); |
| 1052 | limPrintMacAddr(pMac, pHdr->sa, LOGW); |
| 1053 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1054 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1055 | } |
| 1056 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1057 | vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr, |
| 1058 | pHdr->sa, |
| 1059 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1060 | |
| 1061 | pAuthNode->mlmState = |
| 1062 | eLIM_MLM_WT_AUTH_FRAME3_STATE; |
| 1063 | pAuthNode->authType = |
| 1064 | (tAniAuthType) |
| 1065 | pRxAuthFrameBody->authAlgoNumber; |
| 1066 | pAuthNode->fSeen = 0; |
| 1067 | pAuthNode->fTimerStarted = 0; |
Sushant Kaushik | f9c963c | 2015-01-28 12:50:26 +0530 | [diff] [blame] | 1068 | pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) | |
| 1069 | (pHdr->seqControl.seqNumLo)); |
Edhar, Mahesh Kumar | 0d82c21 | 2015-02-03 17:47:16 +0530 | [diff] [blame] | 1070 | pAuthNode->timestamp = vos_timer_get_system_ticks(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | limAddPreAuthNode(pMac, pAuthNode); |
| 1072 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1073 | limLog(pMac, LOG1, |
| 1074 | FL("Alloc new data: id %d peer "MAC_ADDRESS_STR), |
| 1075 | pAuthNode->authNodeIdx, MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1076 | |
| 1077 | /// Create and activate Auth Response timer |
| 1078 | if (tx_timer_change_context(&pAuthNode->timer, pAuthNode->authNodeIdx) != TX_SUCCESS) |
| 1079 | { |
| 1080 | /// Could not start Auth response timer. |
| 1081 | // Log error |
| 1082 | limLog(pMac, LOGP, |
| 1083 | FL("Unable to chg context auth response timer for peer ")); |
| 1084 | limPrintMacAddr(pMac, pHdr->sa, LOGP); |
| 1085 | |
| 1086 | /** |
| 1087 | * Send Authenticaton frame with |
| 1088 | * unspecified failure status code. |
| 1089 | */ |
| 1090 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1091 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1092 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1093 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1094 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1095 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1096 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 1097 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1098 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1099 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1100 | LIM_NO_WEP_IN_FC, |
| 1101 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1102 | |
| 1103 | limDeletePreAuthNode(pMac, pHdr->sa); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1104 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1105 | } |
| 1106 | |
| 1107 | limActivateAuthRspTimer(pMac, pAuthNode); |
| 1108 | |
| 1109 | pAuthNode->fTimerStarted = 1; |
| 1110 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1111 | /* |
| 1112 | * get random bytes and use as challenge text |
| 1113 | */ |
yeshwanth sriram guntuka | 9771105 | 2017-09-08 12:16:08 +0530 | [diff] [blame] | 1114 | if( !VOS_IS_STATUS_SUCCESS( vos_rand_get_bytes( 0, (tANI_U8 *)challengeTextArray, SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1115 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1116 | limLog(pMac, LOGE,FL("Challenge text " |
| 1117 | "preparation failed in limProcessAuthFrame")); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1118 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1119 | } |
| 1120 | |
| 1121 | pChallenge = pAuthNode->challengeText; |
| 1122 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1123 | vos_mem_copy(pChallenge, |
| 1124 | (tANI_U8 *) challengeTextArray, |
| 1125 | sizeof(challengeTextArray)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1126 | |
| 1127 | /** |
| 1128 | * Sending Authenticaton frame with challenge. |
| 1129 | */ |
| 1130 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1131 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1132 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1133 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1134 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1135 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1136 | eSIR_MAC_SUCCESS_STATUS; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1137 | authFrame->type = SIR_MAC_CHALLENGE_TEXT_EID; |
yeshwanth sriram guntuka | 9771105 | 2017-09-08 12:16:08 +0530 | [diff] [blame] | 1138 | authFrame->length = SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1139 | vos_mem_copy(authFrame->challengeText, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1140 | pAuthNode->challengeText, |
yeshwanth sriram guntuka | 9771105 | 2017-09-08 12:16:08 +0530 | [diff] [blame] | 1141 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1142 | |
| 1143 | limSendAuthMgmtFrame( |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1144 | pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1145 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1146 | LIM_NO_WEP_IN_FC, |
| 1147 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1148 | } // if (wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED)) |
| 1149 | |
| 1150 | break; |
| 1151 | |
| 1152 | default: |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1153 | // Log error |
| 1154 | PELOGE( limLog(pMac, LOGE, |
| 1155 | FL("received Auth frame for unsupported auth " |
| 1156 | "algorithm %d "MAC_ADDRESS_STR), |
| 1157 | pRxAuthFrameBody->authAlgoNumber, |
| 1158 | MAC_ADDR_ARRAY(pHdr->sa));) |
| 1159 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1160 | /** |
| 1161 | * Responding party does not support the |
| 1162 | * authentication algorithm requested by |
| 1163 | * sending party. |
| 1164 | * Reject by sending Authentication frame |
| 1165 | * with auth algorithm not supported status code |
| 1166 | */ |
| 1167 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1168 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1169 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1170 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1171 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1172 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1173 | eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS; |
| 1174 | |
| 1175 | limSendAuthMgmtFrame( |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1176 | pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1177 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1178 | LIM_NO_WEP_IN_FC, |
| 1179 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1180 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1181 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1182 | } // end switch(pRxAuthFrameBody->authAlgoNumber) |
| 1183 | } // if (limIsAuthAlgoSupported(pRxAuthFrameBody->authAlgoNumber)) |
| 1184 | else |
| 1185 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1186 | // Log error |
| 1187 | PELOGE(limLog(pMac, LOGE, |
| 1188 | FL("received Authentication frame for unsupported auth " |
| 1189 | "algorithm %d "MAC_ADDRESS_STR), |
| 1190 | pRxAuthFrameBody->authAlgoNumber, |
| 1191 | MAC_ADDR_ARRAY(pHdr->sa));) |
| 1192 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1193 | /** |
| 1194 | * Responding party does not support the |
| 1195 | * authentication algorithm requested by sending party. |
| 1196 | * Reject Authentication with StatusCode=13. |
| 1197 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1198 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1199 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1200 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1202 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1203 | eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS; |
| 1204 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1205 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1206 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1207 | LIM_NO_WEP_IN_FC, |
| 1208 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1209 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1210 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1211 | } //end if (limIsAuthAlgoSupported(pRxAuthFrameBody->authAlgoNumber)) |
| 1212 | break; |
| 1213 | |
| 1214 | case SIR_MAC_AUTH_FRAME_2: |
| 1215 | // AuthFrame 2 |
| 1216 | |
| 1217 | if (psessionEntry->limMlmState != eLIM_MLM_WT_AUTH_FRAME2_STATE) |
| 1218 | { |
| 1219 | /** |
| 1220 | * Received Authentication frame2 in an unexpected state. |
| 1221 | * Log error and ignore the frame. |
| 1222 | */ |
| 1223 | |
| 1224 | // Log error |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1225 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1226 | FL("received Auth frame2 from peer in state %d, addr "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1227 | psessionEntry->limMlmState); |
| 1228 | limPrintMacAddr(pMac, pHdr->sa, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1230 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1231 | } |
| 1232 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1233 | if ( !vos_mem_compare((tANI_U8 *) pHdr->sa, |
| 1234 | (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
| 1235 | sizeof(tSirMacAddr)) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1236 | { |
| 1237 | /** |
| 1238 | * Received Authentication frame from an entity |
| 1239 | * other than one request was initiated. |
| 1240 | * Wait until Authentication Failure Timeout. |
| 1241 | */ |
| 1242 | |
| 1243 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1244 | PELOGW(limLog(pMac, LOGW, |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1245 | FL("received Auth frame2 from unexpected peer " |
| 1246 | MAC_ADDRESS_STR), |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1247 | MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1248 | |
| 1249 | break; |
| 1250 | } |
| 1251 | |
| 1252 | if (pRxAuthFrameBody->authStatusCode == |
| 1253 | eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS) |
| 1254 | { |
| 1255 | /** |
| 1256 | * Interoperability workaround: Linksys WAP4400N is returning |
| 1257 | * wrong authType in OpenAuth response in case of |
| 1258 | * SharedKey AP configuration. Pretend we don't see that, |
| 1259 | * so upper layer can fallback to SharedKey authType, |
| 1260 | * and successfully connect to the AP. |
| 1261 | */ |
| 1262 | if (pRxAuthFrameBody->authAlgoNumber != |
| 1263 | pMac->lim.gpLimMlmAuthReq->authType) |
| 1264 | { |
| 1265 | pRxAuthFrameBody->authAlgoNumber = |
| 1266 | pMac->lim.gpLimMlmAuthReq->authType; |
| 1267 | } |
| 1268 | } |
| 1269 | |
| 1270 | if (pRxAuthFrameBody->authAlgoNumber != |
| 1271 | pMac->lim.gpLimMlmAuthReq->authType) |
| 1272 | { |
Abhinav Kumar | 6920f5a | 2019-08-05 18:55:11 +0530 | [diff] [blame] | 1273 | /* |
| 1274 | * Auth algo is open in rx auth frame when auth type is SAE and |
| 1275 | * PMK is cached as driver sent auth algo as open in tx frame |
| 1276 | * as well. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1277 | */ |
Abhinav Kumar | 6920f5a | 2019-08-05 18:55:11 +0530 | [diff] [blame] | 1278 | if ((pMac->lim.gpLimMlmAuthReq->authType == |
| 1279 | eSIR_AUTH_TYPE_SAE) && psessionEntry->sae_pmk_cached) { |
| 1280 | limLog(pMac, LOGW, |
| 1281 | FL("rx Auth frame2 auth algo %d in SAE PMK case"), |
| 1282 | pRxAuthFrameBody->authAlgoNumber); |
| 1283 | } else { |
| 1284 | /** |
| 1285 | * Received Authentication frame with an auth |
| 1286 | * algorithm other than one requested. |
| 1287 | * Wait until Authentication Failure Timeout. |
| 1288 | */ |
| 1289 | // Log error |
| 1290 | PELOGW(limLog(pMac, LOGW, |
| 1291 | FL("received Auth frame2 for unexpected auth algo num %d " |
| 1292 | MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, |
| 1293 | MAC_ADDR_ARRAY(pHdr->sa));) |
Abhinav Kumar | 0ee145b | 2019-09-12 20:13:58 +0530 | [diff] [blame] | 1294 | break; |
Abhinav Kumar | 6920f5a | 2019-08-05 18:55:11 +0530 | [diff] [blame] | 1295 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1296 | } |
| 1297 | |
| 1298 | if (pRxAuthFrameBody->authStatusCode == |
| 1299 | eSIR_MAC_SUCCESS_STATUS) |
| 1300 | { |
| 1301 | if (pRxAuthFrameBody->authAlgoNumber == |
| 1302 | eSIR_OPEN_SYSTEM) |
| 1303 | { |
| 1304 | psessionEntry->limCurrentAuthType = eSIR_OPEN_SYSTEM; |
| 1305 | |
| 1306 | pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable); |
| 1307 | |
| 1308 | if (pAuthNode == NULL) |
| 1309 | { |
| 1310 | // Log error |
| 1311 | limLog(pMac, LOGW, |
| 1312 | FL("Max pre-auth nodes reached ")); |
| 1313 | limPrintMacAddr(pMac, pHdr->sa, LOGW); |
| 1314 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1315 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1316 | } |
| 1317 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1318 | limLog(pMac, LOG1, |
| 1319 | FL("Alloc new data: peer "MAC_ADDRESS_STR), |
| 1320 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1321 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1322 | vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1323 | pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
| 1324 | sizeof(tSirMacAddr)); |
| 1325 | pAuthNode->fTimerStarted = 0; |
| 1326 | pAuthNode->authType = pMac->lim.gpLimMlmAuthReq->authType; |
Sushant Kaushik | f9c963c | 2015-01-28 12:50:26 +0530 | [diff] [blame] | 1327 | pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) | |
| 1328 | (pHdr->seqControl.seqNumLo)); |
Edhar, Mahesh Kumar | 0d82c21 | 2015-02-03 17:47:16 +0530 | [diff] [blame] | 1329 | pAuthNode->timestamp = vos_timer_get_system_ticks(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1330 | limAddPreAuthNode(pMac, pAuthNode); |
| 1331 | |
| 1332 | limRestoreFromAuthState(pMac, eSIR_SME_SUCCESS, |
| 1333 | pRxAuthFrameBody->authStatusCode,psessionEntry); |
| 1334 | } // if (pRxAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) |
| 1335 | else |
| 1336 | { |
| 1337 | // Shared key authentication |
| 1338 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1339 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1340 | { |
| 1341 | val = psessionEntry->privacy; |
| 1342 | } |
| 1343 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1344 | if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, |
| 1345 | &val) != eSIR_SUCCESS) |
| 1346 | { |
| 1347 | /** |
| 1348 | * Could not get Privacy option |
| 1349 | * from CFG. Log error. |
| 1350 | */ |
| 1351 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1352 | FL("could not retrieve Privacy option")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1353 | } |
| 1354 | cfgPrivacyOptImp = (tANI_U8)val; |
| 1355 | if (!cfgPrivacyOptImp) |
| 1356 | { |
| 1357 | /** |
| 1358 | * Requesting STA does not have WEP implemented. |
| 1359 | * Reject with unsupported authentication algorithm |
| 1360 | * Status code and wait until auth failure timeout |
| 1361 | */ |
| 1362 | |
| 1363 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1364 | PELOGE( limLog(pMac, LOGE, |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1365 | FL("received Auth frame from peer for " |
| 1366 | "unsupported auth algo %d " |
| 1367 | MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1368 | MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1369 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1370 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1371 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1372 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1373 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1374 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1375 | eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS; |
| 1376 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1377 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1378 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1379 | LIM_NO_WEP_IN_FC, |
| 1380 | psessionEntry, eSIR_FALSE); |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1381 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1382 | } |
| 1383 | else |
| 1384 | { |
| 1385 | |
| 1386 | if (pRxAuthFrameBody->type != |
| 1387 | SIR_MAC_CHALLENGE_TEXT_EID) |
| 1388 | { |
| 1389 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1390 | PELOGE(limLog(pMac, LOGE, |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1391 | FL("received Auth frame with invalid " |
| 1392 | "challenge text IE"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1393 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1394 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1395 | } |
| 1396 | |
| 1397 | /** |
| 1398 | * Check if there exists a key mappping key |
| 1399 | * for the STA that sent Authentication frame |
| 1400 | */ |
| 1401 | pKeyMapEntry = limLookUpKeyMappings( |
| 1402 | pHdr->sa); |
| 1403 | |
| 1404 | if (pKeyMapEntry) |
| 1405 | { |
| 1406 | if (pKeyMapEntry->key == NULL) |
| 1407 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1408 | // Log error |
| 1409 | PELOGE(limLog(pMac, LOGE, |
| 1410 | FL("received Auth frame from peer when " |
| 1411 | "key mapping key is NULL"MAC_ADDRESS_STR), |
| 1412 | MAC_ADDR_ARRAY(pHdr->sa));) |
| 1413 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1414 | /** |
| 1415 | * Key Mapping entry has null key. |
| 1416 | * Send Auth frame with |
| 1417 | * challenge failure status code |
| 1418 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1419 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1420 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1421 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1422 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1423 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1424 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
| 1425 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1426 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1427 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1428 | LIM_NO_WEP_IN_FC, |
| 1429 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1431 | limRestoreFromAuthState(pMac, eSIR_SME_NO_KEY_MAPPING_KEY_FOR_PEER, |
| 1432 | eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry); |
| 1433 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1434 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1435 | } // if (pKeyMapEntry->key == NULL) |
| 1436 | else |
| 1437 | { |
| 1438 | ((tpSirMacAuthFrameBody) plainBody)->authAlgoNumber = |
| 1439 | sirSwapU16ifNeeded(pRxAuthFrameBody->authAlgoNumber); |
| 1440 | ((tpSirMacAuthFrameBody) plainBody)->authTransactionSeqNumber = |
| 1441 | sirSwapU16ifNeeded((tANI_U16) (pRxAuthFrameBody->authTransactionSeqNumber + 1)); |
| 1442 | ((tpSirMacAuthFrameBody) plainBody)->authStatusCode = eSIR_MAC_SUCCESS_STATUS; |
| 1443 | ((tpSirMacAuthFrameBody) plainBody)->type = SIR_MAC_CHALLENGE_TEXT_EID; |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 1444 | ((tpSirMacAuthFrameBody) plainBody)->length = pRxAuthFrameBody->length; |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1445 | vos_mem_copy((tANI_U8 *) ((tpSirMacAuthFrameBody) plainBody)->challengeText, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1446 | pRxAuthFrameBody->challengeText, |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 1447 | pRxAuthFrameBody->length); |
| 1448 | |
| 1449 | encrAuthFrame = vos_mem_malloc(pRxAuthFrameBody->length + |
| 1450 | LIM_ENCR_AUTH_INFO_LEN); |
| 1451 | if (!encrAuthFrame) { |
| 1452 | limLog(pMac, LOGE, FL("failed to allocate memory")); |
| 1453 | goto free; |
| 1454 | } |
| 1455 | vos_mem_set(encrAuthFrame, pRxAuthFrameBody->length + |
| 1456 | LIM_ENCR_AUTH_INFO_LEN, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1457 | |
| 1458 | limEncryptAuthFrame(pMac, 0, |
| 1459 | pKeyMapEntry->key, |
| 1460 | plainBody, |
| 1461 | encrAuthFrame,key_length); |
| 1462 | |
| 1463 | psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME4_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1464 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1465 | |
| 1466 | limSendAuthMgmtFrame(pMac, |
| 1467 | (tpSirMacAuthFrameBody) encrAuthFrame, |
| 1468 | pHdr->sa, |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 1469 | pRxAuthFrameBody->length, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1470 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1471 | |
| 1472 | break; |
| 1473 | } // end if (pKeyMapEntry->key == NULL) |
| 1474 | } // if (pKeyMapEntry) |
| 1475 | else |
| 1476 | { |
| 1477 | if (wlan_cfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, |
| 1478 | &val) != eSIR_SUCCESS) |
| 1479 | { |
| 1480 | /** |
| 1481 | * Could not get Default keyId |
| 1482 | * from CFG. Log error. |
| 1483 | */ |
| 1484 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1485 | FL("could not retrieve Default keyId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1486 | } |
| 1487 | keyId = (tANI_U8)val; |
| 1488 | |
| 1489 | val = SIR_MAC_KEY_LENGTH; |
| 1490 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1491 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1492 | { |
| 1493 | tpSirKeys pKey; |
| 1494 | pKey = &psessionEntry->WEPKeyMaterial[keyId].key[0]; |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1495 | vos_mem_copy(defaultKey, pKey->key, pKey->keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1496 | } |
| 1497 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1498 | if (wlan_cfgGetStr(pMac, (tANI_U16) (WNI_CFG_WEP_DEFAULT_KEY_1 + keyId), |
| 1499 | defaultKey, |
| 1500 | &val) |
| 1501 | != eSIR_SUCCESS) |
| 1502 | { |
| 1503 | /// Could not get Default key from CFG. |
| 1504 | //Log error. |
| 1505 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1506 | FL("could not retrieve Default key")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1507 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1508 | authFrame->authAlgoNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1509 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1510 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1511 | pRxAuthFrameBody->authTransactionSeqNumber + 1; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1512 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1513 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
| 1514 | |
| 1515 | limSendAuthMgmtFrame( |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1516 | pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1517 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1518 | LIM_NO_WEP_IN_FC, |
| 1519 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1520 | |
| 1521 | limRestoreFromAuthState(pMac, eSIR_SME_INVALID_WEP_DEFAULT_KEY, |
| 1522 | eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry); |
| 1523 | |
| 1524 | break; |
| 1525 | } |
| 1526 | key_length=val; |
| 1527 | ((tpSirMacAuthFrameBody) plainBody)->authAlgoNumber = |
| 1528 | sirSwapU16ifNeeded(pRxAuthFrameBody->authAlgoNumber); |
| 1529 | ((tpSirMacAuthFrameBody) plainBody)->authTransactionSeqNumber = |
| 1530 | sirSwapU16ifNeeded((tANI_U16) (pRxAuthFrameBody->authTransactionSeqNumber + 1)); |
| 1531 | ((tpSirMacAuthFrameBody) plainBody)->authStatusCode = eSIR_MAC_SUCCESS_STATUS; |
| 1532 | ((tpSirMacAuthFrameBody) plainBody)->type = SIR_MAC_CHALLENGE_TEXT_EID; |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 1533 | ((tpSirMacAuthFrameBody) plainBody)->length = pRxAuthFrameBody->length; |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1534 | vos_mem_copy((tANI_U8 *) ((tpSirMacAuthFrameBody) plainBody)->challengeText, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1535 | pRxAuthFrameBody->challengeText, |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 1536 | pRxAuthFrameBody->length); |
| 1537 | |
| 1538 | encrAuthFrame = vos_mem_malloc(pRxAuthFrameBody->length + |
| 1539 | LIM_ENCR_AUTH_INFO_LEN); |
| 1540 | if (!encrAuthFrame) { |
| 1541 | limLog(pMac, LOGE, FL("failed to allocate memory")); |
| 1542 | goto free; |
| 1543 | } |
| 1544 | vos_mem_set(encrAuthFrame, pRxAuthFrameBody->length + |
| 1545 | LIM_ENCR_AUTH_INFO_LEN, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | |
| 1547 | limEncryptAuthFrame(pMac, keyId, |
| 1548 | defaultKey, |
| 1549 | plainBody, |
| 1550 | encrAuthFrame,key_length); |
| 1551 | |
| 1552 | psessionEntry->limMlmState = |
| 1553 | eLIM_MLM_WT_AUTH_FRAME4_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1554 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1555 | |
| 1556 | limSendAuthMgmtFrame(pMac, |
| 1557 | (tpSirMacAuthFrameBody) encrAuthFrame, |
| 1558 | pHdr->sa, |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 1559 | pRxAuthFrameBody->length, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1560 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1561 | |
| 1562 | break; |
| 1563 | } // end if (pKeyMapEntry) |
| 1564 | } // end if (!wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED)) |
| 1565 | } // end if (pRxAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) |
| 1566 | } // if (pRxAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS) |
| 1567 | else |
| 1568 | { |
| 1569 | /** |
| 1570 | * Authentication failure. |
| 1571 | * Return Auth confirm with received failure code to SME |
| 1572 | */ |
| 1573 | |
| 1574 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1575 | PELOGE(limLog(pMac, LOGE, |
| 1576 | FL("received Auth frame from peer with failure code %d " |
| 1577 | MAC_ADDRESS_STR), pRxAuthFrameBody->authStatusCode, |
| 1578 | MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1579 | |
| 1580 | limRestoreFromAuthState(pMac, eSIR_SME_AUTH_REFUSED, |
| 1581 | pRxAuthFrameBody->authStatusCode,psessionEntry); |
| 1582 | } // end if (pRxAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS) |
| 1583 | |
| 1584 | break; |
| 1585 | |
| 1586 | case SIR_MAC_AUTH_FRAME_3: |
| 1587 | // AuthFrame 3 |
| 1588 | |
| 1589 | if (pRxAuthFrameBody->authAlgoNumber != eSIR_SHARED_KEY) |
| 1590 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1591 | // Log error |
| 1592 | PELOGE(limLog(pMac, LOGE, |
| 1593 | FL("received Auth frame3 from peer with auth algo " |
| 1594 | "number %d "MAC_ADDRESS_STR), |
| 1595 | pRxAuthFrameBody->authAlgoNumber, |
| 1596 | MAC_ADDR_ARRAY(pHdr->sa));) |
| 1597 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1598 | /** |
| 1599 | * Received Authentication frame3 with algorithm other than |
| 1600 | * Shared Key authentication type. Reject with Auth frame4 |
| 1601 | * with 'out of sequence' status code. |
| 1602 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1603 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 1604 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1605 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1606 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1607 | eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS; |
| 1608 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1609 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1610 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1611 | LIM_NO_WEP_IN_FC, |
| 1612 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1613 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1614 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1615 | } |
| 1616 | |
| 1617 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE || |
| 1618 | psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) |
| 1619 | { |
| 1620 | /** |
| 1621 | * Check if wep bit was set in FC. If not set, |
| 1622 | * reject with Authentication frame4 with |
| 1623 | * 'challenge failure' status code. |
| 1624 | */ |
| 1625 | if (!pHdr->fc.wep) |
| 1626 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1627 | // Log error |
| 1628 | PELOGE(limLog(pMac, LOGE, |
| 1629 | FL("received Auth frame3 from peer with no WEP bit " |
| 1630 | "set "MAC_ADDRESS_STR), |
| 1631 | MAC_ADDR_ARRAY(pHdr->sa));) |
| 1632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1633 | /// WEP bit is not set in FC of Auth Frame3 |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1634 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 1635 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1636 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1637 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1638 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
| 1639 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1640 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1641 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1642 | LIM_NO_WEP_IN_FC, |
| 1643 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1644 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1645 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1646 | } |
| 1647 | |
| 1648 | pAuthNode = limSearchPreAuthList(pMac, |
| 1649 | pHdr->sa); |
| 1650 | if (pAuthNode == NULL) |
| 1651 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1652 | // Log error |
| 1653 | PELOGE(limLog(pMac, LOGW, |
| 1654 | FL("received AuthFrame3 from peer that has no " |
| 1655 | "preauth context "MAC_ADDRESS_STR), |
| 1656 | MAC_ADDR_ARRAY(pHdr->sa));) |
| 1657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1658 | /** |
| 1659 | * No 'pre-auth' context exists for |
| 1660 | * this STA that sent an Authentication |
| 1661 | * frame3. |
| 1662 | * Send Auth frame4 with 'out of sequence' |
| 1663 | * status code. |
| 1664 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1665 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 1666 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1667 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1668 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1669 | eSIR_MAC_AUTH_FRAME_OUT_OF_SEQ_STATUS; |
| 1670 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1671 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1672 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1673 | LIM_NO_WEP_IN_FC, |
| 1674 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1675 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1676 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1677 | } |
| 1678 | |
| 1679 | if (pAuthNode->mlmState == eLIM_MLM_AUTH_RSP_TIMEOUT_STATE) |
| 1680 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1681 | // Log error |
| 1682 | limLog(pMac, LOGW, |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 1683 | FL("auth response timer timedout for peer " |
| 1684 | MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1685 | /** |
| 1686 | * Received Auth Frame3 after Auth Response timeout. |
| 1687 | * Reject by sending Auth Frame4 with |
| 1688 | * Auth respone timeout Status Code. |
| 1689 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1690 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 1691 | authFrame->authTransactionSeqNumber = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1692 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1693 | authFrame->authStatusCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1694 | eSIR_MAC_AUTH_RSP_TIMEOUT_STATUS; |
| 1695 | |
| 1696 | limSendAuthMgmtFrame( |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1697 | pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1698 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1699 | LIM_NO_WEP_IN_FC, |
| 1700 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1701 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1702 | /// Delete pre-auth context of STA |
| 1703 | limDeletePreAuthNode(pMac, |
| 1704 | pHdr->sa); |
| 1705 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1706 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1707 | } // end switch (pAuthNode->mlmState) |
| 1708 | |
| 1709 | if (pRxAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS) |
| 1710 | { |
| 1711 | /** |
| 1712 | * Received Authenetication Frame 3 with status code |
| 1713 | * other than success. Wait until Auth response timeout |
| 1714 | * to delete STA context. |
| 1715 | */ |
| 1716 | |
| 1717 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1718 | PELOGE(limLog(pMac, LOGE, |
| 1719 | FL("received Auth frame3 from peer with status code %d " |
| 1720 | MAC_ADDRESS_STR), pRxAuthFrameBody->authStatusCode, |
| 1721 | MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1722 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1723 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1724 | } |
| 1725 | |
| 1726 | /** |
| 1727 | * Check if received challenge text is same as one sent in |
| 1728 | * Authentication frame3 |
| 1729 | */ |
| 1730 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1731 | if (vos_mem_compare(pRxAuthFrameBody->challengeText, |
| 1732 | pAuthNode->challengeText, |
yeshwanth sriram guntuka | 9771105 | 2017-09-08 12:16:08 +0530 | [diff] [blame] | 1733 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1734 | { |
| 1735 | /// Challenge match. STA is autheticated ! |
| 1736 | |
| 1737 | /// Delete Authentication response timer if running |
| 1738 | limDeactivateAndChangePerStaIdTimer(pMac, |
| 1739 | eLIM_AUTH_RSP_TIMER, |
| 1740 | pAuthNode->authNodeIdx); |
| 1741 | |
| 1742 | pAuthNode->fTimerStarted = 0; |
| 1743 | pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE; |
| 1744 | |
| 1745 | /** |
| 1746 | * Send Authentication Frame4 with 'success' Status Code. |
| 1747 | */ |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1748 | authFrame->authAlgoNumber = eSIR_SHARED_KEY; |
| 1749 | authFrame->authTransactionSeqNumber = |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 1750 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1751 | authFrame->authStatusCode = eSIR_MAC_SUCCESS_STATUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1752 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1753 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1754 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1755 | LIM_NO_WEP_IN_FC, |
| 1756 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1757 | |
| 1758 | /// Send Auth indication to SME |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1759 | vos_mem_copy((tANI_U8 *) mlmAuthInd.peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1760 | (tANI_U8 *) pHdr->sa, |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1761 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1762 | mlmAuthInd.authType = (tAniAuthType) |
| 1763 | pRxAuthFrameBody->authAlgoNumber; |
| 1764 | mlmAuthInd.sessionId = psessionEntry->smeSessionId; |
| 1765 | |
| 1766 | limPostSmeMessage(pMac, |
| 1767 | LIM_MLM_AUTH_IND, |
| 1768 | (tANI_U32 *) &mlmAuthInd); |
| 1769 | |
| 1770 | break; |
| 1771 | } |
| 1772 | else |
| 1773 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1774 | // Log error |
| 1775 | PELOGE( limLog(pMac, LOGW, |
| 1776 | FL("Challenge failure for peer " |
| 1777 | MAC_ADDRESS_STR), |
| 1778 | MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1779 | /** |
| 1780 | * Challenge Failure. |
| 1781 | * Send Authentication frame4 with 'challenge failure' |
| 1782 | * status code and wait until Auth response timeout to |
| 1783 | * delete STA context. |
| 1784 | */ |
| 1785 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1786 | authFrame->authAlgoNumber = |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 1787 | pRxAuthFrameBody->authAlgoNumber; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1788 | authFrame->authTransactionSeqNumber = |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 1789 | SIR_MAC_AUTH_FRAME_4; |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1790 | authFrame->authStatusCode = |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 1791 | eSIR_MAC_CHALLENGE_FAILURE_STATUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1792 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1793 | limSendAuthMgmtFrame(pMac, authFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1794 | pHdr->sa, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 1795 | LIM_NO_WEP_IN_FC, |
| 1796 | psessionEntry, eSIR_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1797 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1798 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1799 | } |
| 1800 | } // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE || ... |
| 1801 | |
| 1802 | break; |
| 1803 | |
| 1804 | case SIR_MAC_AUTH_FRAME_4: |
| 1805 | // AuthFrame 4 |
| 1806 | if (psessionEntry->limMlmState != eLIM_MLM_WT_AUTH_FRAME4_STATE) |
| 1807 | { |
| 1808 | /** |
| 1809 | * Received Authentication frame4 in an unexpected state. |
| 1810 | * Log error and ignore the frame. |
| 1811 | */ |
| 1812 | |
| 1813 | // Log error |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1814 | limLog(pMac, LOG1, |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1815 | FL("received unexpected Auth frame4 from peer in state " |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 1816 | "%d, addr "MAC_ADDRESS_STR), psessionEntry->limMlmState, |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1817 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1818 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1819 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1820 | } |
| 1821 | |
| 1822 | if (pRxAuthFrameBody->authAlgoNumber != eSIR_SHARED_KEY) |
| 1823 | { |
| 1824 | /** |
| 1825 | * Received Authentication frame4 with algorithm other than |
| 1826 | * Shared Key authentication type. |
| 1827 | * Wait until Auth failure timeout to report authentication |
| 1828 | * failure to SME. |
| 1829 | */ |
| 1830 | |
| 1831 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1832 | PELOGE(limLog(pMac, LOGE, |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1833 | FL("received Auth frame4 from peer with invalid auth " |
| 1834 | "algo %d "MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1835 | MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1836 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1837 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1838 | } |
| 1839 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1840 | if ( !vos_mem_compare((tANI_U8 *) pHdr->sa, |
| 1841 | (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
| 1842 | sizeof(tSirMacAddr)) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1843 | { |
| 1844 | /** |
| 1845 | * Received Authentication frame from an entity |
| 1846 | * other than one to which request was initiated. |
| 1847 | * Wait until Authentication Failure Timeout. |
| 1848 | */ |
| 1849 | |
| 1850 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1851 | PELOGE(limLog(pMac, LOGW, |
| 1852 | FL("received Auth frame4 from unexpected peer " |
| 1853 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1854 | |
| 1855 | break; |
| 1856 | } |
| 1857 | |
| 1858 | if (pRxAuthFrameBody->authAlgoNumber != |
| 1859 | pMac->lim.gpLimMlmAuthReq->authType) |
| 1860 | { |
| 1861 | /** |
| 1862 | * Received Authentication frame with an auth algorithm |
| 1863 | * other than one requested. |
| 1864 | * Wait until Authentication Failure Timeout. |
| 1865 | */ |
| 1866 | |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1867 | PELOGE(limLog(pMac, LOGE, |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1868 | FL("received Authentication frame from peer with " |
| 1869 | "invalid auth seq number %d " |
| 1870 | MAC_ADDRESS_STR), pRxAuthFrameBody->authTransactionSeqNumber, |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1871 | MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1872 | |
| 1873 | break; |
| 1874 | } |
| 1875 | |
| 1876 | if (pRxAuthFrameBody->authStatusCode == |
| 1877 | eSIR_MAC_SUCCESS_STATUS) |
| 1878 | { |
| 1879 | /** |
| 1880 | * Authentication Success ! |
| 1881 | * Inform SME of same. |
| 1882 | */ |
| 1883 | psessionEntry->limCurrentAuthType = eSIR_SHARED_KEY; |
| 1884 | |
| 1885 | pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable); |
| 1886 | if (pAuthNode == NULL) |
| 1887 | { |
| 1888 | // Log error |
| 1889 | limLog(pMac, LOGW, |
| 1890 | FL("Max pre-auth nodes reached ")); |
| 1891 | limPrintMacAddr(pMac, pHdr->sa, LOGW); |
| 1892 | |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1893 | goto free; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1894 | } |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1895 | limLog(pMac, LOG1, |
| 1896 | FL("Alloc new data: peer " MAC_ADDRESS_STR), |
| 1897 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1898 | |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 1899 | vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1900 | pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
| 1901 | sizeof(tSirMacAddr)); |
| 1902 | pAuthNode->fTimerStarted = 0; |
| 1903 | pAuthNode->authType = pMac->lim.gpLimMlmAuthReq->authType; |
Sushant Kaushik | f9c963c | 2015-01-28 12:50:26 +0530 | [diff] [blame] | 1904 | pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) | |
| 1905 | (pHdr->seqControl.seqNumLo)); |
Edhar, Mahesh Kumar | 0d82c21 | 2015-02-03 17:47:16 +0530 | [diff] [blame] | 1906 | pAuthNode->timestamp = vos_timer_get_system_ticks(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1907 | limAddPreAuthNode(pMac, pAuthNode); |
| 1908 | |
| 1909 | limRestoreFromAuthState(pMac, eSIR_SME_SUCCESS, |
| 1910 | pRxAuthFrameBody->authStatusCode,psessionEntry); |
| 1911 | |
| 1912 | } // if (pRxAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS) |
| 1913 | else |
| 1914 | { |
| 1915 | /** |
| 1916 | * Authentication failure. |
| 1917 | * Return Auth confirm with received failure code to SME |
| 1918 | */ |
| 1919 | |
| 1920 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1921 | PELOGE(limLog(pMac, LOGE, FL("Authentication failure from peer " |
| 1922 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1923 | |
| 1924 | limRestoreFromAuthState(pMac, eSIR_SME_AUTH_REFUSED, |
| 1925 | pRxAuthFrameBody->authStatusCode,psessionEntry); |
| 1926 | } // end if (pRxAuthFrameBody->Status == 0) |
| 1927 | |
| 1928 | break; |
| 1929 | |
| 1930 | default: |
| 1931 | /// Invalid Authentication Frame received. Ignore it. |
| 1932 | |
| 1933 | // Log error |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1934 | PELOGE(limLog(pMac, LOGE, |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 1935 | FL("received Auth frame from peer with invalid auth seq " |
| 1936 | "number %d " MAC_ADDRESS_STR), |
| 1937 | pRxAuthFrameBody->authTransactionSeqNumber, |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 1938 | MAC_ADDR_ARRAY(pHdr->sa));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1939 | |
| 1940 | break; |
| 1941 | } // end switch (pRxAuthFrameBody->authTransactionSeqNumber) |
Sridhar Selvaraj | 82ef686 | 2017-07-27 19:39:58 +0530 | [diff] [blame] | 1942 | |
| 1943 | free: |
| 1944 | if (authFrame) |
| 1945 | vos_mem_free(authFrame); |
| 1946 | if (rxAuthFrame) |
| 1947 | vos_mem_free(rxAuthFrame); |
| 1948 | if (encrAuthFrame) |
| 1949 | vos_mem_free(encrAuthFrame); |
| 1950 | if (plainBody) |
| 1951 | vos_mem_free(plainBody); |
| 1952 | if (challengeTextArray) |
| 1953 | vos_mem_free(challengeTextArray); |
| 1954 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1955 | } /*** end limProcessAuthFrame() ***/ |
| 1956 | |
| 1957 | |
| 1958 | |
| 1959 | |
| 1960 | |
| 1961 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1962 | |
| 1963 | /*---------------------------------------------------------------------- |
| 1964 | * |
| 1965 | * Pass the received Auth frame. This is possibly the pre-auth from the |
| 1966 | * neighbor AP, in the same mobility domain. |
| 1967 | * This will be used in case of 11r FT. |
| 1968 | * |
| 1969 | * !!!! This is going to be renoved for the next checkin. We will be creating |
| 1970 | * the session before sending out the Auth. Thus when auth response |
| 1971 | * is received we will have a session in progress. !!!!! |
| 1972 | *---------------------------------------------------------------------- |
| 1973 | */ |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 1974 | tSirRetStatus limProcessAuthFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd, void *body) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1975 | { |
| 1976 | tpSirMacMgmtHdr pHdr; |
| 1977 | tpPESession psessionEntry = NULL; |
| 1978 | tANI_U8 *pBody; |
| 1979 | tANI_U16 frameLen; |
| 1980 | tSirMacAuthFrameBody rxAuthFrame; |
| 1981 | tSirMacAuthFrameBody *pRxAuthFrameBody = NULL; |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 1982 | tSirRetStatus ret_status = eSIR_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1983 | |
| 1984 | pHdr = WDA_GET_RX_MAC_HEADER(pBd); |
| 1985 | pBody = WDA_GET_RX_MPDU_DATA(pBd); |
| 1986 | frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd); |
| 1987 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 1988 | /* |
| 1989 | * since, roaming is not supported in sta + mon scc, ignore |
| 1990 | * pre-auth when capture on monitor mode is started |
| 1991 | */ |
| 1992 | if (vos_check_monitor_state()) |
| 1993 | { |
| 1994 | limLog(pMac, LOG1, FL("Ignore pre-auth frame in monitor mode")); |
| 1995 | return eSIR_FAILURE; |
| 1996 | } |
| 1997 | |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 1998 | limLog(pMac, LOG1, FL("Auth Frame Received: BSSID " MAC_ADDRESS_STR |
| 1999 | " (RSSI %d)"),MAC_ADDR_ARRAY(pHdr->bssId), |
| 2000 | (uint)abs((tANI_S8)WDA_GET_RX_RSSI_DB(pBd))); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2001 | // Check for the operating channel and see what needs to be done next. |
| 2002 | psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry; |
| 2003 | if (psessionEntry == NULL) |
| 2004 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 2005 | limLog(pMac, LOGE, FL("Error: Unable to find session id while in " |
| 2006 | "pre-auth phase for FT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2007 | return eSIR_FAILURE; |
| 2008 | } |
| 2009 | |
| 2010 | if (pMac->ft.ftPEContext.pFTPreAuthReq == NULL) |
| 2011 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 2012 | limLog(pMac, LOGE, FL("Error: No FT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2013 | // No FT in progress. |
| 2014 | return eSIR_FAILURE; |
| 2015 | } |
| 2016 | |
| 2017 | if (frameLen == 0) |
| 2018 | { |
Abhishek Singh | 208848c | 2013-12-18 19:02:52 +0530 | [diff] [blame] | 2019 | limLog(pMac, LOGE, FL("Error: Frame len = 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2020 | return eSIR_FAILURE; |
| 2021 | } |
| 2022 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2023 | limPrintMacAddr(pMac, pHdr->bssId, LOG2); |
| 2024 | limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOG2); |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 2025 | limLog(pMac,LOG2,FL("seqControl 0x%X"), |
Madan Mohan Koyyalamudi | 2300172 | 2012-10-31 16:48:56 -0700 | [diff] [blame] | 2026 | ((pHdr->seqControl.seqNumHi << 8) | |
| 2027 | (pHdr->seqControl.seqNumLo << 4) | |
| 2028 | (pHdr->seqControl.fragNum))); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2029 | #endif |
| 2030 | |
| 2031 | // Check that its the same bssId we have for preAuth |
Hema Aparna Medicharla | eef78fc | 2013-07-12 11:47:01 +0530 | [diff] [blame] | 2032 | if (!vos_mem_compare(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, |
| 2033 | pHdr->bssId, sizeof( tSirMacAddr ))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2034 | { |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 2035 | limLog(pMac, LOGE, FL("Error: NOT same bssid as preauth BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2036 | // In this case SME if indeed has triggered a |
| 2037 | // pre auth it will time out. |
| 2038 | return eSIR_FAILURE; |
| 2039 | } |
| 2040 | |
Madan Mohan Koyyalamudi | 2300172 | 2012-10-31 16:48:56 -0700 | [diff] [blame] | 2041 | if (eANI_BOOLEAN_TRUE == |
| 2042 | pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed) |
| 2043 | { |
| 2044 | /* |
| 2045 | * This is likely a duplicate for the same pre-auth request. |
| 2046 | * PE/LIM already posted a response to SME. Hence, drop it. |
| 2047 | * TBD: |
| 2048 | * 1) How did we even receive multiple auth responses? |
| 2049 | * 2) Do we need to delete pre-auth session? Suppose we |
| 2050 | * previously received an auth resp with failure which |
| 2051 | * would not have created the session and forwarded to SME. |
| 2052 | * And, we subsequently received an auth resp with success |
| 2053 | * which would have created the session. This will now be |
| 2054 | * dropped without being forwarded to SME! However, it is |
| 2055 | * very unlikely to receive auth responses from the same |
| 2056 | * AP with different reason codes. |
| 2057 | * NOTE: return eSIR_SUCCESS so that the packet is dropped |
| 2058 | * as this was indeed a response from the BSSID we tried to |
| 2059 | * pre-auth. |
| 2060 | */ |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2061 | PELOGE(limLog(pMac,LOG1,"Auth rsp already posted to SME" |
Jeff Johnson | 0fe596e | 2017-09-19 08:36:48 -0700 | [diff] [blame] | 2062 | " (session %pK, FT session %pK)", psessionEntry, |
Madan Mohan Koyyalamudi | 2300172 | 2012-10-31 16:48:56 -0700 | [diff] [blame] | 2063 | pMac->ft.ftPEContext.pftSessionEntry);); |
| 2064 | return eSIR_SUCCESS; |
| 2065 | } |
| 2066 | else |
| 2067 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2068 | PELOGE(limLog(pMac,LOGW,"Auth rsp not yet posted to SME" |
Jeff Johnson | 0fe596e | 2017-09-19 08:36:48 -0700 | [diff] [blame] | 2069 | " (session %pK, FT session %pK)", psessionEntry, |
Madan Mohan Koyyalamudi | 2300172 | 2012-10-31 16:48:56 -0700 | [diff] [blame] | 2070 | pMac->ft.ftPEContext.pftSessionEntry);); |
| 2071 | pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed = |
| 2072 | eANI_BOOLEAN_TRUE; |
| 2073 | } |
| 2074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2075 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2076 | limLog(pMac, LOG1, FL("Pre-Auth response received from neighbor")); |
| 2077 | limLog(pMac, LOG1, FL("Pre-Auth done state")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2078 | #endif |
Padma, Santhosh Kumar | 67f479b | 2016-12-28 15:43:42 +0530 | [diff] [blame] | 2079 | |
| 2080 | limLog(pMac, LOG1, FL("is_preauth_lfr_mbb %d"), |
| 2081 | pMac->ft.ftSmeContext.is_preauth_lfr_mbb); |
| 2082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2083 | // Stopping timer now, that we have our unicast from the AP |
| 2084 | // of our choice. |
Padma, Santhosh Kumar | 67f479b | 2016-12-28 15:43:42 +0530 | [diff] [blame] | 2085 | if (!pMac->ft.ftSmeContext.is_preauth_lfr_mbb) |
| 2086 | limDeactivateAndChangeTimer(pMac, eLIM_FT_PREAUTH_RSP_TIMER); |
| 2087 | |
| 2088 | #ifdef WLAN_FEATURE_LFR_MBB |
| 2089 | if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) |
| 2090 | limDeactivateAndChangeTimer(pMac, eLIM_PREAUTH_MBB_RSP_TIMER); |
| 2091 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2092 | |
| 2093 | |
| 2094 | // Save off the auth resp. |
| 2095 | if ((sirConvertAuthFrame2Struct(pMac, pBody, frameLen, &rxAuthFrame) != eSIR_SUCCESS)) |
| 2096 | { |
Abhishek Singh | db6e96e | 2013-12-30 14:16:10 +0530 | [diff] [blame] | 2097 | limLog(pMac, LOGE, FL("failed to convert Auth frame to struct")); |
Padma, Santhosh Kumar | 67f479b | 2016-12-28 15:43:42 +0530 | [diff] [blame] | 2098 | |
| 2099 | #ifdef WLAN_FEATURE_LFR_MBB |
| 2100 | if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) { |
| 2101 | lim_handle_pre_auth_mbb_rsp(pMac, eSIR_FAILURE, psessionEntry); |
| 2102 | return eSIR_FAILURE; |
| 2103 | } |
| 2104 | #endif |
| 2105 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2106 | limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry); |
| 2107 | return eSIR_FAILURE; |
| 2108 | } |
| 2109 | pRxAuthFrameBody = &rxAuthFrame; |
| 2110 | |
| 2111 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2112 | PELOGE(limLog(pMac, LOG1, |
| 2113 | FL("Received Auth frame with type=%d seqnum=%d, status=%d (%d)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2114 | (tANI_U32) pRxAuthFrameBody->authAlgoNumber, |
| 2115 | (tANI_U32) pRxAuthFrameBody->authTransactionSeqNumber, |
| 2116 | (tANI_U32) pRxAuthFrameBody->authStatusCode,(tANI_U32)pMac->lim.gLimNumPreAuthContexts);) |
| 2117 | #endif |
| 2118 | |
| 2119 | switch (pRxAuthFrameBody->authTransactionSeqNumber) |
| 2120 | { |
| 2121 | case SIR_MAC_AUTH_FRAME_2: |
| 2122 | if (pRxAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS) |
| 2123 | { |
| 2124 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 2125 | PELOGE(limLog( pMac, LOGE, "Auth status code received is %d", |
| 2126 | (tANI_U32) pRxAuthFrameBody->authStatusCode);); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2127 | #endif |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 2128 | if (eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS == pRxAuthFrameBody->authStatusCode) |
| 2129 | ret_status = eSIR_LIM_MAX_STA_REACHED_ERROR; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2130 | } |
| 2131 | else |
| 2132 | { |
| 2133 | ret_status = eSIR_SUCCESS; |
| 2134 | } |
| 2135 | break; |
| 2136 | |
| 2137 | default: |
| 2138 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 2139 | PELOGE(limLog( pMac, LOGE, "Seq. no incorrect expected 2 received %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | (tANI_U32) pRxAuthFrameBody->authTransactionSeqNumber);) |
| 2141 | #endif |
| 2142 | break; |
| 2143 | } |
| 2144 | |
Padma, Santhosh Kumar | 67f479b | 2016-12-28 15:43:42 +0530 | [diff] [blame] | 2145 | #ifdef WLAN_FEATURE_LFR_MBB |
| 2146 | if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) { |
| 2147 | lim_handle_pre_auth_mbb_rsp(pMac, ret_status, psessionEntry); |
| 2148 | return ret_status; |
| 2149 | } |
| 2150 | #endif |
| 2151 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2152 | // Send the Auth response to SME |
| 2153 | limHandleFTPreAuthRsp(pMac, ret_status, pBody, frameLen, psessionEntry); |
| 2154 | |
| 2155 | return ret_status; |
| 2156 | } |
| 2157 | |
| 2158 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2159 | |