blob: d4ea763107cec7ca26b52100cc76629373192af7 [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#ifdef WLAN_FEATURE_11W
75 tANI_U32 frameLen;
76#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78
79 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
80
81 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
82
Hanumanth Reddy Pothulaf4b44992017-11-23 15:26:28 +053083 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
84 ((eLIM_SME_WT_DISASSOC_STATE == psessionEntry->limSmeState) ||
85 (eLIM_SME_WT_DEAUTH_STATE == psessionEntry->limSmeState)))
Jeff Johnson295189b2012-06-20 16:38:30 -070086 {
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +053087 /*Every 15th deauth frame will be logged in kmsg*/
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -070088 if(!(pMac->lim.deauthMsgCnt & 0xF))
89 {
90 PELOGE(limLog(pMac, LOGE,
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +053091 FL("received Deauth frame in DEAUTH_WT_STATE"
Abhishek Singh6f9d2c82013-12-24 15:29:53 +053092 "(already processing previously received DEAUTH frame).."
93 "Dropping this.. Deauth Failed %d"),++pMac->lim.deauthMsgCnt);)
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -070094 }
95 else
96 {
97 pMac->lim.deauthMsgCnt++;
98 }
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +053099 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700100 }
101
102 if (limIsGroupAddr(pHdr->sa))
103 {
104 // Received Deauth frame from a BC/MC address
105 // Log error and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530106 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700107 FL("received Deauth frame from a BC/MC address"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700108
109 return;
110 }
111
112 if (limIsGroupAddr(pHdr->da) && !limIsAddrBC(pHdr->da))
113 {
114 // Received Deauth frame for a MC address
115 // Log error and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530116 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700117 FL("received Deauth frame for a MC address"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700118
119 return;
120 }
Chet Lanctot186b5732013-03-18 10:26:30 -0700121
122#ifdef WLAN_FEATURE_11W
123 /* PMF: If this session is a PMF session, then ensure that this frame was protected */
124 if(psessionEntry->limRmfEnabled && (WDA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) & DPU_FEEDBACK_UNPROTECTED_ERROR))
125 {
126 PELOGE(limLog(pMac, LOGE, FL("received an unprotected deauth from AP"));)
127 // If the frame received is unprotected, forward it to the supplicant to initiate
128 // an SA query
129 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
130
131 //send the unprotected frame indication to SME
132 limSendSmeUnprotectedMgmtFrameInd( pMac, pHdr->fc.subType,
133 (tANI_U8*)pHdr, (frameLen + sizeof(tSirMacMgmtHdr)),
134 psessionEntry->smeSessionId, psessionEntry);
135 return;
136 }
137#endif
138
Jeff Johnson295189b2012-06-20 16:38:30 -0700139 // Get reasonCode from Deauthentication frame body
Kiet Lamaa8e15a2014-02-11 23:30:06 -0800140 reasonCode = sirReadU16(pBody);
Jeff Johnson295189b2012-06-20 16:38:30 -0700141
142 PELOGE(limLog(pMac, LOGE,
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530143 FL("Received Deauth frame for Addr: "MAC_ADDRESS_STR" (mlm state = %s,"
144 " sme state = %d systemrole = %d) with reason code %d from "
145 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->da),
146 limMlmStateStr(psessionEntry->limMlmState), psessionEntry->limSmeState,
147 psessionEntry->limSystemRole, reasonCode,
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530148 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700149
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -0800150 if (limCheckDisassocDeauthAckPending(pMac, (tANI_U8*)pHdr->sa))
151 {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530152 PELOGE(limLog(pMac, LOGE,
153 FL("Ignore the Deauth received, while waiting for ack of "
154 "disassoc/deauth"));)
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -0800155 limCleanUpDisassocDeauthReq(pMac,(tANI_U8*)pHdr->sa, 1);
156 return;
157 }
158
159
Jeff Johnson295189b2012-06-20 16:38:30 -0700160 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
161 {
162 switch (reasonCode)
163 {
164 case eSIR_MAC_UNSPEC_FAILURE_REASON:
165 case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
166 // Valid reasonCode in received Deauthentication frame
167 break;
168
169 default:
170 // Invalid reasonCode in received Deauthentication frame
171 // Log error and ignore the frame
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530172 PELOGE(limLog(pMac, LOGE,
173 FL("received Deauth frame with invalid reasonCode %d from "
174 MAC_ADDRESS_STR), reasonCode, MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700175
176 break;
177 }
178 }
179 else if (psessionEntry->limSystemRole == eLIM_STA_ROLE ||psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
180 {
181 switch (reasonCode)
182 {
183 case eSIR_MAC_UNSPEC_FAILURE_REASON:
184 case eSIR_MAC_PREV_AUTH_NOT_VALID_REASON:
185 case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
186 case eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON:
187 case eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON:
188 case eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON:
189 // Valid reasonCode in received Deauth frame
190 break;
191
192 default:
193 // Invalid reasonCode in received Deauth frame
194 // Log error and ignore the frame
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530195 PELOGE(limLog(pMac, LOGE,
196 FL("received Deauth frame with invalid reasonCode %d from "
197 MAC_ADDRESS_STR), reasonCode, MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700198
199 break;
200 }
201 }
202 else
203 {
204 // Received Deauth frame in either IBSS
Srinivas Girigowdac03c5a82013-07-01 13:44:54 -0700205 // or un-known role. Log and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530206 limLog(pMac, LOGE,
207 FL("received Deauth frame with reasonCode %d in role %d from "
208 MAC_ADDRESS_STR),reasonCode, psessionEntry->limSystemRole,
209 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700210
211 return;
212 }
213
214 /** If we are in the middle of ReAssoc, a few things could happen:
215 * - STA is reassociating to current AP, and receives deauth from:
216 * a) current AP
217 * b) other AP
218 * - STA is reassociating to a new AP, and receives deauth from:
219 * c) current AP
220 * d) reassoc AP
221 * e) other AP
222 *
223 * The logic is:
224 * 1) If rcv deauth from an AP other than the one we're trying to
225 * reassociate with, then drop the deauth frame (case b, c, e)
226 * 2) If rcv deauth from the "new" reassoc AP (case d), then restore
227 * context with previous AP and send SME_REASSOC_RSP failure.
228 * 3) If rcv deauth from the reassoc AP, which is also the same
229 * AP we're currently associated with (case a), then proceed
230 * with normal deauth processing.
231 */
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800232 if ( psessionEntry->limReAssocbssId!=NULL )
233 {
234 pRoamSessionEntry = peFindSessionByBssid(pMac, psessionEntry->limReAssocbssId, &roamSessionId);
235 }
Padma, Santhosh Kumar071de2d2017-02-02 20:38:03 +0530236
237#ifdef WLAN_FEATURE_LFR_MBB
238 if (lim_is_mbb_reassoc_in_progress(pMac, psessionEntry)) {
239 limLog(pMac, LOGE, FL("Ignore Deauth frame as LFR MBB in progress"));
240 return;
241 }
242#endif
243
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800244 if (limIsReassocInProgress(pMac,psessionEntry) || limIsReassocInProgress(pMac,pRoamSessionEntry)) {
Jeff Johnson295189b2012-06-20 16:38:30 -0700245 if (!IS_REASSOC_BSSID(pMac,pHdr->sa,psessionEntry)) {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530246 PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from unknown/different "
247 "AP while ReAssoc. Ignore "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));)
248 PELOGE(limLog(pMac, LOGE, FL(" limReAssocbssId : "MAC_ADDRESS_STR),
249 MAC_ADDR_ARRAY(psessionEntry->limReAssocbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700250 return;
251 }
252
253 /** Received deauth from the new AP to which we tried to ReAssociate.
254 * Drop ReAssoc and Restore the Previous context( current connected AP).
255 */
256 if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry)) {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530257 PELOGE(limLog(pMac, LOGE, FL("received DeAuth from the New AP to "
258 "which ReAssoc is sent "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));)
259 PELOGE(limLog(pMac, LOGE, FL(" psessionEntry->bssId: "MAC_ADDRESS_STR),
260 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 limRestorePreReassocState(pMac,
262 eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
263 return;
264 }
265 }
266
267
268 /* If received DeAuth from AP other than the one we're trying to join with
269 * nor associated with, then ignore deauth and delete Pre-auth entry.
270 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 if(psessionEntry->limSystemRole != eLIM_AP_ROLE ){
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800272 if (!IS_CURRENT_BSSID(pMac, pHdr->bssId, psessionEntry))
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530274 PELOGE(limLog(pMac, LOGE, FL("received DeAuth from an AP other "
275 "than we're trying to join. Ignore. "MAC_ADDRESS_STR),
276 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 if (limSearchPreAuthList(pMac, pHdr->sa))
278 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530279 limLog(pMac, LOG1, FL("Preauth entry exist. "
280 "Deleting... "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 limDeletePreAuthNode(pMac, pHdr->sa);
282 }
283 return;
284 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700286
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800287 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
288
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 // Check for pre-assoc states
290 switch (psessionEntry->limSystemRole)
291 {
292 case eLIM_STA_ROLE:
293 case eLIM_BT_AMP_STA_ROLE:
294 switch (psessionEntry->limMlmState)
295 {
296 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
297 /**
298 * AP sent Deauth frame while waiting
299 * for Auth frame2. Report Auth failure
300 * to SME.
301 */
302
303 // Log error
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530304 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530305 FL("received Deauth frame state %d with failure "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530306 "code %d from "MAC_ADDRESS_STR),
307 psessionEntry->limMlmState, reasonCode,
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530308 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700309
310 limRestoreFromAuthState(pMac, eSIR_SME_DEAUTH_WHILE_JOIN,
311 reasonCode,psessionEntry);
312
313 return;
314
315 case eLIM_MLM_AUTHENTICATED_STATE:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530316 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530317 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530318 "reasonCode=%d from "MAC_ADDRESS_STR),
319 psessionEntry->limMlmState, reasonCode,
320 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 /// Issue Deauth Indication to SME.
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530322 vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
323 pHdr->sa,
324 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 mlmDeauthInd.reasonCode = reasonCode;
326
327 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700328 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700329
330
331 limPostSmeMessage(pMac,
332 LIM_MLM_DEAUTH_IND,
333 (tANI_U32 *) &mlmDeauthInd);
334 return;
335
336 case eLIM_MLM_WT_ASSOC_RSP_STATE:
337 /**
338 * AP may have 'aged-out' our Pre-auth
339 * context. Delete local pre-auth context
340 * if any and issue ASSOC_CNF to SME.
341 */
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530342 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530343 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530344 "reasonCode=%d from "MAC_ADDRESS_STR),
345 psessionEntry->limMlmState, reasonCode,
346 MAC_ADDR_ARRAY(pHdr->sa));
347 if (limSearchPreAuthList(pMac, pHdr->sa))
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 limDeletePreAuthNode(pMac, pHdr->sa);
349
350 if (psessionEntry->pLimMlmJoinReq)
351 {
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530352 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 psessionEntry->pLimMlmJoinReq = NULL;
354 }
355
356 mlmAssocCnf.resultCode = eSIR_SME_DEAUTH_WHILE_JOIN;
357 mlmAssocCnf.protStatusCode = reasonCode;
358
359 /* PE session Id*/
360 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
361
362 psessionEntry->limMlmState =
363 psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700364 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700365
366 // Deactive Association response timeout
367 limDeactivateAndChangeTimer(
368 pMac,
369 eLIM_ASSOC_FAIL_TIMER);
370
371 limPostSmeMessage(
372 pMac,
373 LIM_MLM_ASSOC_CNF,
374 (tANI_U32 *) &mlmAssocCnf);
375
376 return;
377
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +0530378 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
379 psessionEntry->fDeauthReceived = true;
380 PELOGW(limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530381 FL("Received Deauth frame in state %d with Reason "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530382 "Code %d from Peer"MAC_ADDRESS_STR),
383 psessionEntry->limMlmState, reasonCode,
384 MAC_ADDR_ARRAY(pHdr->sa));)
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +0530385 return ;
386
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 case eLIM_MLM_IDLE_STATE:
388 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800389#ifdef FEATURE_WLAN_TDLS
390 if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType))
391 {
392 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530393 FL("received Deauth frame in state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530394 "reason code %d from Tdls peer"
395 MAC_ADDRESS_STR),
396 psessionEntry->limMlmState,reasonCode,
397 MAC_ADDR_ARRAY(pHdr->sa));)
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800398 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
399 reasonCode);
400 return;
401 }
402 else
403 {
Gopichand Nakkala78a6c812013-05-13 16:39:49 +0530404
405 limDeleteTDLSPeers(pMac, psessionEntry);
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800406#endif
407 /**
408 * This could be Deauthentication frame from
409 * a BSS with which pre-authentication was
410 * performed. Delete Pre-auth entry if found.
411 */
412 if (limSearchPreAuthList(pMac, pHdr->sa))
413 limDeletePreAuthNode(pMac, pHdr->sa);
414#ifdef FEATURE_WLAN_TDLS
415 }
416#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 break;
418
419 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530420 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530421 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530422 "reasonCode=%d from "MAC_ADDRESS_STR),
423 psessionEntry->limMlmState, reasonCode,
424 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 break;
426
427 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700428 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530429 FL("received Deauth frame in FT state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530430 "reasonCode=%d from "MAC_ADDRESS_STR),
431 psessionEntry->limMlmState, reasonCode,
432 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 break;
434
435 default:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530436 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530437 FL("received Deauth frame in state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530438 "reasonCode=%d from "MAC_ADDRESS_STR),
439 psessionEntry->limMlmState, reasonCode,
440 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 return;
442 }
443 break;
444
445 case eLIM_STA_IN_IBSS_ROLE:
446 break;
447
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 case eLIM_AP_ROLE:
449 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700450
451 default: // eLIM_AP_ROLE or eLIM_BT_AMP_AP_ROLE
452
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
454 return;
455 } // end switch (pMac->lim.gLimSystemRole)
456
457
458
459 /**
460 * Extract 'associated' context for STA, if any.
461 * This is maintained by DPH and created by LIM.
462 */
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800463 if (NULL == pStaDs)
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530464 {
465 limLog(pMac, LOGE, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 return;
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530467 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700468
469 if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
Sushant Kaushikefe08fa2015-07-06 14:54:09 +0530470 (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 {
472 /**
473 * Already in the process of deleting context for the peer
474 * and received Deauthentication frame. Log and Ignore.
475 */
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530476 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530477 FL("received Deauth frame from peer that is in state %d, addr "
Sachin Ahuja60a50612015-04-20 17:55:08 +0530478 MAC_ADDRESS_STR", isDisassocDeauthInProgress : %d\n"),
479 pStaDs->mlmStaContext.mlmState,MAC_ADDR_ARRAY(pHdr->sa),
480 pStaDs->isDisassocDeauthInProgress);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 return;
482 }
483 pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)reasonCode;
484 pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DEAUTH;
485
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530486
487 /* send the LOST_LINK_PARAMS_IND to SME*/
488 limUpdateLostLinkParams(pMac, psessionEntry, pRxPacketInfo);
489
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 /// Issue Deauth Indication to SME.
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530491 vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 pStaDs->staAddr,
493 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
495 mlmDeauthInd.deauthTrigger = eLIM_PEER_ENTITY_DEAUTH;
496
497
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700498 /*
499 * If we're in the middle of ReAssoc and received deauth from
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 * the ReAssoc AP, then notify SME by sending REASSOC_RSP with
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700501 * failure result code. SME will post the disconnect to the
502 * supplicant and the latter would start a fresh assoc.
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 */
504 if (limIsReassocInProgress(pMac,psessionEntry)) {
505 /**
506 * AP may have 'aged-out' our Pre-auth
507 * context. Delete local pre-auth context
508 * if any and issue REASSOC_CNF to SME.
509 */
510 if (limSearchPreAuthList(pMac, pHdr->sa))
511 limDeletePreAuthNode(pMac, pHdr->sa);
512
513 if (psessionEntry->limAssocResponseData) {
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530514 vos_mem_free(psessionEntry->limAssocResponseData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 psessionEntry->limAssocResponseData = NULL;
516 }
517
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530518 PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from ReAssoc AP. "
519 "Issue REASSOC_CNF. "));)
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700520 /*
521 * TODO: Instead of overloading eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE
522 * it would have been good to define/use a different failure type.
523 * Using eSIR_SME_FT_REASSOC_FAILURE does not seem to clean-up
524 * properly and we end up seeing "transmit queue timeout".
525 */
526 limPostReassocFailure(pMac, eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE,
527 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 return;
529 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -0700530 /* reset the deauthMsgCnt here since we are able to Process
531 * the deauth frame and sending up the indication as well */
532 if(pMac->lim.deauthMsgCnt != 0)
533 {
534 pMac->lim.deauthMsgCnt = 0;
535 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 /// Deauthentication from peer MAC entity
537 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
538
539 // send eWNI_SME_DEAUTH_IND to SME
540 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
541 return;
542
543} /*** end limProcessDeauthFrame() ***/
544