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; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 97 | |
| 98 | |
| 99 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 100 | |
| 101 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 102 | |
| 103 | |
| 104 | if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) && (eLIM_SME_WT_DEAUTH_STATE == psessionEntry->limSmeState)) |
| 105 | { |
| 106 | PELOGE(limLog(pMac, LOGE, |
| 107 | FL("received Deauth frame in DEAUTH_WT_STATE(already processing previously received DEAUTH frame).. Dropping this..\n "));) |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | if (limIsGroupAddr(pHdr->sa)) |
| 112 | { |
| 113 | // Received Deauth frame from a BC/MC address |
| 114 | // Log error and ignore it |
| 115 | PELOG1(limLog(pMac, LOG1, |
| 116 | FL("received Deauth frame from a BC/MC address\n"));) |
| 117 | |
| 118 | return; |
| 119 | } |
| 120 | |
| 121 | if (limIsGroupAddr(pHdr->da) && !limIsAddrBC(pHdr->da)) |
| 122 | { |
| 123 | // Received Deauth frame for a MC address |
| 124 | // Log error and ignore it |
| 125 | PELOG1(limLog(pMac, LOG1, |
| 126 | FL("received Deauth frame for a MC address\n"));) |
| 127 | |
| 128 | return; |
| 129 | } |
| 130 | // Get reasonCode from Deauthentication frame body |
| 131 | reasonCode = sirReadU16(pBody); |
| 132 | |
| 133 | PELOGE(limLog(pMac, LOGE, |
| 134 | FL("received Deauth frame (mlm state = %s) with reason code %d from "), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 135 | limMlmStateStr(psessionEntry->limMlmState), reasonCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 136 | limPrintMacAddr(pMac, pHdr->sa, LOGE);) |
| 137 | |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 138 | if (limCheckDisassocDeauthAckPending(pMac, (tANI_U8*)pHdr->sa)) |
| 139 | { |
| 140 | PELOGW(limLog(pMac, LOGE, |
| 141 | FL("Ignore the Deauth received, while waiting for ack of disassoc/deauth\n"));) |
| 142 | limCleanUpDisassocDeauthReq(pMac,(tANI_U8*)pHdr->sa, 1); |
| 143 | return; |
| 144 | } |
| 145 | |
| 146 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 147 | if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 148 | { |
| 149 | switch (reasonCode) |
| 150 | { |
| 151 | case eSIR_MAC_UNSPEC_FAILURE_REASON: |
| 152 | case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON: |
| 153 | // Valid reasonCode in received Deauthentication frame |
| 154 | break; |
| 155 | |
| 156 | default: |
| 157 | // Invalid reasonCode in received Deauthentication frame |
| 158 | // Log error and ignore the frame |
| 159 | PELOG1(limLog(pMac, LOG1, |
| 160 | FL("received Deauth frame with invalid reasonCode %d from \n"), |
| 161 | reasonCode); |
| 162 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 163 | |
| 164 | break; |
| 165 | } |
| 166 | } |
| 167 | else if (psessionEntry->limSystemRole == eLIM_STA_ROLE ||psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) |
| 168 | { |
| 169 | switch (reasonCode) |
| 170 | { |
| 171 | case eSIR_MAC_UNSPEC_FAILURE_REASON: |
| 172 | case eSIR_MAC_PREV_AUTH_NOT_VALID_REASON: |
| 173 | case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON: |
| 174 | case eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON: |
| 175 | case eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON: |
| 176 | case eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON: |
| 177 | // Valid reasonCode in received Deauth frame |
| 178 | break; |
| 179 | |
| 180 | default: |
| 181 | // Invalid reasonCode in received Deauth frame |
| 182 | // Log error and ignore the frame |
| 183 | PELOG1(limLog(pMac, LOG1, |
| 184 | FL("received Deauth frame with invalid reasonCode %d from \n"), |
| 185 | reasonCode); |
| 186 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 187 | |
| 188 | break; |
| 189 | } |
| 190 | } |
| 191 | else |
| 192 | { |
| 193 | // Received Deauth frame in either IBSS |
| 194 | // or un-known role. Log error and ignore it |
| 195 | limLog(pMac, LOGE, |
| 196 | FL("received Deauth frame with reasonCode %d in role %d from \n"), |
| 197 | reasonCode, psessionEntry->limSystemRole); |
| 198 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 199 | |
| 200 | return; |
| 201 | } |
| 202 | |
| 203 | /** If we are in the middle of ReAssoc, a few things could happen: |
| 204 | * - STA is reassociating to current AP, and receives deauth from: |
| 205 | * a) current AP |
| 206 | * b) other AP |
| 207 | * - STA is reassociating to a new AP, and receives deauth from: |
| 208 | * c) current AP |
| 209 | * d) reassoc AP |
| 210 | * e) other AP |
| 211 | * |
| 212 | * The logic is: |
| 213 | * 1) If rcv deauth from an AP other than the one we're trying to |
| 214 | * reassociate with, then drop the deauth frame (case b, c, e) |
| 215 | * 2) If rcv deauth from the "new" reassoc AP (case d), then restore |
| 216 | * context with previous AP and send SME_REASSOC_RSP failure. |
| 217 | * 3) If rcv deauth from the reassoc AP, which is also the same |
| 218 | * AP we're currently associated with (case a), then proceed |
| 219 | * with normal deauth processing. |
| 220 | */ |
Dhanashri Atre | af3e84d | 2013-01-18 18:03:06 -0800 | [diff] [blame] | 221 | if ( psessionEntry->limReAssocbssId!=NULL ) |
| 222 | { |
| 223 | pRoamSessionEntry = peFindSessionByBssid(pMac, psessionEntry->limReAssocbssId, &roamSessionId); |
| 224 | } |
| 225 | if (limIsReassocInProgress(pMac,psessionEntry) || limIsReassocInProgress(pMac,pRoamSessionEntry)) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 226 | if (!IS_REASSOC_BSSID(pMac,pHdr->sa,psessionEntry)) { |
| 227 | 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] | 228 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 229 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 230 | return; |
| 231 | } |
| 232 | |
| 233 | /** Received deauth from the new AP to which we tried to ReAssociate. |
| 234 | * Drop ReAssoc and Restore the Previous context( current connected AP). |
| 235 | */ |
| 236 | if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry)) { |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 237 | PELOGE(limLog(pMac, LOGE, FL("received DeAuth from the New AP to which ReAssoc is sent \n"));) |
| 238 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 239 | limPrintMacAddr(pMac, psessionEntry->bssId, LOGE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 240 | limRestorePreReassocState(pMac, |
| 241 | eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry); |
| 242 | return; |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | |
| 247 | /* If received DeAuth from AP other than the one we're trying to join with |
| 248 | * nor associated with, then ignore deauth and delete Pre-auth entry. |
| 249 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 250 | if(psessionEntry->limSystemRole != eLIM_AP_ROLE ){ |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 251 | if (!IS_CURRENT_BSSID(pMac, pHdr->bssId, psessionEntry)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 252 | { |
| 253 | PELOGE(limLog(pMac, LOGE, FL("received DeAuth from an AP other than we're trying to join. Ignore. \n"));) |
| 254 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 255 | { |
| 256 | PELOGE(limLog(pMac, LOGE, FL("Preauth entry exist. Deleting... \n"));) |
| 257 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 258 | } |
| 259 | return; |
| 260 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 263 | pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable); |
| 264 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | // Check for pre-assoc states |
| 266 | switch (psessionEntry->limSystemRole) |
| 267 | { |
| 268 | case eLIM_STA_ROLE: |
| 269 | case eLIM_BT_AMP_STA_ROLE: |
| 270 | switch (psessionEntry->limMlmState) |
| 271 | { |
| 272 | case eLIM_MLM_WT_AUTH_FRAME2_STATE: |
| 273 | /** |
| 274 | * AP sent Deauth frame while waiting |
| 275 | * for Auth frame2. Report Auth failure |
| 276 | * to SME. |
| 277 | */ |
| 278 | |
| 279 | // Log error |
| 280 | PELOG1(limLog(pMac, LOG1, |
| 281 | FL("received Deauth frame with failure code %d from "), |
| 282 | reasonCode); |
| 283 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 284 | |
| 285 | limRestoreFromAuthState(pMac, eSIR_SME_DEAUTH_WHILE_JOIN, |
| 286 | reasonCode,psessionEntry); |
| 287 | |
| 288 | return; |
| 289 | |
| 290 | case eLIM_MLM_AUTHENTICATED_STATE: |
| 291 | /// Issue Deauth Indication to SME. |
| 292 | palCopyMemory( pMac->hHdd, |
| 293 | (tANI_U8 *) &mlmDeauthInd.peerMacAddr, |
| 294 | pHdr->sa, |
| 295 | sizeof(tSirMacAddr)); |
| 296 | mlmDeauthInd.reasonCode = reasonCode; |
| 297 | |
| 298 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 299 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 300 | |
| 301 | |
| 302 | limPostSmeMessage(pMac, |
| 303 | LIM_MLM_DEAUTH_IND, |
| 304 | (tANI_U32 *) &mlmDeauthInd); |
| 305 | return; |
| 306 | |
| 307 | case eLIM_MLM_WT_ASSOC_RSP_STATE: |
| 308 | /** |
| 309 | * AP may have 'aged-out' our Pre-auth |
| 310 | * context. Delete local pre-auth context |
| 311 | * if any and issue ASSOC_CNF to SME. |
| 312 | */ |
| 313 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 314 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 315 | |
| 316 | if (psessionEntry->pLimMlmJoinReq) |
| 317 | { |
| 318 | palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq); |
| 319 | psessionEntry->pLimMlmJoinReq = NULL; |
| 320 | } |
| 321 | |
| 322 | mlmAssocCnf.resultCode = eSIR_SME_DEAUTH_WHILE_JOIN; |
| 323 | mlmAssocCnf.protStatusCode = reasonCode; |
| 324 | |
| 325 | /* PE session Id*/ |
| 326 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 327 | |
| 328 | psessionEntry->limMlmState = |
| 329 | psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 330 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 331 | |
| 332 | // Deactive Association response timeout |
| 333 | limDeactivateAndChangeTimer( |
| 334 | pMac, |
| 335 | eLIM_ASSOC_FAIL_TIMER); |
| 336 | |
| 337 | limPostSmeMessage( |
| 338 | pMac, |
| 339 | LIM_MLM_ASSOC_CNF, |
| 340 | (tANI_U32 *) &mlmAssocCnf); |
| 341 | |
| 342 | return; |
| 343 | |
| 344 | case eLIM_MLM_IDLE_STATE: |
| 345 | case eLIM_MLM_LINK_ESTABLISHED_STATE: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 346 | #ifdef FEATURE_WLAN_TDLS |
| 347 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 348 | { |
| 349 | PELOGE(limLog(pMac, LOGE, |
| 350 | FL("received Deauth frame with reason code %d from Tdls peer"), |
| 351 | reasonCode); |
| 352 | limPrintMacAddr(pMac, pHdr->sa, LOGE);) |
| 353 | limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry, |
| 354 | reasonCode); |
| 355 | return; |
| 356 | } |
| 357 | else |
| 358 | { |
| 359 | limDeleteTDLSPeers(pMac, psessionEntry); |
| 360 | #endif |
| 361 | /** |
| 362 | * This could be Deauthentication frame from |
| 363 | * a BSS with which pre-authentication was |
| 364 | * performed. Delete Pre-auth entry if found. |
| 365 | */ |
| 366 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 367 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 368 | #ifdef FEATURE_WLAN_TDLS |
| 369 | } |
| 370 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 371 | break; |
| 372 | |
| 373 | case eLIM_MLM_WT_REASSOC_RSP_STATE: |
| 374 | break; |
| 375 | |
| 376 | case eLIM_MLM_WT_FT_REASSOC_RSP_STATE: |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 377 | PELOGE(limLog(pMac, LOGE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 378 | FL("received Deauth frame in FT state %X with reasonCode=%d from "), |
| 379 | psessionEntry->limMlmState, reasonCode);) |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 380 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 381 | break; |
| 382 | |
| 383 | default: |
| 384 | PELOG1(limLog(pMac, LOG1, |
| 385 | FL("received Deauth frame in state %X with reasonCode=%d from "), |
| 386 | psessionEntry->limMlmState, reasonCode);) |
| 387 | limPrintMacAddr(pMac, pHdr->sa, LOG1); |
| 388 | return; |
| 389 | } |
| 390 | break; |
| 391 | |
| 392 | case eLIM_STA_IN_IBSS_ROLE: |
| 393 | break; |
| 394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | case eLIM_AP_ROLE: |
| 396 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 397 | |
| 398 | default: // eLIM_AP_ROLE or eLIM_BT_AMP_AP_ROLE |
| 399 | |
| 400 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 401 | /// Check if there exists pre-auth context for this STA |
| 402 | if (limSearchPreAuthList(pMac, pHdr->sa) == NULL) |
| 403 | { |
| 404 | /** |
| 405 | * Received Deauthentication from a STA that is neither |
| 406 | * Associated nor Pre-authenticated. Log error, |
| 407 | * and ignore Deauthentication frame. |
| 408 | */ |
| 409 | PELOG1(limLog(pMac, LOG1, |
| 410 | FL("received Deauth frame from peer that does not have context, addr ")); |
| 411 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 412 | } |
| 413 | else |
| 414 | { |
| 415 | /// Delete STA from pre-auth STA list |
| 416 | limDeletePreAuthNode(pMac, |
| 417 | pHdr->sa); |
| 418 | |
| 419 | palCopyMemory( pMac->hHdd, |
| 420 | (tANI_U8 *) &mlmDeauthInd.peerMacAddr, |
| 421 | pHdr->sa, |
| 422 | sizeof(tSirMacAddr)); |
| 423 | mlmDeauthInd.reasonCode = reasonCode; |
| 424 | mlmDeauthInd.aid = 0; |
| 425 | |
| 426 | limPostSmeMessage(pMac, |
| 427 | LIM_MLM_DEAUTH_IND, |
| 428 | (tANI_U32 *) &mlmDeauthInd); |
| 429 | } |
| 430 | #endif |
| 431 | |
| 432 | return; |
| 433 | } // end switch (pMac->lim.gLimSystemRole) |
| 434 | |
| 435 | |
| 436 | |
| 437 | /** |
| 438 | * Extract 'associated' context for STA, if any. |
| 439 | * This is maintained by DPH and created by LIM. |
| 440 | */ |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 441 | if (NULL == pStaDs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 442 | return; |
| 443 | |
| 444 | |
| 445 | if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) || |
| 446 | (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE)) |
| 447 | { |
| 448 | /** |
| 449 | * Already in the process of deleting context for the peer |
| 450 | * and received Deauthentication frame. Log and Ignore. |
| 451 | */ |
| 452 | PELOG1(limLog(pMac, LOG1, |
| 453 | FL("received Deauth frame from peer that is in state %X, addr "), |
| 454 | pStaDs->mlmStaContext.mlmState); |
| 455 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 456 | return; |
| 457 | } |
| 458 | pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)reasonCode; |
| 459 | pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DEAUTH; |
| 460 | |
| 461 | /// Issue Deauth Indication to SME. |
| 462 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr, |
| 463 | pStaDs->staAddr, |
| 464 | sizeof(tSirMacAddr)); |
| 465 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 466 | mlmDeauthInd.aid = pStaDs->assocId; |
| 467 | #endif |
| 468 | mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason; |
| 469 | mlmDeauthInd.deauthTrigger = eLIM_PEER_ENTITY_DEAUTH; |
| 470 | |
| 471 | |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 472 | /* |
| 473 | * If we're in the middle of ReAssoc and received deauth from |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 474 | * the ReAssoc AP, then notify SME by sending REASSOC_RSP with |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 475 | * failure result code. SME will post the disconnect to the |
| 476 | * supplicant and the latter would start a fresh assoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | */ |
| 478 | if (limIsReassocInProgress(pMac,psessionEntry)) { |
| 479 | /** |
| 480 | * AP may have 'aged-out' our Pre-auth |
| 481 | * context. Delete local pre-auth context |
| 482 | * if any and issue REASSOC_CNF to SME. |
| 483 | */ |
| 484 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 485 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 486 | |
| 487 | if (psessionEntry->limAssocResponseData) { |
| 488 | palFreeMemory(pMac->hHdd, psessionEntry->limAssocResponseData); |
| 489 | psessionEntry->limAssocResponseData = NULL; |
| 490 | } |
| 491 | |
| 492 | 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] | 493 | /* |
| 494 | * TODO: Instead of overloading eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE |
| 495 | * it would have been good to define/use a different failure type. |
| 496 | * Using eSIR_SME_FT_REASSOC_FAILURE does not seem to clean-up |
| 497 | * properly and we end up seeing "transmit queue timeout". |
| 498 | */ |
| 499 | limPostReassocFailure(pMac, eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE, |
| 500 | eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | return; |
| 502 | } |
| 503 | |
| 504 | /// Deauthentication from peer MAC entity |
| 505 | limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd); |
| 506 | |
| 507 | // send eWNI_SME_DEAUTH_IND to SME |
| 508 | limSendSmeDeauthInd(pMac, pStaDs, psessionEntry); |
| 509 | return; |
| 510 | |
| 511 | } /*** end limProcessDeauthFrame() ***/ |
| 512 | |