blob: 16b80aafb75d276f33d3e420eb8d254fc7fc8c71 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +05302 * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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 Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
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 Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * 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 Johnson295189b2012-06-20 16:38:30 -070041#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070042#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
81static 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
138void
139limProcessAuthFrame(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 Johnson295189b2012-06-20 16:38:30 -0700157 tpDphHashNode pStaDs = NULL;
158 tANI_U16 assocId = 0;
Sushant Kaushikf9c963c2015-01-28 12:50:26 +0530159 tANI_U16 currSeqNo = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700160 /* 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 Singh3cbf6052014-12-15 16:46:42 +0530182 limLog(pMac, LOGE,
183 FL("received Auth frame from a BC/MC address - "));
184 limPrintMacAddr(pMac, pHdr->sa, LOGE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700185
186 return;
187 }
Sushant Kaushikf9c963c2015-01-28 12:50:26 +0530188 currSeqNo = (pHdr->seqControl.seqNumHi << 4) | (pHdr->seqControl.seqNumLo);
Abhishek Singhdb6e96e2013-12-30 14:16:10 +0530189 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 Yeturuf68abd62013-02-11 14:05:06 -0800195
Jeff Johnson295189b2012-06-20 16:38:30 -0700196 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
197
Jeff Johnsone7245742012-09-05 17:12:55 -0700198 //PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8*)pBd, ((tpHalBufDesc) pBd)->mpduDataOffset + frameLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700199
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -0800200 //Restore default failure timeout
201 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona && psessionEntry->defaultAuthFailureTimeout)
202 {
Abhishek Singhdb6e96e2013-12-30 14:16:10 +0530203 limLog(pMac, LOG1, FL("Restore default failure timeout"));
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -0800204 ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT ,
205 psessionEntry->defaultAuthFailureTimeout, NULL, eANI_BOOLEAN_FALSE);
206 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700207
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 Johnson295189b2012-06-20 16:38:30 -0700215 // 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 Koyyalamudi521ff192012-11-15 17:13:08 -0800223 pHdr->sa, psessionEntry, FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -0700224 return;
225 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700226
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 Singh208848c2013-12-18 19:02:52 +0530245 // 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 Johnson295189b2012-06-20 16:38:30 -0700250 limSendAuthMgmtFrame(pMac, &authFrame,
251 pHdr->sa,
252 LIM_NO_WEP_IN_FC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 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 Johnson295189b2012-06-20 16:38:30 -0700266 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
267 {
268 val = psessionEntry->privacy;
269 }
270 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 // 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 Lokere80007262013-03-18 19:45:50 -0700279 limLog(pMac, LOGP, FL("could not retrieve Privacy option"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 }
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 Singh208848c2013-12-18 19:02:52 +0530295 // 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 Johnson295189b2012-06-20 16:38:30 -0700301 /**
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 Johnson295189b2012-06-20 16:38:30 -0700316 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 Singh208848c2013-12-18 19:02:52 +0530331 // 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 Johnson295189b2012-06-20 16:38:30 -0700337 /**
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 Johnson295189b2012-06-20 16:38:30 -0700354 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 Singh208848c2013-12-18 19:02:52 +0530368 // 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 Johnson295189b2012-06-20 16:38:30 -0700374 /**
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 Johnson295189b2012-06-20 16:38:30 -0700389 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 Singh208848c2013-12-18 19:02:52 +0530401 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 Johnson295189b2012-06-20 16:38:30 -0700409 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 Johnson295189b2012-06-20 16:38:30 -0700422
423 return;
424 }
425
Abhishek Singh208848c2013-12-18 19:02:52 +0530426 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 Johnson295189b2012-06-20 16:38:30 -0700433 return;
Abhishek Singh208848c2013-12-18 19:02:52 +0530434 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700435
436
437 } // end if (pKeyMapEntry->key == NULL)
438 } // if keyMappings has entry
439 else
440 {
441
442 val = SIR_MAC_KEY_LENGTH;
443
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
445 {
446 tpSirKeys pKey;
447 pKey = &psessionEntry->WEPKeyMaterial[keyId].key[0];
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530448 vos_mem_copy(defaultKey, pKey->key, pKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 val = pKey->keyLength;
450 }
451 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 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 Lokere80007262013-03-18 19:45:50 -0700458 FL("could not retrieve Default key"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700459
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 Singh208848c2013-12-18 19:02:52 +0530487 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 Johnson295189b2012-06-20 16:38:30 -0700494 /// 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 Johnson295189b2012-06-20 16:38:30 -0700508 return;
509 }
Abhishek Singh208848c2013-12-18 19:02:52 +0530510 if ( ( sirConvertAuthFrame2Struct(pMac, plainBody, frameLen-8,
Abhishek Singhdb6e96e2013-12-30 14:16:10 +0530511 &rxAuthFrame)!=eSIR_SUCCESS ) ||
Abhishek Singh208848c2013-12-18 19:02:52 +0530512 ( !isAuthValid(pMac, &rxAuthFrame, psessionEntry) ) )
Abhishek Singhdb6e96e2013-12-30 14:16:10 +0530513 {
514 limLog(pMac, LOGE,
Abhishek Singh208848c2013-12-18 19:02:52 +0530515 FL("failed to convert Auth Frame to structure "
Abhishek Singhdb6e96e2013-12-30 14:16:10 +0530516 "or Auth is not valid "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 return;
Abhishek Singh208848c2013-12-18 19:02:52 +0530518 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 } // End of check for Key Mapping/Default key presence
520 }
521 else
522 {
Abhishek Singh208848c2013-12-18 19:02:52 +0530523 // 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 Johnson295189b2012-06-20 16:38:30 -0700528 /**
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 Johnson295189b2012-06-20 16:38:30 -0700547 return;
548 } // else if (wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED))
549 } // if (fc.wep)
550 else
551 {
552
553
Abhishek Singh208848c2013-12-18 19:02:52 +0530554 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 Johnson295189b2012-06-20 16:38:30 -0700561 return;
Abhishek Singh208848c2013-12-18 19:02:52 +0530562 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 }
564
565
566 pRxAuthFrameBody = &rxAuthFrame;
567
Mohit Khanna23863762012-09-11 17:40:09 -0700568 PELOGW(limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700569 FL("Received Auth frame with type=%d seqnum=%d, status=%d (%d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 (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 Koyyalamudia67d4332012-11-29 11:35:23 -0800578
579 pStaDs = dphLookupHashEntry(pMac, pHdr->sa,
580 &assocId, &psessionEntry->dph.dphHashTable);
581 if (pStaDs)
582 {
Abhishek Singhb1c829a2014-05-05 11:06:54 +0530583 tLimMlmDisassocReq *pMlmDisassocReq = NULL;
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -0800584 tLimMlmDeauthReq *pMlmDeauthReq = NULL;
Abhishek Singhb1c829a2014-05-05 11:06:54 +0530585 tAniBool isConnected = eSIR_TRUE;
586
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -0800587 pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq;
588 if (pMlmDisassocReq &&
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530589 (vos_mem_compare((tANI_U8 *) pHdr->sa,
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -0800590 (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530591 sizeof(tSirMacAddr))))
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -0800592 {
Arif Hussain24bafea2013-11-15 15:10:03 -0800593 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 Kohalli446de942013-07-24 18:20:02 -0700597 limProcessDisassocAckTimeout(pMac);
Abhishek Singhb1c829a2014-05-05 11:06:54 +0530598 isConnected = eSIR_FALSE;
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -0800599 }
600 pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq;
601 if (pMlmDeauthReq &&
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530602 (vos_mem_compare((tANI_U8 *) pHdr->sa,
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -0800603 (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
604 sizeof(tSirMacAddr))))
605 {
Arif Hussain24bafea2013-11-15 15:10:03 -0800606 PELOGE(limLog(pMac, LOGE, FL("TODO:Ack for deauth frame "
Sudhir Sattayappa Kohalli446de942013-07-24 18:20:02 -0700607 "is pending Issue delsta for "
Arif Hussain24bafea2013-11-15 15:10:03 -0800608 MAC_ADDRESS_STR),
609 MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr));)
Sudhir Sattayappa Kohalli446de942013-07-24 18:20:02 -0700610 limProcessDeauthAckTimeout(pMac);
Abhishek Singhb1c829a2014-05-05 11:06:54 +0530611 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 Singh13fbb1d2014-06-04 19:51:05 +0530616 * 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 Singhb1c829a2014-05-05 11:06:54 +0530623 */
Abhishek Singh13fbb1d2014-06-04 19:51:05 +0530624 if (isConnected
625#ifdef WLAN_FEATURE_11W
626 && !pStaDs->rmfEnabled
627#endif
628 )
Abhishek Singhb1c829a2014-05-05 11:06:54 +0530629 {
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 Koyyalamudia67d4332012-11-29 11:35:23 -0800639 }
640 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700641
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 Kaushikf9c963c2015-01-28 12:50:26 +0530647 if (pHdr->fc.retry == 0 || pAuthNode->seqNo != currSeqNo)
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 {
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 Singh208848c2013-12-18 19:02:52 +0530661 PELOGE(limLog(pMac, LOGE, FL("STA is initiating brand-new "
662 "Authentication ..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 limDeletePreAuthNode(pMac,
664 pHdr->sa);
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 /**
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 Medicharlaeef78fc2013-07-12 11:47:01 +0530681 if (vos_mem_compare((tANI_U8 *) &pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 (tANI_U8 *) &(pHdr->sa), (tANI_U8) (sizeof(tSirMacAddr))) )
683 break;
684 }
Edhar, Mahesh Kumar29013e82014-02-05 10:38:08 +0530685
686 pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 }
688
Abhishek Singhe9417492014-09-25 15:55:36 +0530689 if (NULL != pStaDs
690#ifdef WLAN_FEATURE_11W
691 && !pStaDs->rmfEnabled
692#endif
693 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 {
Abhishek Singh208848c2013-12-18 19:02:52 +0530695 PELOGE(limLog(pMac, LOGE, FL("lim Delete Station "
696 "Context (staId: %d, assocId: %d) "),pStaDs->staIndex,
697 assocId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 limSendDeauthMgmtFrame(pMac,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800699 eSIR_MAC_UNSPEC_FAILURE_REASON, (tANI_U8 *) pAuthNode->peerMacAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 limTriggerSTAdeletion(pMac, pStaDs, psessionEntry);
701 return;
702 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 }
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 Singh208848c2013-12-18 19:02:52 +0530711 PELOGE(limLog(pMac, LOGE, FL("STA is initiating "
712 "Authentication after ACK lost..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 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 Lokere80007262013-03-18 19:45:50 -0700724 FL("could not retrieve MaxNumPreAuth"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 }
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +0530726
727 if (pMac->lim.gLimNumPreAuthContexts == maxNumPreAuth &&
728 !limDeleteOpenAuthPreAuthNode(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 {
Abhishek Singh208848c2013-12-18 19:02:52 +0530730 PELOGE(limLog(pMac, LOGE, FL("Max number of "
731 "preauth context reached"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 /**
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 Johnson295189b2012-06-20 16:38:30 -0700751 if (limIsAuthAlgoSupported(
752 pMac,
753 (tAniAuthType)
754 pRxAuthFrameBody->authAlgoNumber, psessionEntry))
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 {
756 switch (pRxAuthFrameBody->authAlgoNumber)
757 {
758 case eSIR_OPEN_SYSTEM:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700759 PELOGW(limLog(pMac, LOGW, FL("=======> eSIR_OPEN_SYSTEM ..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 /// 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 Singh3cbf6052014-12-15 16:46:42 +0530772 limLog(pMac, LOG1,
773 FL("Alloc new data: peer "MAC_ADDRESS_STR),
774 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700775
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530776 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
777 pHdr->sa,
778 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700779
780 pAuthNode->mlmState =
781 eLIM_MLM_AUTHENTICATED_STATE;
782 pAuthNode->authType = (tAniAuthType)
783 pRxAuthFrameBody->authAlgoNumber;
784 pAuthNode->fSeen = 0;
785 pAuthNode->fTimerStarted = 0;
Sushant Kaushikf9c963c2015-01-28 12:50:26 +0530786 pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) |
787 (pHdr->seqControl.seqNumLo));
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +0530788 pAuthNode->timestamp = vos_timer_get_system_ticks();
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 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 Medicharlaeef78fc2013-07-12 11:47:01 +0530808 vos_mem_copy((tANI_U8 *) mlmAuthInd.peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 (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 Lokere80007262013-03-18 19:45:50 -0700821 PELOGW(limLog(pMac, LOGW, FL("=======> eSIR_SHARED_KEY ..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
823 {
824 val = psessionEntry->privacy;
825 }
826 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 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 Lokere80007262013-03-18 19:45:50 -0700835 FL("could not retrieve Privacy option"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 }
837 cfgPrivacyOptImp = (tANI_U8)val;
838 if (!cfgPrivacyOptImp)
839 {
Abhishek Singh208848c2013-12-18 19:02:52 +0530840 // 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 Johnson295189b2012-06-20 16:38:30 -0700846 /**
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 Johnson295189b2012-06-20 16:38:30 -0700866 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 Medicharlaeef78fc2013-07-12 11:47:01 +0530883 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
884 pHdr->sa,
885 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700886
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 Kaushikf9c963c2015-01-28 12:50:26 +0530894 pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) |
895 (pHdr->seqControl.seqNumLo));
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +0530896 pAuthNode->timestamp = vos_timer_get_system_ticks();
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 limAddPreAuthNode(pMac, pAuthNode);
898
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530899 limLog(pMac, LOG1,
900 FL("Alloc new data: id %d peer "MAC_ADDRESS_STR),
901 pAuthNode->authNodeIdx, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700902
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 Singh208848c2013-12-18 19:02:52 +0530941 limLog(pMac, LOGE,FL("Challenge text "
942 "preparation failed in limProcessAuthFrame"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700943 }
944
945 pChallenge = pAuthNode->challengeText;
946
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530947 vos_mem_copy(pChallenge,
948 (tANI_U8 *) challengeTextArray,
949 sizeof(challengeTextArray));
Jeff Johnson295189b2012-06-20 16:38:30 -0700950
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 Medicharlaeef78fc2013-07-12 11:47:01 +0530963 vos_mem_copy(authFrame.challengeText,
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 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 Singh208848c2013-12-18 19:02:52 +0530976 // 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 Johnson295189b2012-06-20 16:38:30 -0700983 /**
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 Johnson295189b2012-06-20 16:38:30 -07001003 return;
1004 } // end switch(pRxAuthFrameBody->authAlgoNumber)
1005 } // if (limIsAuthAlgoSupported(pRxAuthFrameBody->authAlgoNumber))
1006 else
1007 {
Abhishek Singh208848c2013-12-18 19:02:52 +05301008 // 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 Johnson295189b2012-06-20 16:38:30 -07001015 /**
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 Johnson295189b2012-06-20 16:38:30 -07001031 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 Singh3cbf6052014-12-15 16:46:42 +05301046 limLog(pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001047 FL("received Auth frame2 from peer in state %d, addr "),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301048 psessionEntry->limMlmState);
1049 limPrintMacAddr(pMac, pHdr->sa, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001050
1051 return;
1052 }
1053
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +05301054 if ( !vos_mem_compare((tANI_U8 *) pHdr->sa,
1055 (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr,
1056 sizeof(tSirMacAddr)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 {
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 Khanna23863762012-09-11 17:40:09 -07001065 PELOGW(limLog(pMac, LOGW,
Abhishek Singh208848c2013-12-18 19:02:52 +05301066 FL("received Auth frame2 from unexpected peer "
1067 MAC_ADDRESS_STR),
Mohit Khanna23863762012-09-11 17:40:09 -07001068 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001069
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 Khanna23863762012-09-11 17:40:09 -07001101 PELOGW(limLog(pMac, LOGW,
1102 FL("received Auth frame2 for unexpected auth algo number %d "
Abhishek Singh208848c2013-12-18 19:02:52 +05301103 MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber,
Mohit Khanna23863762012-09-11 17:40:09 -07001104 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001105
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 Singh3cbf6052014-12-15 16:46:42 +05301129 limLog(pMac, LOG1,
1130 FL("Alloc new data: peer "MAC_ADDRESS_STR),
1131 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001132
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +05301133 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 pMac->lim.gpLimMlmAuthReq->peerMacAddr,
1135 sizeof(tSirMacAddr));
1136 pAuthNode->fTimerStarted = 0;
1137 pAuthNode->authType = pMac->lim.gpLimMlmAuthReq->authType;
Sushant Kaushikf9c963c2015-01-28 12:50:26 +05301138 pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) |
1139 (pHdr->seqControl.seqNumLo));
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +05301140 pAuthNode->timestamp = vos_timer_get_system_ticks();
Jeff Johnson295189b2012-06-20 16:38:30 -07001141 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 Johnson295189b2012-06-20 16:38:30 -07001150 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1151 {
1152 val = psessionEntry->privacy;
1153 }
1154 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001155 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 Lokere80007262013-03-18 19:45:50 -07001163 FL("could not retrieve Privacy option"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 }
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 Khanna23863762012-09-11 17:40:09 -07001175 PELOGE( limLog(pMac, LOGE,
Abhishek Singh208848c2013-12-18 19:02:52 +05301176 FL("received Auth frame from peer for "
1177 "unsupported auth algo %d "
1178 MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber,
Mohit Khanna23863762012-09-11 17:40:09 -07001179 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001180
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 Khanna23863762012-09-11 17:40:09 -07001200 PELOGE(limLog(pMac, LOGE,
Abhishek Singh208848c2013-12-18 19:02:52 +05301201 FL("received Auth frame with invalid "
1202 "challenge text IE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001203
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 Singh208848c2013-12-18 19:02:52 +05301218 // 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 Johnson295189b2012-06-20 16:38:30 -07001224 /**
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 Johnson295189b2012-06-20 16:38:30 -07001240 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 Medicharlaeef78fc2013-07-12 11:47:01 +05301254 vos_mem_copy((tANI_U8 *) ((tpSirMacAuthFrameBody) plainBody)->challengeText,
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 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 Johnsone7245742012-09-05 17:12:55 -07001264 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001265
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 Lokere80007262013-03-18 19:45:50 -07001284 FL("could not retrieve Default keyId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 }
1286 keyId = (tANI_U8)val;
1287
1288 val = SIR_MAC_KEY_LENGTH;
1289
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1291 {
1292 tpSirKeys pKey;
1293 pKey = &psessionEntry->WEPKeyMaterial[keyId].key[0];
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +05301294 vos_mem_copy(defaultKey, pKey->key, pKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 }
1296 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 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 Lokere80007262013-03-18 19:45:50 -07001305 FL("could not retrieve Default key"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001306
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 Medicharlaeef78fc2013-07-12 11:47:01 +05301332 vos_mem_copy((tANI_U8 *) ((tpSirMacAuthFrameBody) plainBody)->challengeText,
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 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 Johnsone7245742012-09-05 17:12:55 -07001343 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001344
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 Khanna23863762012-09-11 17:40:09 -07001363 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 Johnson295189b2012-06-20 16:38:30 -07001367
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 Singh208848c2013-12-18 19:02:52 +05301379 // 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 Johnson295189b2012-06-20 16:38:30 -07001386 /**
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 Johnson295189b2012-06-20 16:38:30 -07001401 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 Singh208848c2013-12-18 19:02:52 +05301414 // 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 Johnson295189b2012-06-20 16:38:30 -07001420 /// 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 Johnson295189b2012-06-20 16:38:30 -07001431 return;
1432 }
1433
1434 pAuthNode = limSearchPreAuthList(pMac,
1435 pHdr->sa);
1436 if (pAuthNode == NULL)
1437 {
Abhishek Singh208848c2013-12-18 19:02:52 +05301438 // 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 Johnson295189b2012-06-20 16:38:30 -07001444 /**
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 Johnson295189b2012-06-20 16:38:30 -07001461 return;
1462 }
1463
1464 if (pAuthNode->mlmState == eLIM_MLM_AUTH_RSP_TIMEOUT_STATE)
1465 {
Abhishek Singh208848c2013-12-18 19:02:52 +05301466 // Log error
1467 limLog(pMac, LOGW,
Abhishek Singhdb6e96e2013-12-30 14:16:10 +05301468 FL("auth response timer timedout for peer "
1469 MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 /**
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 Johnson295189b2012-06-20 16:38:30 -07001486 /// 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 Khanna23863762012-09-11 17:40:09 -07001502 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 Johnson295189b2012-06-20 16:38:30 -07001506
1507 return;
1508 }
1509
1510 /**
1511 * Check if received challenge text is same as one sent in
1512 * Authentication frame3
1513 */
1514
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +05301515 if (vos_mem_compare(pRxAuthFrameBody->challengeText,
1516 pAuthNode->challengeText,
1517 SIR_MAC_AUTH_CHALLENGE_LENGTH))
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 {
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 Koyyalamudi1bed5982012-10-22 14:38:06 -07001534 SIR_MAC_AUTH_FRAME_4;
Jeff Johnson295189b2012-06-20 16:38:30 -07001535 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 Medicharlaeef78fc2013-07-12 11:47:01 +05301542 vos_mem_copy((tANI_U8 *) mlmAuthInd.peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001543 (tANI_U8 *) pHdr->sa,
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +05301544 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 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 Singh208848c2013-12-18 19:02:52 +05301557 // Log error
1558 PELOGE( limLog(pMac, LOGW,
1559 FL("Challenge failure for peer "
1560 MAC_ADDRESS_STR),
1561 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 /**
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 Koyyalamudi1bed5982012-10-22 14:38:06 -07001570 pRxAuthFrameBody->authAlgoNumber;
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 authFrame.authTransactionSeqNumber =
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07001572 SIR_MAC_AUTH_FRAME_4;
Jeff Johnson295189b2012-06-20 16:38:30 -07001573 authFrame.authStatusCode =
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07001574 eSIR_MAC_CHALLENGE_FAILURE_STATUS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001575
1576 limSendAuthMgmtFrame(pMac, &authFrame,
1577 pHdr->sa,
1578 LIM_NO_WEP_IN_FC,psessionEntry);
1579
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 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 Singh3cbf6052014-12-15 16:46:42 +05301596 limLog(pMac, LOG1,
Abhishek Singh208848c2013-12-18 19:02:52 +05301597 FL("received unexpected Auth frame4 from peer in state "
Abhishek Singhdb6e96e2013-12-30 14:16:10 +05301598 "%d, addr "MAC_ADDRESS_STR), psessionEntry->limMlmState,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301599 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001600
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 Khanna23863762012-09-11 17:40:09 -07001614 PELOGE(limLog(pMac, LOGE,
Abhishek Singh208848c2013-12-18 19:02:52 +05301615 FL("received Auth frame4 from peer with invalid auth "
1616 "algo %d "MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber,
Mohit Khanna23863762012-09-11 17:40:09 -07001617 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001618
1619 return;
1620 }
1621
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +05301622 if ( !vos_mem_compare((tANI_U8 *) pHdr->sa,
1623 (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr,
1624 sizeof(tSirMacAddr)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 {
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 Khanna23863762012-09-11 17:40:09 -07001633 PELOGE(limLog(pMac, LOGW,
1634 FL("received Auth frame4 from unexpected peer "
1635 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001636
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 Khanna23863762012-09-11 17:40:09 -07001649 PELOGE(limLog(pMac, LOGE,
Abhishek Singh208848c2013-12-18 19:02:52 +05301650 FL("received Authentication frame from peer with "
1651 "invalid auth seq number %d "
1652 MAC_ADDRESS_STR), pRxAuthFrameBody->authTransactionSeqNumber,
Mohit Khanna23863762012-09-11 17:40:09 -07001653 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001654
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 Singh3cbf6052014-12-15 16:46:42 +05301677 limLog(pMac, LOG1,
1678 FL("Alloc new data: peer " MAC_ADDRESS_STR),
1679 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001680
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +05301681 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 pMac->lim.gpLimMlmAuthReq->peerMacAddr,
1683 sizeof(tSirMacAddr));
1684 pAuthNode->fTimerStarted = 0;
1685 pAuthNode->authType = pMac->lim.gpLimMlmAuthReq->authType;
Sushant Kaushikf9c963c2015-01-28 12:50:26 +05301686 pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) |
1687 (pHdr->seqControl.seqNumLo));
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +05301688 pAuthNode->timestamp = vos_timer_get_system_ticks();
Jeff Johnson295189b2012-06-20 16:38:30 -07001689 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 Khanna23863762012-09-11 17:40:09 -07001703 PELOGE(limLog(pMac, LOGE, FL("Authentication failure from peer "
1704 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001705
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 Khanna23863762012-09-11 17:40:09 -07001716 PELOGE(limLog(pMac, LOGE,
Abhishek Singh208848c2013-12-18 19:02:52 +05301717 FL("received Auth frame from peer with invalid auth seq "
1718 "number %d " MAC_ADDRESS_STR),
1719 pRxAuthFrameBody->authTransactionSeqNumber,
Mohit Khanna23863762012-09-11 17:40:09 -07001720 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001721
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 Kuppaa3ed0a32013-02-20 07:24:43 -08001743tSirRetStatus limProcessAuthFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd, void *body)
Jeff Johnson295189b2012-06-20 16:38:30 -07001744{
1745 tpSirMacMgmtHdr pHdr;
1746 tpPESession psessionEntry = NULL;
1747 tANI_U8 *pBody;
1748 tANI_U16 frameLen;
1749 tSirMacAuthFrameBody rxAuthFrame;
1750 tSirMacAuthFrameBody *pRxAuthFrameBody = NULL;
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001751 tSirRetStatus ret_status = eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001752
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 Singhdb6e96e2013-12-30 14:16:10 +05301757 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 Johnson295189b2012-06-20 16:38:30 -07001760 // 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 Singh208848c2013-12-18 19:02:52 +05301764 limLog(pMac, LOGE, FL("Error: Unable to find session id while in "
1765 "pre-auth phase for FT"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 return eSIR_FAILURE;
1767 }
1768
1769 if (pMac->ft.ftPEContext.pFTPreAuthReq == NULL)
1770 {
Abhishek Singh208848c2013-12-18 19:02:52 +05301771 limLog(pMac, LOGE, FL("Error: No FT"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 // No FT in progress.
1773 return eSIR_FAILURE;
1774 }
1775
1776 if (frameLen == 0)
1777 {
Abhishek Singh208848c2013-12-18 19:02:52 +05301778 limLog(pMac, LOGE, FL("Error: Frame len = 0"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001779 return eSIR_FAILURE;
1780 }
1781#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001782 limPrintMacAddr(pMac, pHdr->bssId, LOG2);
1783 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOG2);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001784 limLog(pMac,LOG2,FL("seqControl 0x%X"),
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07001785 ((pHdr->seqControl.seqNumHi << 8) |
1786 (pHdr->seqControl.seqNumLo << 4) |
1787 (pHdr->seqControl.fragNum)));
Jeff Johnson295189b2012-06-20 16:38:30 -07001788#endif
1789
1790 // Check that its the same bssId we have for preAuth
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +05301791 if (!vos_mem_compare(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
1792 pHdr->bssId, sizeof( tSirMacAddr )))
Jeff Johnson295189b2012-06-20 16:38:30 -07001793 {
Abhishek Singhdb6e96e2013-12-30 14:16:10 +05301794 limLog(pMac, LOGE, FL("Error: NOT same bssid as preauth BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001795 // In this case SME if indeed has triggered a
1796 // pre auth it will time out.
1797 return eSIR_FAILURE;
1798 }
1799
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07001800 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 Yeturuf68abd62013-02-11 14:05:06 -08001820 PELOGE(limLog(pMac,LOG1,"Auth rsp already posted to SME"
1821 " (session %p, FT session %p)", psessionEntry,
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07001822 pMac->ft.ftPEContext.pftSessionEntry););
1823 return eSIR_SUCCESS;
1824 }
1825 else
1826 {
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001827 PELOGE(limLog(pMac,LOGW,"Auth rsp not yet posted to SME"
1828 " (session %p, FT session %p)", psessionEntry,
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07001829 pMac->ft.ftPEContext.pftSessionEntry););
1830 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1831 eANI_BOOLEAN_TRUE;
1832 }
1833
Jeff Johnson295189b2012-06-20 16:38:30 -07001834#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001835 limLog(pMac, LOG1, FL("Pre-Auth response received from neighbor"));
1836 limLog(pMac, LOG1, FL("Pre-Auth done state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001837#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 Singhdb6e96e2013-12-30 14:16:10 +05301846 limLog(pMac, LOGE, FL("failed to convert Auth frame to struct"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 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 Yeturuf68abd62013-02-11 14:05:06 -08001853 PELOGE(limLog(pMac, LOG1,
1854 FL("Received Auth frame with type=%d seqnum=%d, status=%d (%d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 (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 Kuppaa3ed0a32013-02-20 07:24:43 -08001866 PELOGE(limLog( pMac, LOGE, "Auth status code received is %d",
1867 (tANI_U32) pRxAuthFrameBody->authStatusCode););
Jeff Johnson295189b2012-06-20 16:38:30 -07001868#endif
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001869 if (eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS == pRxAuthFrameBody->authStatusCode)
1870 ret_status = eSIR_LIM_MAX_STA_REACHED_ERROR;
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 }
1872 else
1873 {
1874 ret_status = eSIR_SUCCESS;
1875 }
1876 break;
1877
1878 default:
1879#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001880 PELOGE(limLog( pMac, LOGE, "Seq. no incorrect expected 2 received %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 (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