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