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