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