blob: 2c78011ce2fece3b288b798ceabe8dade3392594 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
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"
39
40
41
42/**
43 * limProcessDeauthFrame
44 *
45 *FUNCTION:
46 * This function is called by limProcessMessageQueue() upon
47 * Deauthentication frame reception.
48 *
49 *LOGIC:
50 *
51 *ASSUMPTIONS:
52 *
53 *NOTE:
54 *
55 * @param pMac - Pointer to Global MAC structure
56 * @param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs
57 * @return None
58 */
59
60void
61limProcessDeauthFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
62{
63 tANI_U8 *pBody;
64 tANI_U16 aid, reasonCode;
65 tpSirMacMgmtHdr pHdr;
66 tLimMlmAssocCnf mlmAssocCnf;
67 tLimMlmDeauthInd mlmDeauthInd;
68 tpDphHashNode pStaDs;
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -080069 tpPESession pRoamSessionEntry=NULL;
70 tANI_U8 roamSessionId;
Chet Lanctot186b5732013-03-18 10:26:30 -070071#ifdef WLAN_FEATURE_11W
72 tANI_U32 frameLen;
73#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070074
75
76 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
77
78 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
79
80
81 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) && (eLIM_SME_WT_DEAUTH_STATE == psessionEntry->limSmeState))
82 {
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +053083 /*Every 15th deauth frame will be logged in kmsg*/
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -070084 if(!(pMac->lim.deauthMsgCnt & 0xF))
85 {
86 PELOGE(limLog(pMac, LOGE,
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +053087 FL("received Deauth frame in DEAUTH_WT_STATE"
Abhishek Singh6f9d2c82013-12-24 15:29:53 +053088 "(already processing previously received DEAUTH frame).."
89 "Dropping this.. Deauth Failed %d"),++pMac->lim.deauthMsgCnt);)
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -070090 }
91 else
92 {
93 pMac->lim.deauthMsgCnt++;
94 }
Madan Mohan Koyyalamudi69c94a12013-07-10 16:34:45 +053095 return;
Jeff Johnson295189b2012-06-20 16:38:30 -070096 }
97
98 if (limIsGroupAddr(pHdr->sa))
99 {
100 // Received Deauth frame from a BC/MC address
101 // Log error and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530102 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700103 FL("received Deauth frame from a BC/MC address"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
105 return;
106 }
107
108 if (limIsGroupAddr(pHdr->da) && !limIsAddrBC(pHdr->da))
109 {
110 // Received Deauth frame for a MC address
111 // Log error and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530112 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700113 FL("received Deauth frame for a MC address"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700114
115 return;
116 }
Chet Lanctot186b5732013-03-18 10:26:30 -0700117
118#ifdef WLAN_FEATURE_11W
119 /* PMF: If this session is a PMF session, then ensure that this frame was protected */
120 if(psessionEntry->limRmfEnabled && (WDA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) & DPU_FEEDBACK_UNPROTECTED_ERROR))
121 {
122 PELOGE(limLog(pMac, LOGE, FL("received an unprotected deauth from AP"));)
123 // If the frame received is unprotected, forward it to the supplicant to initiate
124 // an SA query
125 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
126
127 //send the unprotected frame indication to SME
128 limSendSmeUnprotectedMgmtFrameInd( pMac, pHdr->fc.subType,
129 (tANI_U8*)pHdr, (frameLen + sizeof(tSirMacMgmtHdr)),
130 psessionEntry->smeSessionId, psessionEntry);
131 return;
132 }
133#endif
134
Jeff Johnson295189b2012-06-20 16:38:30 -0700135 // Get reasonCode from Deauthentication frame body
Kiet Lamaa8e15a2014-02-11 23:30:06 -0800136 reasonCode = sirReadU16(pBody);
Jeff Johnson295189b2012-06-20 16:38:30 -0700137
138 PELOGE(limLog(pMac, LOGE,
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530139 FL("Received Deauth frame for Addr: "MAC_ADDRESS_STR" (mlm state = %s,"
140 " sme state = %d systemrole = %d) with reason code %d from "
141 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->da),
142 limMlmStateStr(psessionEntry->limMlmState), psessionEntry->limSmeState,
143 psessionEntry->limSystemRole, reasonCode,
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530144 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700145
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -0800146 if (limCheckDisassocDeauthAckPending(pMac, (tANI_U8*)pHdr->sa))
147 {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530148 PELOGE(limLog(pMac, LOGE,
149 FL("Ignore the Deauth received, while waiting for ack of "
150 "disassoc/deauth"));)
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -0800151 limCleanUpDisassocDeauthReq(pMac,(tANI_U8*)pHdr->sa, 1);
152 return;
153 }
154
155
Jeff Johnson295189b2012-06-20 16:38:30 -0700156 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
157 {
158 switch (reasonCode)
159 {
160 case eSIR_MAC_UNSPEC_FAILURE_REASON:
161 case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
162 // Valid reasonCode in received Deauthentication frame
163 break;
164
165 default:
166 // Invalid reasonCode in received Deauthentication frame
167 // Log error and ignore the frame
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530168 PELOGE(limLog(pMac, LOGE,
169 FL("received Deauth frame with invalid reasonCode %d from "
170 MAC_ADDRESS_STR), reasonCode, MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700171
172 break;
173 }
174 }
175 else if (psessionEntry->limSystemRole == eLIM_STA_ROLE ||psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
176 {
177 switch (reasonCode)
178 {
179 case eSIR_MAC_UNSPEC_FAILURE_REASON:
180 case eSIR_MAC_PREV_AUTH_NOT_VALID_REASON:
181 case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
182 case eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON:
183 case eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON:
184 case eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON:
185 // Valid reasonCode in received Deauth frame
186 break;
187
188 default:
189 // Invalid reasonCode in received Deauth frame
190 // Log error and ignore the frame
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530191 PELOGE(limLog(pMac, LOGE,
192 FL("received Deauth frame with invalid reasonCode %d from "
193 MAC_ADDRESS_STR), reasonCode, MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700194
195 break;
196 }
197 }
198 else
199 {
200 // Received Deauth frame in either IBSS
Srinivas Girigowdac03c5a82013-07-01 13:44:54 -0700201 // or un-known role. Log and ignore it
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530202 limLog(pMac, LOGE,
203 FL("received Deauth frame with reasonCode %d in role %d from "
204 MAC_ADDRESS_STR),reasonCode, psessionEntry->limSystemRole,
205 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700206
207 return;
208 }
209
210 /** If we are in the middle of ReAssoc, a few things could happen:
211 * - STA is reassociating to current AP, and receives deauth from:
212 * a) current AP
213 * b) other AP
214 * - STA is reassociating to a new AP, and receives deauth from:
215 * c) current AP
216 * d) reassoc AP
217 * e) other AP
218 *
219 * The logic is:
220 * 1) If rcv deauth from an AP other than the one we're trying to
221 * reassociate with, then drop the deauth frame (case b, c, e)
222 * 2) If rcv deauth from the "new" reassoc AP (case d), then restore
223 * context with previous AP and send SME_REASSOC_RSP failure.
224 * 3) If rcv deauth from the reassoc AP, which is also the same
225 * AP we're currently associated with (case a), then proceed
226 * with normal deauth processing.
227 */
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800228 if ( psessionEntry->limReAssocbssId!=NULL )
229 {
230 pRoamSessionEntry = peFindSessionByBssid(pMac, psessionEntry->limReAssocbssId, &roamSessionId);
231 }
232 if (limIsReassocInProgress(pMac,psessionEntry) || limIsReassocInProgress(pMac,pRoamSessionEntry)) {
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 if (!IS_REASSOC_BSSID(pMac,pHdr->sa,psessionEntry)) {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530234 PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from unknown/different "
235 "AP while ReAssoc. Ignore "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));)
236 PELOGE(limLog(pMac, LOGE, FL(" limReAssocbssId : "MAC_ADDRESS_STR),
237 MAC_ADDR_ARRAY(psessionEntry->limReAssocbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 return;
239 }
240
241 /** Received deauth from the new AP to which we tried to ReAssociate.
242 * Drop ReAssoc and Restore the Previous context( current connected AP).
243 */
244 if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry)) {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530245 PELOGE(limLog(pMac, LOGE, FL("received DeAuth from the New AP to "
246 "which ReAssoc is sent "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));)
247 PELOGE(limLog(pMac, LOGE, FL(" psessionEntry->bssId: "MAC_ADDRESS_STR),
248 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700249 limRestorePreReassocState(pMac,
250 eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
251 return;
252 }
253 }
254
255
256 /* If received DeAuth from AP other than the one we're trying to join with
257 * nor associated with, then ignore deauth and delete Pre-auth entry.
258 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 if(psessionEntry->limSystemRole != eLIM_AP_ROLE ){
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800260 if (!IS_CURRENT_BSSID(pMac, pHdr->bssId, psessionEntry))
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 {
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530262 PELOGE(limLog(pMac, LOGE, FL("received DeAuth from an AP other "
263 "than we're trying to join. Ignore. "MAC_ADDRESS_STR),
264 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 if (limSearchPreAuthList(pMac, pHdr->sa))
266 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530267 limLog(pMac, LOG1, FL("Preauth entry exist. "
268 "Deleting... "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 limDeletePreAuthNode(pMac, pHdr->sa);
270 }
271 return;
272 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700274
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800275 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
276
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 // Check for pre-assoc states
278 switch (psessionEntry->limSystemRole)
279 {
280 case eLIM_STA_ROLE:
281 case eLIM_BT_AMP_STA_ROLE:
282 switch (psessionEntry->limMlmState)
283 {
284 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
285 /**
286 * AP sent Deauth frame while waiting
287 * for Auth frame2. Report Auth failure
288 * to SME.
289 */
290
291 // Log error
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530292 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530293 FL("received Deauth frame state %d with failure "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530294 "code %d from "MAC_ADDRESS_STR),
295 psessionEntry->limMlmState, reasonCode,
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530296 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700297
298 limRestoreFromAuthState(pMac, eSIR_SME_DEAUTH_WHILE_JOIN,
299 reasonCode,psessionEntry);
300
301 return;
302
303 case eLIM_MLM_AUTHENTICATED_STATE:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530304 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530305 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530306 "reasonCode=%d from "MAC_ADDRESS_STR),
307 psessionEntry->limMlmState, reasonCode,
308 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 /// Issue Deauth Indication to SME.
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530310 vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
311 pHdr->sa,
312 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 mlmDeauthInd.reasonCode = reasonCode;
314
315 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700316 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700317
318
319 limPostSmeMessage(pMac,
320 LIM_MLM_DEAUTH_IND,
321 (tANI_U32 *) &mlmDeauthInd);
322 return;
323
324 case eLIM_MLM_WT_ASSOC_RSP_STATE:
325 /**
326 * AP may have 'aged-out' our Pre-auth
327 * context. Delete local pre-auth context
328 * if any and issue ASSOC_CNF to SME.
329 */
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530330 limLog(pMac, LOG1,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530331 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530332 "reasonCode=%d from "MAC_ADDRESS_STR),
333 psessionEntry->limMlmState, reasonCode,
334 MAC_ADDR_ARRAY(pHdr->sa));
335 if (limSearchPreAuthList(pMac, pHdr->sa))
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 limDeletePreAuthNode(pMac, pHdr->sa);
337
338 if (psessionEntry->pLimMlmJoinReq)
339 {
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530340 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 psessionEntry->pLimMlmJoinReq = NULL;
342 }
343
344 mlmAssocCnf.resultCode = eSIR_SME_DEAUTH_WHILE_JOIN;
345 mlmAssocCnf.protStatusCode = reasonCode;
346
347 /* PE session Id*/
348 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
349
350 psessionEntry->limMlmState =
351 psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700352 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700353
354 // Deactive Association response timeout
355 limDeactivateAndChangeTimer(
356 pMac,
357 eLIM_ASSOC_FAIL_TIMER);
358
359 limPostSmeMessage(
360 pMac,
361 LIM_MLM_ASSOC_CNF,
362 (tANI_U32 *) &mlmAssocCnf);
363
364 return;
365
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +0530366 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
367 psessionEntry->fDeauthReceived = true;
368 PELOGW(limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530369 FL("Received Deauth frame in state %d with Reason "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530370 "Code %d from Peer"MAC_ADDRESS_STR),
371 psessionEntry->limMlmState, reasonCode,
372 MAC_ADDR_ARRAY(pHdr->sa));)
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +0530373 return ;
374
Jeff Johnson295189b2012-06-20 16:38:30 -0700375 case eLIM_MLM_IDLE_STATE:
376 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800377#ifdef FEATURE_WLAN_TDLS
378 if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType))
379 {
380 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530381 FL("received Deauth frame in state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530382 "reason code %d from Tdls peer"
383 MAC_ADDRESS_STR),
384 psessionEntry->limMlmState,reasonCode,
385 MAC_ADDR_ARRAY(pHdr->sa));)
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800386 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
387 reasonCode);
388 return;
389 }
390 else
391 {
Gopichand Nakkala78a6c812013-05-13 16:39:49 +0530392
393 limDeleteTDLSPeers(pMac, psessionEntry);
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800394#endif
395 /**
396 * This could be Deauthentication frame from
397 * a BSS with which pre-authentication was
398 * performed. Delete Pre-auth entry if found.
399 */
400 if (limSearchPreAuthList(pMac, pHdr->sa))
401 limDeletePreAuthNode(pMac, pHdr->sa);
402#ifdef FEATURE_WLAN_TDLS
403 }
404#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 break;
406
407 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530408 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530409 FL("received Deauth frame state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530410 "reasonCode=%d from "MAC_ADDRESS_STR),
411 psessionEntry->limMlmState, reasonCode,
412 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 break;
414
415 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700416 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530417 FL("received Deauth frame in FT state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530418 "reasonCode=%d from "MAC_ADDRESS_STR),
419 psessionEntry->limMlmState, reasonCode,
420 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 break;
422
423 default:
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530424 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530425 FL("received Deauth frame in state %d with "
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530426 "reasonCode=%d from "MAC_ADDRESS_STR),
427 psessionEntry->limMlmState, reasonCode,
428 MAC_ADDR_ARRAY(pHdr->sa));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 return;
430 }
431 break;
432
433 case eLIM_STA_IN_IBSS_ROLE:
434 break;
435
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 case eLIM_AP_ROLE:
437 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700438
439 default: // eLIM_AP_ROLE or eLIM_BT_AMP_AP_ROLE
440
Jeff Johnson295189b2012-06-20 16:38:30 -0700441
442 return;
443 } // end switch (pMac->lim.gLimSystemRole)
444
445
446
447 /**
448 * Extract 'associated' context for STA, if any.
449 * This is maintained by DPH and created by LIM.
450 */
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800451 if (NULL == pStaDs)
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530452 {
453 limLog(pMac, LOGE, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 return;
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530455 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
457 if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
Sushant Kaushikefe08fa2015-07-06 14:54:09 +0530458 (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 {
460 /**
461 * Already in the process of deleting context for the peer
462 * and received Deauthentication frame. Log and Ignore.
463 */
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530464 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530465 FL("received Deauth frame from peer that is in state %d, addr "
Sachin Ahuja60a50612015-04-20 17:55:08 +0530466 MAC_ADDRESS_STR", isDisassocDeauthInProgress : %d\n"),
467 pStaDs->mlmStaContext.mlmState,MAC_ADDR_ARRAY(pHdr->sa),
468 pStaDs->isDisassocDeauthInProgress);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 return;
470 }
471 pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)reasonCode;
472 pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DEAUTH;
473
474 /// Issue Deauth Indication to SME.
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530475 vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 pStaDs->staAddr,
477 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
479 mlmDeauthInd.deauthTrigger = eLIM_PEER_ENTITY_DEAUTH;
480
481
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700482 /*
483 * If we're in the middle of ReAssoc and received deauth from
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 * the ReAssoc AP, then notify SME by sending REASSOC_RSP with
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700485 * failure result code. SME will post the disconnect to the
486 * supplicant and the latter would start a fresh assoc.
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 */
488 if (limIsReassocInProgress(pMac,psessionEntry)) {
489 /**
490 * AP may have 'aged-out' our Pre-auth
491 * context. Delete local pre-auth context
492 * if any and issue REASSOC_CNF to SME.
493 */
494 if (limSearchPreAuthList(pMac, pHdr->sa))
495 limDeletePreAuthNode(pMac, pHdr->sa);
496
497 if (psessionEntry->limAssocResponseData) {
Hema Aparna Medicharlaeef78fc2013-07-12 11:47:01 +0530498 vos_mem_free(psessionEntry->limAssocResponseData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 psessionEntry->limAssocResponseData = NULL;
500 }
501
Abhishek Singh6f9d2c82013-12-24 15:29:53 +0530502 PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from ReAssoc AP. "
503 "Issue REASSOC_CNF. "));)
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -0700504 /*
505 * TODO: Instead of overloading eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE
506 * it would have been good to define/use a different failure type.
507 * Using eSIR_SME_FT_REASSOC_FAILURE does not seem to clean-up
508 * properly and we end up seeing "transmit queue timeout".
509 */
510 limPostReassocFailure(pMac, eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE,
511 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 return;
513 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -0700514 /* reset the deauthMsgCnt here since we are able to Process
515 * the deauth frame and sending up the indication as well */
516 if(pMac->lim.deauthMsgCnt != 0)
517 {
518 pMac->lim.deauthMsgCnt = 0;
519 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 /// Deauthentication from peer MAC entity
521 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
522
523 // send eWNI_SME_DEAUTH_IND to SME
524 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
525 return;
526
527} /*** end limProcessDeauthFrame() ***/
528