Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, 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. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /* |
| 43 | * |
| 44 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 45 | * This file limProcessDeauthFrame.cc contains the code |
| 46 | * for processing Deauthentication Frame. |
| 47 | * Author: Chandra Modumudi |
| 48 | * Date: 03/24/02 |
| 49 | * History:- |
| 50 | * Date Modified by Modification Information |
| 51 | * -------------------------------------------------------------------- |
| 52 | * |
| 53 | */ |
| 54 | #include "palTypes.h" |
| 55 | #include "aniGlobal.h" |
| 56 | |
| 57 | #include "utilsApi.h" |
| 58 | #include "limTypes.h" |
| 59 | #include "limUtils.h" |
| 60 | #include "limAssocUtils.h" |
| 61 | #include "limSecurityUtils.h" |
| 62 | #include "limSerDesUtils.h" |
| 63 | #include "schApi.h" |
| 64 | #include "limSendMessages.h" |
| 65 | |
| 66 | |
| 67 | |
| 68 | /** |
| 69 | * limProcessDeauthFrame |
| 70 | * |
| 71 | *FUNCTION: |
| 72 | * This function is called by limProcessMessageQueue() upon |
| 73 | * Deauthentication frame reception. |
| 74 | * |
| 75 | *LOGIC: |
| 76 | * |
| 77 | *ASSUMPTIONS: |
| 78 | * |
| 79 | *NOTE: |
| 80 | * |
| 81 | * @param pMac - Pointer to Global MAC structure |
| 82 | * @param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs |
| 83 | * @return None |
| 84 | */ |
| 85 | |
| 86 | void |
| 87 | limProcessDeauthFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry) |
| 88 | { |
| 89 | tANI_U8 *pBody; |
| 90 | tANI_U16 aid, reasonCode; |
| 91 | tpSirMacMgmtHdr pHdr; |
| 92 | tLimMlmAssocCnf mlmAssocCnf; |
| 93 | tLimMlmDeauthInd mlmDeauthInd; |
| 94 | tpDphHashNode pStaDs; |
Dhanashri Atre | af3e84d | 2013-01-18 18:03:06 -0800 | [diff] [blame] | 95 | tpPESession pRoamSessionEntry=NULL; |
| 96 | tANI_U8 roamSessionId; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 97 | #ifdef WLAN_FEATURE_11W |
| 98 | tANI_U32 frameLen; |
| 99 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 100 | |
| 101 | |
| 102 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 103 | |
| 104 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 105 | |
| 106 | |
| 107 | if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) && (eLIM_SME_WT_DEAUTH_STATE == psessionEntry->limSmeState)) |
| 108 | { |
| 109 | PELOGE(limLog(pMac, LOGE, |
| 110 | FL("received Deauth frame in DEAUTH_WT_STATE(already processing previously received DEAUTH frame).. Dropping this..\n "));) |
| 111 | return; |
| 112 | } |
| 113 | |
| 114 | if (limIsGroupAddr(pHdr->sa)) |
| 115 | { |
| 116 | // Received Deauth frame from a BC/MC address |
| 117 | // Log error and ignore it |
| 118 | PELOG1(limLog(pMac, LOG1, |
| 119 | FL("received Deauth frame from a BC/MC address\n"));) |
| 120 | |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | if (limIsGroupAddr(pHdr->da) && !limIsAddrBC(pHdr->da)) |
| 125 | { |
| 126 | // Received Deauth frame for a MC address |
| 127 | // Log error and ignore it |
| 128 | PELOG1(limLog(pMac, LOG1, |
| 129 | FL("received Deauth frame for a MC address\n"));) |
| 130 | |
| 131 | return; |
| 132 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 133 | |
| 134 | #ifdef WLAN_FEATURE_11W |
| 135 | /* PMF: If this session is a PMF session, then ensure that this frame was protected */ |
| 136 | if(psessionEntry->limRmfEnabled && (WDA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) & DPU_FEEDBACK_UNPROTECTED_ERROR)) |
| 137 | { |
| 138 | PELOGE(limLog(pMac, LOGE, FL("received an unprotected deauth from AP"));) |
| 139 | // If the frame received is unprotected, forward it to the supplicant to initiate |
| 140 | // an SA query |
| 141 | frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 142 | |
| 143 | //send the unprotected frame indication to SME |
| 144 | limSendSmeUnprotectedMgmtFrameInd( pMac, pHdr->fc.subType, |
| 145 | (tANI_U8*)pHdr, (frameLen + sizeof(tSirMacMgmtHdr)), |
| 146 | psessionEntry->smeSessionId, psessionEntry); |
| 147 | return; |
| 148 | } |
| 149 | #endif |
| 150 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 151 | // Get reasonCode from Deauthentication frame body |
| 152 | reasonCode = sirReadU16(pBody); |
| 153 | |
| 154 | PELOGE(limLog(pMac, LOGE, |
| 155 | FL("received Deauth frame (mlm state = %s) with reason code %d from "), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 156 | limMlmStateStr(psessionEntry->limMlmState), reasonCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 157 | limPrintMacAddr(pMac, pHdr->sa, LOGE);) |
| 158 | |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 159 | if (limCheckDisassocDeauthAckPending(pMac, (tANI_U8*)pHdr->sa)) |
| 160 | { |
| 161 | PELOGW(limLog(pMac, LOGE, |
| 162 | FL("Ignore the Deauth received, while waiting for ack of disassoc/deauth\n"));) |
| 163 | limCleanUpDisassocDeauthReq(pMac,(tANI_U8*)pHdr->sa, 1); |
| 164 | return; |
| 165 | } |
| 166 | |
| 167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 168 | if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 169 | { |
| 170 | switch (reasonCode) |
| 171 | { |
| 172 | case eSIR_MAC_UNSPEC_FAILURE_REASON: |
| 173 | case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON: |
| 174 | // Valid reasonCode in received Deauthentication frame |
| 175 | break; |
| 176 | |
| 177 | default: |
| 178 | // Invalid reasonCode in received Deauthentication frame |
| 179 | // Log error and ignore the frame |
| 180 | PELOG1(limLog(pMac, LOG1, |
| 181 | FL("received Deauth frame with invalid reasonCode %d from \n"), |
| 182 | reasonCode); |
| 183 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 184 | |
| 185 | break; |
| 186 | } |
| 187 | } |
| 188 | else if (psessionEntry->limSystemRole == eLIM_STA_ROLE ||psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) |
| 189 | { |
| 190 | switch (reasonCode) |
| 191 | { |
| 192 | case eSIR_MAC_UNSPEC_FAILURE_REASON: |
| 193 | case eSIR_MAC_PREV_AUTH_NOT_VALID_REASON: |
| 194 | case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON: |
| 195 | case eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON: |
| 196 | case eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON: |
| 197 | case eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON: |
| 198 | // Valid reasonCode in received Deauth frame |
| 199 | break; |
| 200 | |
| 201 | default: |
| 202 | // Invalid reasonCode in received Deauth frame |
| 203 | // Log error and ignore the frame |
| 204 | PELOG1(limLog(pMac, LOG1, |
| 205 | FL("received Deauth frame with invalid reasonCode %d from \n"), |
| 206 | reasonCode); |
| 207 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 208 | |
| 209 | break; |
| 210 | } |
| 211 | } |
| 212 | else |
| 213 | { |
| 214 | // Received Deauth frame in either IBSS |
| 215 | // or un-known role. Log error and ignore it |
| 216 | limLog(pMac, LOGE, |
| 217 | FL("received Deauth frame with reasonCode %d in role %d from \n"), |
| 218 | reasonCode, psessionEntry->limSystemRole); |
| 219 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 220 | |
| 221 | return; |
| 222 | } |
| 223 | |
| 224 | /** If we are in the middle of ReAssoc, a few things could happen: |
| 225 | * - STA is reassociating to current AP, and receives deauth from: |
| 226 | * a) current AP |
| 227 | * b) other AP |
| 228 | * - STA is reassociating to a new AP, and receives deauth from: |
| 229 | * c) current AP |
| 230 | * d) reassoc AP |
| 231 | * e) other AP |
| 232 | * |
| 233 | * The logic is: |
| 234 | * 1) If rcv deauth from an AP other than the one we're trying to |
| 235 | * reassociate with, then drop the deauth frame (case b, c, e) |
| 236 | * 2) If rcv deauth from the "new" reassoc AP (case d), then restore |
| 237 | * context with previous AP and send SME_REASSOC_RSP failure. |
| 238 | * 3) If rcv deauth from the reassoc AP, which is also the same |
| 239 | * AP we're currently associated with (case a), then proceed |
| 240 | * with normal deauth processing. |
| 241 | */ |
Dhanashri Atre | af3e84d | 2013-01-18 18:03:06 -0800 | [diff] [blame] | 242 | if ( psessionEntry->limReAssocbssId!=NULL ) |
| 243 | { |
| 244 | pRoamSessionEntry = peFindSessionByBssid(pMac, psessionEntry->limReAssocbssId, &roamSessionId); |
| 245 | } |
| 246 | if (limIsReassocInProgress(pMac,psessionEntry) || limIsReassocInProgress(pMac,pRoamSessionEntry)) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 247 | if (!IS_REASSOC_BSSID(pMac,pHdr->sa,psessionEntry)) { |
| 248 | PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from unknown/different AP while ReAssoc. Ignore \n"));) |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 249 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 250 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 251 | return; |
| 252 | } |
| 253 | |
| 254 | /** Received deauth from the new AP to which we tried to ReAssociate. |
| 255 | * Drop ReAssoc and Restore the Previous context( current connected AP). |
| 256 | */ |
| 257 | if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry)) { |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 258 | PELOGE(limLog(pMac, LOGE, FL("received DeAuth from the New AP to which ReAssoc is sent \n"));) |
| 259 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 260 | limPrintMacAddr(pMac, psessionEntry->bssId, LOGE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 271 | if(psessionEntry->limSystemRole != eLIM_AP_ROLE ){ |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 272 | if (!IS_CURRENT_BSSID(pMac, pHdr->bssId, psessionEntry)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 273 | { |
| 274 | PELOGE(limLog(pMac, LOGE, FL("received DeAuth from an AP other than we're trying to join. Ignore. \n"));) |
| 275 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 276 | { |
| 277 | PELOGE(limLog(pMac, LOGE, FL("Preauth entry exist. Deleting... \n"));) |
| 278 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 279 | } |
| 280 | return; |
| 281 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 284 | pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable); |
| 285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 286 | // Check for pre-assoc states |
| 287 | switch (psessionEntry->limSystemRole) |
| 288 | { |
| 289 | case eLIM_STA_ROLE: |
| 290 | case eLIM_BT_AMP_STA_ROLE: |
| 291 | switch (psessionEntry->limMlmState) |
| 292 | { |
| 293 | case eLIM_MLM_WT_AUTH_FRAME2_STATE: |
| 294 | /** |
| 295 | * AP sent Deauth frame while waiting |
| 296 | * for Auth frame2. Report Auth failure |
| 297 | * to SME. |
| 298 | */ |
| 299 | |
| 300 | // Log error |
| 301 | PELOG1(limLog(pMac, LOG1, |
| 302 | FL("received Deauth frame with failure code %d from "), |
| 303 | reasonCode); |
| 304 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 305 | |
| 306 | limRestoreFromAuthState(pMac, eSIR_SME_DEAUTH_WHILE_JOIN, |
| 307 | reasonCode,psessionEntry); |
| 308 | |
| 309 | return; |
| 310 | |
| 311 | case eLIM_MLM_AUTHENTICATED_STATE: |
| 312 | /// Issue Deauth Indication to SME. |
| 313 | palCopyMemory( pMac->hHdd, |
| 314 | (tANI_U8 *) &mlmDeauthInd.peerMacAddr, |
| 315 | pHdr->sa, |
| 316 | sizeof(tSirMacAddr)); |
| 317 | mlmDeauthInd.reasonCode = reasonCode; |
| 318 | |
| 319 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 320 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 321 | |
| 322 | |
| 323 | limPostSmeMessage(pMac, |
| 324 | LIM_MLM_DEAUTH_IND, |
| 325 | (tANI_U32 *) &mlmDeauthInd); |
| 326 | return; |
| 327 | |
| 328 | case eLIM_MLM_WT_ASSOC_RSP_STATE: |
| 329 | /** |
| 330 | * AP may have 'aged-out' our Pre-auth |
| 331 | * context. Delete local pre-auth context |
| 332 | * if any and issue ASSOC_CNF to SME. |
| 333 | */ |
| 334 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 335 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 336 | |
| 337 | if (psessionEntry->pLimMlmJoinReq) |
| 338 | { |
| 339 | palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq); |
| 340 | psessionEntry->pLimMlmJoinReq = NULL; |
| 341 | } |
| 342 | |
| 343 | mlmAssocCnf.resultCode = eSIR_SME_DEAUTH_WHILE_JOIN; |
| 344 | mlmAssocCnf.protStatusCode = reasonCode; |
| 345 | |
| 346 | /* PE session Id*/ |
| 347 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 348 | |
| 349 | psessionEntry->limMlmState = |
| 350 | psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 351 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | |
| 353 | // Deactive Association response timeout |
| 354 | limDeactivateAndChangeTimer( |
| 355 | pMac, |
| 356 | eLIM_ASSOC_FAIL_TIMER); |
| 357 | |
| 358 | limPostSmeMessage( |
| 359 | pMac, |
| 360 | LIM_MLM_ASSOC_CNF, |
| 361 | (tANI_U32 *) &mlmAssocCnf); |
| 362 | |
| 363 | return; |
| 364 | |
| 365 | case eLIM_MLM_IDLE_STATE: |
| 366 | case eLIM_MLM_LINK_ESTABLISHED_STATE: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 367 | #ifdef FEATURE_WLAN_TDLS |
| 368 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 369 | { |
| 370 | PELOGE(limLog(pMac, LOGE, |
| 371 | FL("received Deauth frame with reason code %d from Tdls peer"), |
| 372 | reasonCode); |
| 373 | limPrintMacAddr(pMac, pHdr->sa, LOGE);) |
| 374 | limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry, |
| 375 | reasonCode); |
| 376 | return; |
| 377 | } |
| 378 | else |
| 379 | { |
| 380 | limDeleteTDLSPeers(pMac, psessionEntry); |
| 381 | #endif |
| 382 | /** |
| 383 | * This could be Deauthentication frame from |
| 384 | * a BSS with which pre-authentication was |
| 385 | * performed. Delete Pre-auth entry if found. |
| 386 | */ |
| 387 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 388 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 389 | #ifdef FEATURE_WLAN_TDLS |
| 390 | } |
| 391 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 392 | break; |
| 393 | |
| 394 | case eLIM_MLM_WT_REASSOC_RSP_STATE: |
| 395 | break; |
| 396 | |
| 397 | case eLIM_MLM_WT_FT_REASSOC_RSP_STATE: |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 398 | PELOGE(limLog(pMac, LOGE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 399 | FL("received Deauth frame in FT state %X with reasonCode=%d from "), |
| 400 | psessionEntry->limMlmState, reasonCode);) |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 401 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 402 | break; |
| 403 | |
| 404 | default: |
| 405 | PELOG1(limLog(pMac, LOG1, |
| 406 | FL("received Deauth frame in state %X with reasonCode=%d from "), |
| 407 | psessionEntry->limMlmState, reasonCode);) |
| 408 | limPrintMacAddr(pMac, pHdr->sa, LOG1); |
| 409 | return; |
| 410 | } |
| 411 | break; |
| 412 | |
| 413 | case eLIM_STA_IN_IBSS_ROLE: |
| 414 | break; |
| 415 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 416 | case eLIM_AP_ROLE: |
| 417 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 418 | |
| 419 | default: // eLIM_AP_ROLE or eLIM_BT_AMP_AP_ROLE |
| 420 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 421 | |
| 422 | return; |
| 423 | } // end switch (pMac->lim.gLimSystemRole) |
| 424 | |
| 425 | |
| 426 | |
| 427 | /** |
| 428 | * Extract 'associated' context for STA, if any. |
| 429 | * This is maintained by DPH and created by LIM. |
| 430 | */ |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 431 | if (NULL == pStaDs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 432 | return; |
| 433 | |
| 434 | |
| 435 | if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) || |
| 436 | (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE)) |
| 437 | { |
| 438 | /** |
| 439 | * Already in the process of deleting context for the peer |
| 440 | * and received Deauthentication frame. Log and Ignore. |
| 441 | */ |
| 442 | PELOG1(limLog(pMac, LOG1, |
| 443 | FL("received Deauth frame from peer that is in state %X, addr "), |
| 444 | pStaDs->mlmStaContext.mlmState); |
| 445 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 446 | return; |
| 447 | } |
| 448 | pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)reasonCode; |
| 449 | pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DEAUTH; |
| 450 | |
| 451 | /// Issue Deauth Indication to SME. |
| 452 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr, |
| 453 | pStaDs->staAddr, |
| 454 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason; |
| 456 | mlmDeauthInd.deauthTrigger = eLIM_PEER_ENTITY_DEAUTH; |
| 457 | |
| 458 | |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 459 | /* |
| 460 | * If we're in the middle of ReAssoc and received deauth from |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 461 | * the ReAssoc AP, then notify SME by sending REASSOC_RSP with |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 462 | * failure result code. SME will post the disconnect to the |
| 463 | * supplicant and the latter would start a fresh assoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 464 | */ |
| 465 | if (limIsReassocInProgress(pMac,psessionEntry)) { |
| 466 | /** |
| 467 | * AP may have 'aged-out' our Pre-auth |
| 468 | * context. Delete local pre-auth context |
| 469 | * if any and issue REASSOC_CNF to SME. |
| 470 | */ |
| 471 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 472 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 473 | |
| 474 | if (psessionEntry->limAssocResponseData) { |
| 475 | palFreeMemory(pMac->hHdd, psessionEntry->limAssocResponseData); |
| 476 | psessionEntry->limAssocResponseData = NULL; |
| 477 | } |
| 478 | |
| 479 | PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from ReAssoc AP. Issue REASSOC_CNF. \n"));) |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 480 | /* |
| 481 | * TODO: Instead of overloading eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE |
| 482 | * it would have been good to define/use a different failure type. |
| 483 | * Using eSIR_SME_FT_REASSOC_FAILURE does not seem to clean-up |
| 484 | * properly and we end up seeing "transmit queue timeout". |
| 485 | */ |
| 486 | limPostReassocFailure(pMac, eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE, |
| 487 | eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 488 | return; |
| 489 | } |
| 490 | |
| 491 | /// Deauthentication from peer MAC entity |
| 492 | limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd); |
| 493 | |
| 494 | // send eWNI_SME_DEAUTH_IND to SME |
| 495 | limSendSmeDeauthInd(pMac, pStaDs, psessionEntry); |
| 496 | return; |
| 497 | |
| 498 | } /*** end limProcessDeauthFrame() ***/ |
| 499 | |