blob: 49d5651a2ad300e9a95d6f42a9b807d6c08f5924 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Padma, Santhosh Kumar071de2d2017-02-02 20:38:03 +05302 * Copyright (c) 2012-2014, 2017 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.
Kiet Lamaa8e15a2014-02-11 23:30:06 -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
Jeff Johnson295189b2012-06-20 16:38:30 -070028#include "palTypes.h"
29#include "aniGlobal.h"
30
31#include "utilsApi.h"
32#include "limTypes.h"
33#include "limUtils.h"
34#include "limAssocUtils.h"
35#include "limSecurityUtils.h"
36#include "limSerDesUtils.h"
37#include "schApi.h"
38#include "limSendMessages.h"
Padma, Santhosh Kumar071de2d2017-02-02 20:38:03 +053039#ifdef WLAN_FEATURE_LFR_MBB
40#include "lim_mbb.h"
41#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070042
43
44
45/**
46 * limProcessDeauthFrame
47 *
48 *FUNCTION:
49 * This function is called by limProcessMessageQueue() upon
50 * Deauthentication frame reception.
51 *
52 *LOGIC:
53 *
54 *ASSUMPTIONS:
55 *
56 *NOTE:
57 *
58 * @param pMac - Pointer to Global MAC structure
59 * @param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs
60 * @return None
61 */
62
63void
64limProcessDeauthFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
65{
66 tANI_U8 *pBody;
67 tANI_U16 aid, reasonCode;
68 tpSirMacMgmtHdr pHdr;
69 tLimMlmAssocCnf mlmAssocCnf;
70 tLimMlmDeauthInd mlmDeauthInd;
71 tpDphHashNode pStaDs;
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -080072 tpPESession pRoamSessionEntry=NULL;
73 tANI_U8 roamSessionId;
Chet Lanctot186b5732013-03-18 10:26:30 -070074 tANI_U32 frameLen;
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
77
78 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
79
gaurank kathpaliab0f95f52018-10-30 13:13:03 +053080 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
81 if (frameLen < sizeof(reasonCode)) {
82 PELOGE(limLog(pMac, LOGE,
83 FL("received invalid framelen %d"), frameLen);)
84 return;
85 }
86
Hanumanth Reddy Pothulaf4b44992017-11-23 15:26:28 +053087 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
88 ((eLIM_SME_WT_DISASSOC_STATE == psessionEntry->limSmeState) ||
89 (eLIM_SME_WT_DEAUTH_STATE == psessionEntry->limSmeState)))
Jeff Johnson295189b2012-06-20 16:38:30 -070090 {
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +053091 /*Every 15th deauth frame will be logged in kmsg*/
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -070092 if(!(pMac->lim.deauthMsgCnt & 0xF))
93 {
94 PELOGE(limLog(pMac, LOGE,
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +053095 FL("received Deauth frame in DEAUTH_WT_STATE"
Abhishek Singh6f9d2c82013-12-24 15:29:53 +053096 "(already processing previously received DEAUTH frame).."
97 "Dropping this.. Deauth Failed %d"),++pMac->lim.deauthMsgCnt);)
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -070098 }
99 else
100 {
101 pMac->lim.deauthMsgCnt++;
102 }
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +0530103 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700104 }
105
106 if (limIsGroupAddr(pHdr->sa))
107 {
108 // Received Deauth frame from a BC/MC address
109 // Log error and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530110 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700111 FL("received Deauth frame from a BC/MC address"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700112
113 return;
114 }
115
116 if (limIsGroupAddr(pHdr->da) && !limIsAddrBC(pHdr->da))
117 {
118 // Received Deauth frame for a MC address
119 // Log error and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530120 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700121 FL("received Deauth frame for a MC address"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700122
123 return;
124 }
Chet Lanctot186b5732013-03-18 10:26:30 -0700125
126#ifdef WLAN_FEATURE_11W
127 /* PMF: If this session is a PMF session, then ensure that this frame was protected */
128 if(psessionEntry->limRmfEnabled && (WDA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) & DPU_FEEDBACK_UNPROTECTED_ERROR))
129 {
130 PELOGE(limLog(pMac, LOGE, FL("received an unprotected deauth from AP"));)
131 // If the frame received is unprotected, forward it to the supplicant to initiate
132 // an SA query
Chet Lanctot186b5732013-03-18 10:26:30 -0700133
134 //send the unprotected frame indication to SME
135 limSendSmeUnprotectedMgmtFrameInd( pMac, pHdr->fc.subType,
136 (tANI_U8*)pHdr, (frameLen + sizeof(tSirMacMgmtHdr)),
137 psessionEntry->smeSessionId, psessionEntry);
138 return;
139 }
140#endif
141
Jeff Johnson295189b2012-06-20 16:38:30 -0700142 // Get reasonCode from Deauthentication frame body
Kiet Lamaa8e15a2014-02-11 23:30:06 -0800143 reasonCode = sirReadU16(pBody);
Jeff Johnson295189b2012-06-20 16:38:30 -0700144
145 PELOGE(limLog(pMac, LOGE,
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530146 FL("Received Deauth frame for Addr: "MAC_ADDRESS_STR" (mlm state = %s,"
147 " sme state = %d systemrole = %d) with reason code %d from "
148 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->da),
149 limMlmStateStr(psessionEntry->limMlmState), psessionEntry->limSmeState,
150 psessionEntry->limSystemRole, reasonCode,
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530151 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700152
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -0800153 if (limCheckDisassocDeauthAckPending(pMac, (tANI_U8*)pHdr->sa))
154 {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530155 PELOGE(limLog(pMac, LOGE,
156 FL("Ignore the Deauth received, while waiting for ack of "
157 "disassoc/deauth"));)
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -0800158 limCleanUpDisassocDeauthReq(pMac,(tANI_U8*)pHdr->sa, 1);
159 return;
160 }
161
162
Jeff Johnson295189b2012-06-20 16:38:30 -0700163 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
164 {
165 switch (reasonCode)
166 {
167 case eSIR_MAC_UNSPEC_FAILURE_REASON:
168 case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
169 // Valid reasonCode in received Deauthentication frame
170 break;
171
172 default:
173 // Invalid reasonCode in received Deauthentication frame
174 // Log error and ignore the frame
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530175 PELOGE(limLog(pMac, LOGE,
176 FL("received Deauth frame with invalid reasonCode %d from "
177 MAC_ADDRESS_STR), reasonCode, MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700178
179 break;
180 }
181 }
182 else if (psessionEntry->limSystemRole == eLIM_STA_ROLE ||psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
183 {
184 switch (reasonCode)
185 {
186 case eSIR_MAC_UNSPEC_FAILURE_REASON:
187 case eSIR_MAC_PREV_AUTH_NOT_VALID_REASON:
188 case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
189 case eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON:
190 case eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON:
191 case eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON:
192 // Valid reasonCode in received Deauth frame
193 break;
194
195 default:
196 // Invalid reasonCode in received Deauth frame
197 // Log error and ignore the frame
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530198 PELOGE(limLog(pMac, LOGE,
199 FL("received Deauth frame with invalid reasonCode %d from "
200 MAC_ADDRESS_STR), reasonCode, MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700201
202 break;
203 }
204 }
205 else
206 {
207 // Received Deauth frame in either IBSS
Srinivas Girigowdac03c5a82013-07-01 13:44:54 -0700208 // or un-known role. Log and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530209 limLog(pMac, LOGE,
210 FL("received Deauth frame with reasonCode %d in role %d from "
211 MAC_ADDRESS_STR),reasonCode, psessionEntry->limSystemRole,
212 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700213
214 return;
215 }
216
217 /** If we are in the middle of ReAssoc, a few things could happen:
218 * - STA is reassociating to current AP, and receives deauth from:
219 * a) current AP
220 * b) other AP
221 * - STA is reassociating to a new AP, and receives deauth from:
222 * c) current AP
223 * d) reassoc AP
224 * e) other AP
225 *
226 * The logic is:
227 * 1) If rcv deauth from an AP other than the one we're trying to
228 * reassociate with, then drop the deauth frame (case b, c, e)
229 * 2) If rcv deauth from the "new" reassoc AP (case d), then restore
230 * context with previous AP and send SME_REASSOC_RSP failure.
231 * 3) If rcv deauth from the reassoc AP, which is also the same
232 * AP we're currently associated with (case a), then proceed
233 * with normal deauth processing.
234 */
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800235 if ( psessionEntry->limReAssocbssId!=NULL )
236 {
237 pRoamSessionEntry = peFindSessionByBssid(pMac, psessionEntry->limReAssocbssId, &roamSessionId);
238 }
Padma, Santhosh Kumar071de2d2017-02-02 20:38:03 +0530239
240#ifdef WLAN_FEATURE_LFR_MBB
241 if (lim_is_mbb_reassoc_in_progress(pMac, psessionEntry)) {
242 limLog(pMac, LOGE, FL("Ignore Deauth frame as LFR MBB in progress"));
243 return;
244 }
245#endif
246
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800247 if (limIsReassocInProgress(pMac,psessionEntry) || limIsReassocInProgress(pMac,pRoamSessionEntry)) {
Jeff Johnson295189b2012-06-20 16:38:30 -0700248 if (!IS_REASSOC_BSSID(pMac,pHdr->sa,psessionEntry)) {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530249 PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from unknown/different "
250 "AP while ReAssoc. Ignore "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));)
251 PELOGE(limLog(pMac, LOGE, FL(" limReAssocbssId : "MAC_ADDRESS_STR),
252 MAC_ADDR_ARRAY(psessionEntry->limReAssocbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 return;
254 }
255
256 /** Received deauth from the new AP to which we tried to ReAssociate.
257 * Drop ReAssoc and Restore the Previous context( current connected AP).
258 */
259 if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry)) {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530260 PELOGE(limLog(pMac, LOGE, FL("received DeAuth from the New AP to "
261 "which ReAssoc is sent "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));)
262 PELOGE(limLog(pMac, LOGE, FL(" psessionEntry->bssId: "MAC_ADDRESS_STR),
263 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700264 limRestorePreReassocState(pMac,
265 eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
266 return;
267 }
268 }
269
270
271 /* If received DeAuth from AP other than the one we're trying to join with
272 * nor associated with, then ignore deauth and delete Pre-auth entry.
273 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 if(psessionEntry->limSystemRole != eLIM_AP_ROLE ){
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800275 if (!IS_CURRENT_BSSID(pMac, pHdr->bssId, psessionEntry))
Jeff Johnson295189b2012-06-20 16:38:30 -0700276 {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530277 PELOGE(limLog(pMac, LOGE, FL("received DeAuth from an AP other "
278 "than we're trying to join. Ignore. "MAC_ADDRESS_STR),
279 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 if (limSearchPreAuthList(pMac, pHdr->sa))
281 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530282 limLog(pMac, LOG1, FL("Preauth entry exist. "
283 "Deleting... "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700284 limDeletePreAuthNode(pMac, pHdr->sa);
285 }
286 return;
287 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700289
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800290 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
291
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 // Check for pre-assoc states
293 switch (psessionEntry->limSystemRole)
294 {
295 case eLIM_STA_ROLE:
296 case eLIM_BT_AMP_STA_ROLE:
297 switch (psessionEntry->limMlmState)
298 {
299 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
300 /**
301 * AP sent Deauth frame while waiting
302 * for Auth frame2. Report Auth failure
303 * to SME.
304 */
305
306 // Log error
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530307 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530308 FL("received Deauth frame state %d with failure "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530309 "code %d from "MAC_ADDRESS_STR),
310 psessionEntry->limMlmState, reasonCode,
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530311 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700312
313 limRestoreFromAuthState(pMac, eSIR_SME_DEAUTH_WHILE_JOIN,
314 reasonCode,psessionEntry);
315
316 return;
317
318 case eLIM_MLM_AUTHENTICATED_STATE:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530319 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530320 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530321 "reasonCode=%d from "MAC_ADDRESS_STR),
322 psessionEntry->limMlmState, reasonCode,
323 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 /// Issue Deauth Indication to SME.
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530325 vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
326 pHdr->sa,
327 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 mlmDeauthInd.reasonCode = reasonCode;
329
330 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700331 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700332
333
334 limPostSmeMessage(pMac,
335 LIM_MLM_DEAUTH_IND,
336 (tANI_U32 *) &mlmDeauthInd);
337 return;
338
339 case eLIM_MLM_WT_ASSOC_RSP_STATE:
340 /**
341 * AP may have 'aged-out' our Pre-auth
342 * context. Delete local pre-auth context
343 * if any and issue ASSOC_CNF to SME.
344 */
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530345 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530346 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530347 "reasonCode=%d from "MAC_ADDRESS_STR),
348 psessionEntry->limMlmState, reasonCode,
349 MAC_ADDR_ARRAY(pHdr->sa));
350 if (limSearchPreAuthList(pMac, pHdr->sa))
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 limDeletePreAuthNode(pMac, pHdr->sa);
352
353 if (psessionEntry->pLimMlmJoinReq)
354 {
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530355 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 psessionEntry->pLimMlmJoinReq = NULL;
357 }
358
359 mlmAssocCnf.resultCode = eSIR_SME_DEAUTH_WHILE_JOIN;
360 mlmAssocCnf.protStatusCode = reasonCode;
361
362 /* PE session Id*/
363 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
364
365 psessionEntry->limMlmState =
366 psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700367 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700368
369 // Deactive Association response timeout
370 limDeactivateAndChangeTimer(
371 pMac,
372 eLIM_ASSOC_FAIL_TIMER);
373
374 limPostSmeMessage(
375 pMac,
376 LIM_MLM_ASSOC_CNF,
377 (tANI_U32 *) &mlmAssocCnf);
378
379 return;
380
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +0530381 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
382 psessionEntry->fDeauthReceived = true;
383 PELOGW(limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530384 FL("Received Deauth frame in state %d with Reason "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530385 "Code %d from Peer"MAC_ADDRESS_STR),
386 psessionEntry->limMlmState, reasonCode,
387 MAC_ADDR_ARRAY(pHdr->sa));)
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +0530388 return ;
389
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 case eLIM_MLM_IDLE_STATE:
391 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800392#ifdef FEATURE_WLAN_TDLS
393 if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType))
394 {
395 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530396 FL("received Deauth frame in state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530397 "reason code %d from Tdls peer"
398 MAC_ADDRESS_STR),
399 psessionEntry->limMlmState,reasonCode,
400 MAC_ADDR_ARRAY(pHdr->sa));)
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800401 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
402 reasonCode);
403 return;
404 }
405 else
406 {
Gopichand Nakkala78a6c812013-05-13 16:39:49 +0530407
408 limDeleteTDLSPeers(pMac, psessionEntry);
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800409#endif
410 /**
411 * This could be Deauthentication frame from
412 * a BSS with which pre-authentication was
413 * performed. Delete Pre-auth entry if found.
414 */
415 if (limSearchPreAuthList(pMac, pHdr->sa))
416 limDeletePreAuthNode(pMac, pHdr->sa);
417#ifdef FEATURE_WLAN_TDLS
418 }
419#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 break;
421
422 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530423 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530424 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530425 "reasonCode=%d from "MAC_ADDRESS_STR),
426 psessionEntry->limMlmState, reasonCode,
427 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 break;
429
430 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700431 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530432 FL("received Deauth frame in FT state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530433 "reasonCode=%d from "MAC_ADDRESS_STR),
434 psessionEntry->limMlmState, reasonCode,
435 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 break;
437
438 default:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530439 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530440 FL("received Deauth frame in state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530441 "reasonCode=%d from "MAC_ADDRESS_STR),
442 psessionEntry->limMlmState, reasonCode,
443 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 return;
445 }
446 break;
447
448 case eLIM_STA_IN_IBSS_ROLE:
449 break;
450
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 case eLIM_AP_ROLE:
452 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
454 default: // eLIM_AP_ROLE or eLIM_BT_AMP_AP_ROLE
455
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
457 return;
458 } // end switch (pMac->lim.gLimSystemRole)
459
460
461
462 /**
463 * Extract 'associated' context for STA, if any.
464 * This is maintained by DPH and created by LIM.
465 */
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800466 if (NULL == pStaDs)
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530467 {
468 limLog(pMac, LOGE, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 return;
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530470 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700471
472 if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
Pankaj Singh84fe6732020-01-14 20:27:47 +0530473 (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE) ||
474 pStaDs->sta_deletion_in_progress)
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 {
476 /**
477 * Already in the process of deleting context for the peer
478 * and received Deauthentication frame. Log and Ignore.
479 */
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530480 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530481 FL("received Deauth frame from peer that is in state %d, addr "
Sachin Ahuja60a50612015-04-20 17:55:08 +0530482 MAC_ADDRESS_STR", isDisassocDeauthInProgress : %d\n"),
Pankaj Singh84fe6732020-01-14 20:27:47 +0530483
Sachin Ahuja60a50612015-04-20 17:55:08 +0530484 pStaDs->mlmStaContext.mlmState,MAC_ADDR_ARRAY(pHdr->sa),
485 pStaDs->isDisassocDeauthInProgress);)
Pankaj Singh84fe6732020-01-14 20:27:47 +0530486
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 return;
488 }
489 pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)reasonCode;
490 pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DEAUTH;
Pankaj Singh84fe6732020-01-14 20:27:47 +0530491 pStaDs->sta_deletion_in_progress = true;
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530492
493 /* send the LOST_LINK_PARAMS_IND to SME*/
494 limUpdateLostLinkParams(pMac, psessionEntry, pRxPacketInfo);
495
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 /// Issue Deauth Indication to SME.
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530497 vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 pStaDs->staAddr,
499 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
501 mlmDeauthInd.deauthTrigger = eLIM_PEER_ENTITY_DEAUTH;
502
503
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700504 /*
505 * If we're in the middle of ReAssoc and received deauth from
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 * the ReAssoc AP, then notify SME by sending REASSOC_RSP with
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700507 * failure result code. SME will post the disconnect to the
508 * supplicant and the latter would start a fresh assoc.
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 */
510 if (limIsReassocInProgress(pMac,psessionEntry)) {
511 /**
512 * AP may have 'aged-out' our Pre-auth
513 * context. Delete local pre-auth context
514 * if any and issue REASSOC_CNF to SME.
515 */
516 if (limSearchPreAuthList(pMac, pHdr->sa))
517 limDeletePreAuthNode(pMac, pHdr->sa);
518
519 if (psessionEntry->limAssocResponseData) {
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530520 vos_mem_free(psessionEntry->limAssocResponseData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 psessionEntry->limAssocResponseData = NULL;
522 }
523
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530524 PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from ReAssoc AP. "
525 "Issue REASSOC_CNF. "));)
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700526 /*
527 * TODO: Instead of overloading eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE
528 * it would have been good to define/use a different failure type.
529 * Using eSIR_SME_FT_REASSOC_FAILURE does not seem to clean-up
530 * properly and we end up seeing "transmit queue timeout".
531 */
532 limPostReassocFailure(pMac, eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE,
533 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 return;
535 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -0700536 /* reset the deauthMsgCnt here since we are able to Process
537 * the deauth frame and sending up the indication as well */
538 if(pMac->lim.deauthMsgCnt != 0)
539 {
540 pMac->lim.deauthMsgCnt = 0;
541 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 /// Deauthentication from peer MAC entity
543 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
544
545 // send eWNI_SME_DEAUTH_IND to SME
546 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
547 return;
548
549} /*** end limProcessDeauthFrame() ***/
550