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