Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -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. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 22 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 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 | |
| 28 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 29 | * This file limProcessAssocReqFrame.cc contains the code |
| 30 | * for processing Re/Association Request Frame. |
| 31 | * Author: Chandra Modumudi |
| 32 | * Date: 03/18/02 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * -------------------------------------------------------------------- |
| 36 | * 05/26/10 js WPA handling in (Re)Assoc frames |
| 37 | * |
| 38 | */ |
| 39 | #include "palTypes.h" |
| 40 | #include "aniGlobal.h" |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame^] | 41 | #include "wniCfg.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | #include "sirApi.h" |
| 43 | #include "cfgApi.h" |
| 44 | |
| 45 | #include "schApi.h" |
| 46 | #include "pmmApi.h" |
| 47 | #include "utilsApi.h" |
| 48 | #include "limTypes.h" |
| 49 | #include "limUtils.h" |
| 50 | #include "limAssocUtils.h" |
| 51 | #include "limSecurityUtils.h" |
| 52 | #include "limSerDesUtils.h" |
| 53 | #include "limStaHashApi.h" |
| 54 | #include "limAdmitControl.h" |
| 55 | #include "palApi.h" |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 56 | #include "limSessionUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | |
| 58 | |
| 59 | #include "vos_types.h" |
| 60 | /** |
| 61 | * limConvertSupportedChannels |
| 62 | * |
| 63 | *FUNCTION: |
| 64 | * This function is called by limProcessAssocReqFrame() to |
| 65 | * parse the channel support IE in the Assoc/Reassoc Request |
| 66 | * frame, and send relevant information in the SME_ASSOC_IND |
| 67 | * |
| 68 | *NOTE: |
| 69 | * |
| 70 | * @param pMac - A pointer to Global MAC structure |
| 71 | * @param pMlmAssocInd - A pointer to SME ASSOC/REASSOC IND |
| 72 | * @param assocReq - A pointer to ASSOC/REASSOC Request frame |
| 73 | * |
| 74 | * @return None |
| 75 | */ |
| 76 | static void |
| 77 | limConvertSupportedChannels(tpAniSirGlobal pMac, |
| 78 | tpLimMlmAssocInd pMlmAssocInd, |
| 79 | tSirAssocReq *assocReq) |
| 80 | { |
| 81 | |
| 82 | tANI_U16 i, j, index=0; |
| 83 | tANI_U8 firstChannelNumber; |
| 84 | tANI_U8 numberOfChannel; |
| 85 | tANI_U8 nextChannelNumber; |
| 86 | |
| 87 | if(assocReq->supportedChannels.length >= SIR_MAX_SUPPORTED_CHANNEL_LIST) |
| 88 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 89 | limLog(pMac, LOG1, FL("Number of supported channels:%d is more than " |
| 90 | "MAX"), assocReq->supportedChannels.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 91 | pMlmAssocInd->supportedChannels.numChnl = 0; |
| 92 | return; |
| 93 | } |
| 94 | |
| 95 | for(i=0; i < (assocReq->supportedChannels.length); i++) |
| 96 | { |
| 97 | // Get First Channel Number |
| 98 | firstChannelNumber = assocReq->supportedChannels.supportedChannels[i]; |
| 99 | pMlmAssocInd->supportedChannels.channelList[index] = firstChannelNumber; |
| 100 | i++; |
| 101 | index++; |
| 102 | if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) |
| 103 | { |
| 104 | pMlmAssocInd->supportedChannels.numChnl = 0; |
| 105 | return; |
| 106 | } |
| 107 | // Get Number of Channels in a Subband |
| 108 | numberOfChannel = assocReq->supportedChannels.supportedChannels[i]; |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 109 | PELOG2(limLog(pMac, LOG2, FL("Rcv AssocReq: chnl=%d, numOfChnl=%d "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | firstChannelNumber, numberOfChannel);) |
| 111 | |
| 112 | if (numberOfChannel > 1) |
| 113 | { |
| 114 | nextChannelNumber = firstChannelNumber; |
| 115 | if(SIR_BAND_5_GHZ == limGetRFBand(firstChannelNumber)) |
| 116 | { |
| 117 | for (j=1; j < numberOfChannel; j++) |
| 118 | { |
| 119 | nextChannelNumber += SIR_11A_FREQUENCY_OFFSET; |
| 120 | pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber; |
| 121 | index++; |
| 122 | if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) |
| 123 | { |
| 124 | pMlmAssocInd->supportedChannels.numChnl = 0; |
| 125 | return; |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | else if(SIR_BAND_2_4_GHZ == limGetRFBand(firstChannelNumber)) |
| 130 | { |
| 131 | for (j=1; j < numberOfChannel; j++) |
| 132 | { |
| 133 | nextChannelNumber += SIR_11B_FREQUENCY_OFFSET; |
| 134 | pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber; |
| 135 | index++; |
| 136 | if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) |
| 137 | { |
| 138 | pMlmAssocInd->supportedChannels.numChnl = 0; |
| 139 | return; |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | pMlmAssocInd->supportedChannels.numChnl = (tANI_U8) index; |
| 147 | PELOG2(limLog(pMac, LOG2, |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 148 | FL("Send AssocInd to WSM: spectrum ON, minPwr %d, maxPwr %d, " |
| 149 | "numChnl %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 150 | pMlmAssocInd->powerCap.minTxPower, |
| 151 | pMlmAssocInd->powerCap.maxTxPower, |
| 152 | pMlmAssocInd->supportedChannels.numChnl);) |
| 153 | } |
| 154 | |
| 155 | |
| 156 | /**--------------------------------------------------------------- |
| 157 | \fn limProcessAssocReqFrame |
| 158 | \brief This function is called by limProcessMessageQueue() |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 159 | \ upon Re/Association Request frame reception in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 160 | \ BTAMP AP or Soft AP role. |
| 161 | \ |
| 162 | \param pMac |
| 163 | \param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 164 | \param subType - Indicates whether it is Association Request(=0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 165 | \ or Reassociation Request(=1) frame |
| 166 | \return None |
| 167 | ------------------------------------------------------------------*/ |
| 168 | void |
| 169 | limProcessAssocReqFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, |
| 170 | tANI_U8 subType, tpPESession psessionEntry) |
| 171 | { |
| 172 | tANI_U8 updateContext; |
| 173 | tANI_U8 *pBody; |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 174 | tANI_U16 peerIdx, temp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 175 | tANI_U32 val; |
| 176 | tANI_S32 framelen; |
| 177 | tSirRetStatus status; |
| 178 | tpSirMacMgmtHdr pHdr; |
| 179 | struct tLimPreAuthNode *pStaPreAuthContext; |
| 180 | tAniAuthType authType; |
| 181 | tSirMacCapabilityInfo localCapabilities; |
| 182 | tpDphHashNode pStaDs = NULL; |
| 183 | tpSirAssocReq pAssocReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 184 | tLimMlmStates mlmPrevState; |
| 185 | tDot11fIERSN Dot11fIERSN; |
| 186 | tDot11fIEWPA Dot11fIEWPA; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | tANI_U32 phyMode; |
| 188 | tHalBitVal qosMode; |
| 189 | tHalBitVal wsmMode, wmeMode; |
| 190 | tANI_U8 *wpsIe = NULL; |
| 191 | tSirMacRateSet basicRates; |
| 192 | tANI_U8 i = 0, j = 0; |
Chet Lanctot | 055d2a3 | 2013-08-31 17:29:03 -0700 | [diff] [blame] | 193 | tANI_BOOLEAN pmfConnection = eANI_BOOLEAN_FALSE; |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 194 | #ifdef WLAN_FEATURE_11W |
| 195 | tPmfSaQueryTimerId timerId; |
| 196 | tANI_U32 retryInterval; |
| 197 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 198 | |
| 199 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 200 | |
| 201 | limGetQosMode(psessionEntry, &qosMode); |
| 202 | |
| 203 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 204 | framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 205 | |
Abhishek Singh | 744e058 | 2014-11-20 15:32:32 +0530 | [diff] [blame] | 206 | limLog(pMac, LOG1, FL("Received %s Req Frame on sessionid: %d systemrole %d" |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 207 | " limMlmState %d from: "MAC_ADDRESS_STR), |
| 208 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 209 | psessionEntry->peSessionId, psessionEntry->limSystemRole, |
| 210 | psessionEntry->limMlmState, MAC_ADDR_ARRAY(pHdr->sa)); |
| 211 | |
Abhishek Singh | 744e058 | 2014-11-20 15:32:32 +0530 | [diff] [blame] | 212 | if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE ) |
| 213 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 214 | limLog(pMac, LOGE, FL("received unexpected ASSOC REQ on sessionid: %d " |
| 215 | "sys subType=%d for role=%d from: "MAC_ADDRESS_STR), |
| 216 | psessionEntry->peSessionId, |
| 217 | subType, psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 218 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, |
| 219 | WDA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen); |
| 220 | return; |
| 221 | } |
| 222 | |
Abhishek Singh | 744e058 | 2014-11-20 15:32:32 +0530 | [diff] [blame] | 223 | /* |
| 224 | * If a STA is already present in DPH and it |
| 225 | * is initiating a Assoc re-transmit, do not |
| 226 | * process it. This can happen when first Assoc Req frame |
| 227 | * is received but ACK lost at STA side. The ACK for this |
| 228 | * dropped Assoc Req frame should be sent by HW. Host simply |
| 229 | * does not process it once the entry for the STA is already |
| 230 | * present in DPH. |
| 231 | */ |
| 232 | pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx, |
| 233 | &psessionEntry->dph.dphHashTable); |
| 234 | if ((NULL != pStaDs) && (pHdr->fc.retry > 0)) |
| 235 | { |
| 236 | limLog(pMac, LOGE, |
| 237 | FL("STA is initiating Assoc Req after ACK lost.So, do not Process" |
| 238 | "sessionid: %d sys subType=%d for role=%d from: "MAC_ADDRESS_STR), |
| 239 | psessionEntry->peSessionId, subType, |
| 240 | psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa)); |
| 241 | return; |
| 242 | } |
| 243 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | // Get pointer to Re/Association Request frame body |
| 245 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 246 | |
| 247 | if (limIsGroupAddr(pHdr->sa)) |
| 248 | { |
| 249 | // Received Re/Assoc Req frame from a BC/MC address |
| 250 | // Log error and ignore it |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 251 | limLog(pMac, LOGE, FL("Received %s Req on sessionid: %d frame from a " |
| 252 | "BC/MC address"MAC_ADDRESS_STR), |
| 253 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 254 | psessionEntry->peSessionId, |
| 255 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 256 | return; |
| 257 | } |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 258 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 259 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen); |
| 260 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 261 | if (vos_mem_compare((tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 262 | (tANI_U8) (sizeof(tSirMacAddr)))) |
| 263 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 264 | limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as" |
| 265 | " SAP/GO")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 266 | limSendAssocRspMgmtFrame(pMac, |
| 267 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 268 | 1, |
| 269 | pHdr->sa, |
| 270 | subType, 0,psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 271 | return ; |
| 272 | } |
| 273 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 274 | // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON |
| 275 | if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)) |
| 276 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 277 | limLog(pMac, LOGE, FL("TKIP counter measure is active")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 278 | limSendAssocRspMgmtFrame(pMac, |
| 279 | eSIR_MAC_MIC_FAILURE_REASON, |
| 280 | 1, |
| 281 | pHdr->sa, |
| 282 | subType, 0, psessionEntry); |
| 283 | return; |
| 284 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | |
| 286 | // Allocate memory for the Assoc Request frame |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 287 | pAssocReq = vos_mem_malloc(sizeof(*pAssocReq)); |
| 288 | if (NULL == pAssocReq) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 289 | { |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 290 | limLog(pMac, LOGP, FL("Allocate Memory failed in AssocReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 291 | return; |
| 292 | } |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 293 | vos_mem_set((void *)pAssocReq , sizeof(*pAssocReq), 0); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 294 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 295 | // Parse Assoc Request frame |
| 296 | if (subType == LIM_ASSOC) |
| 297 | status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq); |
| 298 | else |
| 299 | status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq); |
| 300 | |
| 301 | if (status != eSIR_SUCCESS) |
| 302 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 303 | limLog(pMac, LOGE, FL("Parse error AssocRequest, length=%d from "MAC_ADDRESS_STR), |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 304 | framelen, MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 305 | limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry); |
| 306 | goto error; |
| 307 | } |
| 308 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 309 | pAssocReq->assocReqFrame = vos_mem_malloc(framelen); |
| 310 | if ( NULL == pAssocReq->assocReqFrame ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 311 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 312 | limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, " |
| 313 | "length=%d from "),framelen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 314 | goto error; |
| 315 | } |
| 316 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 317 | vos_mem_copy((tANI_U8 *) pAssocReq->assocReqFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 318 | (tANI_U8 *) pBody, framelen); |
| 319 | pAssocReq->assocReqFrameLength = framelen; |
| 320 | |
| 321 | if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS) |
| 322 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 323 | limLog(pMac, LOGP, FL("could not retrieve Capabilities")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 324 | goto error; |
| 325 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 326 | limCopyU16((tANI_U8 *) &localCapabilities, temp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 327 | |
| 328 | if (limCompareCapabilities(pMac, |
| 329 | pAssocReq, |
| 330 | &localCapabilities,psessionEntry) == false) |
| 331 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 332 | limLog(pMac, LOGE, FL("local caps mismatch received caps")); |
| 333 | limLog(pMac, LOGE, FL("Received %s Req with unsupported " |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 334 | "capabilities from"MAC_ADDRESS_STR), |
| 335 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 336 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 337 | /** |
| 338 | * Capabilities of requesting STA does not match with |
| 339 | * local capabilities. Respond with 'unsupported capabilities' |
| 340 | * status code. |
| 341 | */ |
| 342 | limSendAssocRspMgmtFrame( |
| 343 | pMac, |
| 344 | eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 345 | 1, |
| 346 | pHdr->sa, |
| 347 | subType, 0,psessionEntry); |
| 348 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 349 | goto error; |
| 350 | } |
| 351 | |
| 352 | updateContext = false; |
| 353 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 354 | if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false) |
| 355 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 356 | limLog(pMac, LOGE, FL("Received %s Req with unmatched ssid ( Received" |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 357 | " SSID: %.*s current SSID: %.*s ) from "MAC_ADDRESS_STR), |
| 358 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", pAssocReq->ssId.length, |
| 359 | pAssocReq->ssId.ssId, psessionEntry->ssId.length, |
| 360 | psessionEntry->ssId.ssId, MAC_ADDR_ARRAY(pHdr->sa)); |
| 361 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 362 | /** |
| 363 | * Received Re/Association Request with either |
| 364 | * Broadcast SSID OR with SSID that does not |
| 365 | * match with local one. |
| 366 | * Respond with unspecified status code. |
| 367 | */ |
| 368 | limSendAssocRspMgmtFrame(pMac, |
| 369 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 370 | 1, |
| 371 | pHdr->sa, |
| 372 | subType, 0,psessionEntry); |
| 373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 374 | goto error; |
| 375 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 376 | |
| 377 | /*************************************************************** |
| 378 | ** Verify if the requested rates are available in supported rate |
| 379 | ** set or Extended rate set. Some APs are adding basic rates in |
| 380 | ** Extended rateset IE |
| 381 | ***************************************************************/ |
| 382 | basicRates.numRates = 0; |
| 383 | |
Gopichand Nakkala | 94273ab | 2013-03-25 14:47:39 +0530 | [diff] [blame] | 384 | for(i = 0; i < pAssocReq->supportedRates.numRates && (i < SIR_MAC_RATESET_EID_MAX); i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | { |
| 386 | basicRates.rate[i] = pAssocReq->supportedRates.rate[i]; |
| 387 | basicRates.numRates++; |
| 388 | } |
| 389 | |
| 390 | for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++) |
| 391 | { |
| 392 | basicRates.rate[i] = pAssocReq->extendedRates.rate[j]; |
| 393 | basicRates.numRates++; |
| 394 | } |
| 395 | if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false) |
| 396 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 397 | limLog(pMac, LOGE, FL("Received %s Req with unsupported " |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 398 | "rates from"MAC_ADDRESS_STR), |
| 399 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 400 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | /** |
| 402 | * Requesting STA does not support ALL BSS basic |
| 403 | * rates. Respond with 'basic rates not supported' |
| 404 | * status code. |
| 405 | */ |
| 406 | limSendAssocRspMgmtFrame( |
| 407 | pMac, |
| 408 | eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS, |
| 409 | 1, |
| 410 | pHdr->sa, |
| 411 | subType, 0,psessionEntry); |
| 412 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 413 | goto error; |
| 414 | } |
| 415 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 416 | |
| 417 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 418 | (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) && |
| 419 | ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present))) |
| 420 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 421 | limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy " |
| 422 | "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 423 | limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 424 | 1, pHdr->sa, subType, 0, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 425 | goto error; |
| 426 | |
| 427 | }//end if phyMode == 11G_only |
| 428 | |
| 429 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && |
| 430 | (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) && |
| 431 | (!pAssocReq->HTCaps.present)) |
| 432 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 433 | limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy " |
| 434 | "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 435 | limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, |
| 436 | 1, pHdr->sa, subType, 0, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 437 | goto error; |
| 438 | }//end if PhyMode == 11N_only |
| 439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 440 | |
| 441 | /* Spectrum Management (11h) specific checks */ |
| 442 | if (localCapabilities.spectrumMgt) |
| 443 | { |
| 444 | tSirRetStatus status = eSIR_SUCCESS; |
| 445 | |
| 446 | /* If station is 11h capable, then it SHOULD send all mandatory |
| 447 | * IEs in assoc request frame. Let us verify that |
| 448 | */ |
| 449 | if (pAssocReq->capabilityInfo.spectrumMgt) |
| 450 | { |
| 451 | if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent))) |
| 452 | { |
| 453 | /* One or more required information elements are missing, log the peers error */ |
| 454 | if (!pAssocReq->powerCapabilityPresent) |
| 455 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 456 | limLog(pMac, LOG1, FL("LIM Info: Missing Power capability " |
| 457 | "IE in %s Req from "MAC_ADDRESS_STR), |
| 458 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 459 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 460 | } |
| 461 | if (!pAssocReq->supportedChannelsPresent) |
| 462 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 463 | limLog(pMac, LOGW, FL("LIM Info: Missing Supported channel " |
| 464 | "IE in %s Req from "MAC_ADDRESS_STR), |
| 465 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 466 | MAC_ADDR_ARRAY(pHdr->sa)); |
| 467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 469 | } |
| 470 | else |
| 471 | { |
| 472 | /* Assoc request has mandatory fields */ |
| 473 | status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry); |
| 474 | if (eSIR_SUCCESS != status) |
| 475 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 476 | limLog(pMac, LOGW, FL("LIM Info: MinTxPower(STA) > " |
| 477 | "MaxTxPower(AP) in %s Req from "MAC_ADDRESS_STR), |
| 478 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 479 | MAC_ADDR_ARRAY(pHdr->sa)); |
| 480 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 481 | } |
| 482 | status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq); |
| 483 | if (eSIR_SUCCESS != status) |
| 484 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 485 | limLog(pMac, LOGW, FL("LIM Info: wrong supported " |
| 486 | "channels (STA) in %s Req from "MAC_ADDRESS_STR), |
| 487 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 488 | MAC_ADDR_ARRAY(pHdr->sa)); |
| 489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 490 | } |
| 491 | /* IEs are valid, use them if needed */ |
| 492 | } |
| 493 | } //if(assoc.capabilityInfo.spectrumMgt) |
| 494 | else |
| 495 | { |
| 496 | /* As per the capabiities, the spectrum management is not enabled on the station |
| 497 | * The AP may allow the associations to happen even if spectrum management is not |
| 498 | * allowed, if the transmit power of station is below the regulatory maximum |
| 499 | */ |
| 500 | |
| 501 | /* TODO: presently, this is not handled. In the current implemetation, the AP would |
| 502 | * allow the station to associate even if it doesn't support spectrum management. |
| 503 | */ |
| 504 | } |
| 505 | }// end of spectrum management related processing |
| 506 | |
| 507 | if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false)) |
| 508 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 509 | limLog(pMac, LOGE, FL("received %s req with unsupported" |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 510 | "MCS Rate Set from "MAC_ADDRESS_STR), |
| 511 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 512 | MAC_ADDR_ARRAY(pHdr->sa)); |
| 513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 514 | /** |
| 515 | * Requesting STA does not support ALL BSS MCS basic Rate set rates. |
| 516 | * Spec does not define any status code for this scenario. |
| 517 | */ |
| 518 | limSendAssocRspMgmtFrame( |
| 519 | pMac, |
| 520 | eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS, |
| 521 | 1, |
| 522 | pHdr->sa, |
| 523 | subType, 0,psessionEntry); |
| 524 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 525 | goto error; |
| 526 | } |
| 527 | |
| 528 | //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G) |
| 529 | if (phyMode == WNI_CFG_PHY_MODE_11G) |
| 530 | { |
| 531 | |
| 532 | if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS) |
| 533 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 534 | limLog(pMac, LOGP, FL("could not retrieve 11g-only flag")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 535 | goto error; |
| 536 | } |
| 537 | |
| 538 | if (!pAssocReq->extendedRatesPresent && val) |
| 539 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 540 | limLog(pMac, LOGE, FL("Rejecting Re/Assoc req from 11b STA: " |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 541 | MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 542 | /** |
| 543 | * Received Re/Association Request from |
| 544 | * 11b STA when 11g only policy option |
| 545 | * is set. |
| 546 | * Reject with unspecified status code. |
| 547 | */ |
| 548 | limSendAssocRspMgmtFrame( |
| 549 | pMac, |
| 550 | eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS, |
| 551 | 1, |
| 552 | pHdr->sa, |
| 553 | subType, 0,psessionEntry); |
| 554 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 555 | |
| 556 | #ifdef WLAN_DEBUG |
| 557 | pMac->lim.gLim11bStaAssocRejectCount++; |
| 558 | #endif |
| 559 | goto error; |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | #ifdef WMM_APSD |
| 564 | // Save the QOS info element in assoc request.. |
| 565 | limGetWmeMode(pMac, &wmeMode); |
| 566 | if (wmeMode == eHAL_SET) |
| 567 | { |
| 568 | tpQosInfoSta qInfo; |
| 569 | |
| 570 | qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo); |
| 571 | |
| 572 | if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi)) |
| 573 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 574 | limLog(pMac, LOGW, |
| 575 | FL("Rejecting Re/Assoc req from STA: "MAC_ADDRESS_STR), |
| 576 | MAC_ADDR_ARRAY(pHdr->sa)); |
| 577 | limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x"), *qInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 578 | |
| 579 | /** |
| 580 | * Received Re/Association Request from |
| 581 | * 11b STA when 11g only policy option |
| 582 | * is set. |
| 583 | * Reject with unspecified status code. |
| 584 | */ |
| 585 | limSendAssocRspMgmtFrame( |
| 586 | pMac, |
| 587 | eSIR_MAC_WME_REFUSED_STATUS, |
| 588 | 1, |
| 589 | pHdr->sa, |
| 590 | subType, 0,psessionEntry); |
| 591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 592 | goto error; |
| 593 | } |
| 594 | } |
| 595 | #endif |
| 596 | |
| 597 | // Check for 802.11n HT caps compatibility; are HT Capabilities |
| 598 | // turned on in lim? |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 599 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | { |
| 601 | // There are; are they turned on in the STA? |
| 602 | if ( pAssocReq->HTCaps.present ) |
| 603 | { |
| 604 | // The station *does* support 802.11n HT capability... |
| 605 | |
| 606 | limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d " |
| 607 | "PowerSave:%d greenField:%d " |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 608 | "shortGI20:%d shortGI40:%d" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 609 | "txSTBC:%d rxSTBC:%d delayBA:%d" |
| 610 | "maxAMSDUsize:%d DSSS/CCK:%d " |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 611 | "PSMP:%d stbcCntl:%d lsigTXProt:%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 612 | pAssocReq->HTCaps.advCodingCap, |
| 613 | pAssocReq->HTCaps.supportedChannelWidthSet, |
| 614 | pAssocReq->HTCaps.mimoPowerSave, |
| 615 | pAssocReq->HTCaps.greenField, |
| 616 | pAssocReq->HTCaps.shortGI20MHz, |
| 617 | pAssocReq->HTCaps.shortGI40MHz, |
| 618 | pAssocReq->HTCaps.txSTBC, |
| 619 | pAssocReq->HTCaps.rxSTBC, |
| 620 | pAssocReq->HTCaps.delayedBA, |
| 621 | pAssocReq->HTCaps.maximalAMSDUsize, |
| 622 | pAssocReq->HTCaps.dsssCckMode40MHz, |
| 623 | pAssocReq->HTCaps.psmp, |
| 624 | pAssocReq->HTCaps.stbcControlFrame, |
| 625 | pAssocReq->HTCaps.lsigTXOPProtection ); |
| 626 | |
| 627 | // Make sure the STA's caps are compatible with our own: |
| 628 | //11.15.2 Support of DSSS/CCK in 40 MHz |
| 629 | //the AP shall refuse association requests from an HT STA that has the DSSS/CCK |
| 630 | //Mode in 40 MHz subfield set to 1; |
| 631 | |
| 632 | //FIXME_BTAMP_AP : Need to be enabled |
| 633 | /* |
| 634 | if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz ) |
| 635 | { |
| 636 | statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS; |
| 637 | limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; " |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 638 | "STA rejected." ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 639 | // Reject association |
| 640 | limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry); |
| 641 | goto error; |
| 642 | } |
| 643 | */ |
| 644 | } |
| 645 | } // End if on HT caps turned on in lim. |
| 646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 647 | /* Clear the buffers so that frame parser knows that there isn't a previously decoded IE in these buffers */ |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 648 | vos_mem_set((tANI_U8*)&Dot11fIERSN, sizeof( Dot11fIERSN ), 0); |
| 649 | vos_mem_set((tANI_U8*)&Dot11fIEWPA, sizeof( Dot11fIEWPA ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 650 | |
| 651 | /* if additional IE is present, check if it has WscIE */ |
| 652 | if( pAssocReq->addIEPresent && pAssocReq->addIE.length ) |
| 653 | wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length); |
| 654 | /* when wpsIe is present, RSN/WPA IE is ignored */ |
| 655 | if( wpsIe == NULL ) |
| 656 | { |
| 657 | /** check whether as RSN IE is present */ |
| 658 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE |
| 659 | && psessionEntry->pLimStartBssReq->privacy |
| 660 | && psessionEntry->pLimStartBssReq->rsnIE.length) |
| 661 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 662 | limLog(pMac, LOG1, |
Kiet Lam | 82004c6 | 2013-11-11 13:24:28 +0530 | [diff] [blame] | 663 | FL("RSN enabled auth, Re/Assoc req from STA: "MAC_ADDRESS_STR), |
| 664 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 665 | if(pAssocReq->rsnPresent) |
| 666 | { |
| 667 | if(pAssocReq->rsn.length) |
| 668 | { |
| 669 | // Unpack the RSN IE |
| 670 | dot11fUnpackIeRSN(pMac, |
| 671 | &pAssocReq->rsn.info[0], |
| 672 | pAssocReq->rsn.length, |
| 673 | &Dot11fIERSN); |
| 674 | |
| 675 | /* Check RSN version is supported or not */ |
| 676 | if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version) |
| 677 | { |
| 678 | /* check the groupwise and pairwise cipher suites */ |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 679 | if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry, |
| 680 | pAssocReq->HTCaps.present, &pmfConnection))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 681 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 682 | limLog(pMac, LOGE, FL("RSN Mismatch. Rejecting Re/Assoc req from " |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 683 | "STA: "MAC_ADDRESS_STR), |
| 684 | MAC_ADDR_ARRAY(pHdr->sa)); |
| 685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 686 | /* some IE is not properly sent */ |
| 687 | /* received Association req frame with RSN IE but length is 0 */ |
| 688 | limSendAssocRspMgmtFrame( |
| 689 | pMac, |
| 690 | status, |
| 691 | 1, |
| 692 | pHdr->sa, |
| 693 | subType, 0,psessionEntry); |
| 694 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 695 | goto error; |
| 696 | |
| 697 | } |
| 698 | } |
| 699 | else |
| 700 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 701 | limLog(pMac, LOGE, FL("RSN Version mismatch. " |
| 702 | "Rejecting Re/Assoc req from " |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 703 | "STA: "MAC_ADDRESS_STR), |
| 704 | MAC_ADDR_ARRAY(pHdr->sa)); |
| 705 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 706 | /* received Association req frame with RSN IE version wrong */ |
| 707 | limSendAssocRspMgmtFrame( |
| 708 | pMac, |
| 709 | eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS, |
| 710 | 1, |
| 711 | pHdr->sa, |
| 712 | subType, 0,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 713 | goto error; |
| 714 | |
| 715 | } |
| 716 | } |
| 717 | else |
| 718 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 719 | limLog(pMac, LOGW, FL("RSN length not correct. " |
| 720 | "Rejecting Re/Assoc req from STA:" |
| 721 | MAC_ADDRESS_STR), |
| 722 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 723 | /* received Association req frame with RSN IE but length is 0 */ |
| 724 | limSendAssocRspMgmtFrame( |
| 725 | pMac, |
| 726 | eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS, |
| 727 | 1, |
| 728 | pHdr->sa, |
| 729 | subType, 0,psessionEntry); |
| 730 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 731 | goto error; |
| 732 | |
| 733 | } |
| 734 | } /* end - if(pAssocReq->rsnPresent) */ |
| 735 | if((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent) |
| 736 | { |
| 737 | // Unpack the WPA IE |
| 738 | if(pAssocReq->wpa.length) |
| 739 | { |
| 740 | dot11fUnpackIeWPA(pMac, |
| 741 | &pAssocReq->wpa.info[4], //OUI is not taken care |
| 742 | pAssocReq->wpa.length, |
| 743 | &Dot11fIEWPA); |
| 744 | /* check the groupwise and pairwise cipher suites */ |
| 745 | if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present))) |
| 746 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 747 | limLog(pMac, LOGW, FL("WPA IE mismatch. " |
| 748 | "Rejecting Re/Assoc req from " |
| 749 | "STA: "MAC_ADDRESS_STR), |
| 750 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 751 | /* received Association req frame with WPA IE but mismatch */ |
| 752 | limSendAssocRspMgmtFrame( |
| 753 | pMac, |
| 754 | status, |
| 755 | 1, |
| 756 | pHdr->sa, |
| 757 | subType, 0,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 758 | goto error; |
| 759 | |
| 760 | } |
| 761 | } |
| 762 | else |
| 763 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 764 | limLog(pMac, LOGW, FL("WPA len incorrect. " |
| 765 | "Rejecting Re/Assoc req from STA: " |
| 766 | MAC_ADDRESS_STR), |
| 767 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 768 | /* received Association req frame with invalid WPA IE */ |
| 769 | limSendAssocRspMgmtFrame( |
| 770 | pMac, |
| 771 | eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS, |
| 772 | 1, |
| 773 | pHdr->sa, |
| 774 | subType, 0,psessionEntry); |
| 775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 776 | goto error; |
| 777 | }/* end - if(pAssocReq->wpa.length) */ |
| 778 | } /* end - if(pAssocReq->wpaPresent) */ |
| 779 | } /* end of if(psessionEntry->pLimStartBssReq->privacy |
| 780 | && psessionEntry->pLimStartBssReq->rsnIE->length) */ |
| 781 | |
| 782 | } /* end of if( ! pAssocReq->wscInfo.present ) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 783 | |
| 784 | /** |
| 785 | * Extract 'associated' context for STA, if any. |
| 786 | * This is maintained by DPH and created by LIM. |
| 787 | */ |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 788 | pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 789 | |
| 790 | /// Extract pre-auth context for the STA, if any. |
| 791 | pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa); |
| 792 | |
| 793 | if (pStaDs == NULL) |
| 794 | { |
| 795 | /// Requesting STA is not currently associated |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 796 | if (peGetCurrentSTAsCount(pMac) == pMac->lim.maxStation) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | { |
| 798 | /** |
| 799 | * Maximum number of STAs that AP can handle reached. |
| 800 | * Send Association response to peer MAC entity |
| 801 | */ |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 802 | limLog(pMac, LOGE, FL("Max Sta count reached : %d"), |
| 803 | pMac->lim.maxStation); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 804 | limRejectAssociation(pMac, pHdr->sa, |
| 805 | subType, false, |
| 806 | (tAniAuthType) 0, 0, |
| 807 | false, |
| 808 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 809 | |
| 810 | goto error; |
| 811 | } |
| 812 | |
| 813 | /// Check if STA is pre-authenticated. |
| 814 | if ((pStaPreAuthContext == NULL) || |
| 815 | (pStaPreAuthContext && |
| 816 | (pStaPreAuthContext->mlmState != |
| 817 | eLIM_MLM_AUTHENTICATED_STATE))) |
| 818 | { |
| 819 | /** |
| 820 | * STA is not pre-authenticated yet requesting |
| 821 | * Re/Association before Authentication. |
| 822 | * OR STA is in the process of getting authenticated |
| 823 | * and sent Re/Association request. |
| 824 | * Send Deauthentication frame with 'prior |
| 825 | * authentication required' reason code. |
| 826 | */ |
| 827 | limSendDeauthMgmtFrame( |
| 828 | pMac, |
| 829 | eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9 |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 830 | pHdr->sa, psessionEntry, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 831 | |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 832 | limLog(pMac, LOGE, FL("received %s req on sessionid: %d from STA " |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 833 | "that does not have pre-auth context"MAC_ADDRESS_STR), |
| 834 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", |
| 835 | psessionEntry->peSessionId, |
| 836 | MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 837 | goto error; |
| 838 | } |
| 839 | |
| 840 | /// Delete 'pre-auth' context of STA |
| 841 | authType = pStaPreAuthContext->authType; |
| 842 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 843 | |
| 844 | // All is well. Assign AID (after else part) |
| 845 | |
| 846 | } // if (pStaDs == NULL) |
| 847 | else |
| 848 | { |
| 849 | // STA context does exist for this STA |
| 850 | |
| 851 | if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) |
| 852 | { |
| 853 | /** |
| 854 | * Requesting STA is in some 'transient' state? |
| 855 | * Ignore the Re/Assoc Req frame by incrementing |
| 856 | * debug counter & logging error. |
| 857 | */ |
| 858 | if (subType == LIM_ASSOC) |
| 859 | { |
| 860 | |
| 861 | #ifdef WLAN_DEBUG |
| 862 | pMac->lim.gLimNumAssocReqDropInvldState++; |
| 863 | #endif |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 864 | limLog(pMac, LOGE, FL("received Assoc req in state " |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 865 | "%d from "), pStaDs->mlmStaContext.mlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | } |
| 867 | else |
| 868 | { |
| 869 | #ifdef WLAN_DEBUG |
| 870 | pMac->lim.gLimNumReassocReqDropInvldState++; |
| 871 | #endif |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 872 | limLog(pMac, LOGE, FL("received ReAssoc req in state %d" |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 873 | " from "), pStaDs->mlmStaContext.mlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 874 | } |
| 875 | limPrintMacAddr(pMac, pHdr->sa, LOG1); |
| 876 | limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 877 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 878 | goto error; |
| 879 | } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) |
| 880 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 881 | /* STA sent association Request frame while already in |
| 882 | * 'associated' state */ |
| 883 | |
| 884 | #ifdef WLAN_FEATURE_11W |
| 885 | limLog(pMac, LOG1, FL("Re/Assoc request from station that is already associated")); |
| 886 | limLog(pMac, LOG1, FL("PMF enabled %d, SA Query state %d"), pStaDs->rmfEnabled, |
| 887 | pStaDs->pmfSaQueryState); |
| 888 | if (pStaDs->rmfEnabled) |
| 889 | { |
| 890 | switch (pStaDs->pmfSaQueryState) |
| 891 | { |
| 892 | |
| 893 | // start SA Query procedure, respond to Association Request |
| 894 | // with try again later |
| 895 | case DPH_SA_QUERY_NOT_IN_PROGRESS: |
Abhishek Singh | 65d6635 | 2014-07-15 23:14:38 +0530 | [diff] [blame] | 896 | /* |
| 897 | * We should reset the retry counter before we start |
| 898 | * the SA query procedure, otherwise in next set of SA query |
| 899 | * procedure we will end up using the stale value. |
| 900 | */ |
| 901 | pStaDs->pmfSaQueryRetryCount = 0; |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 902 | limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1, |
| 903 | pHdr->sa, subType, pStaDs, psessionEntry); |
| 904 | limSendSaQueryRequestFrame( |
| 905 | pMac, (tANI_U8 *)&(pStaDs->pmfSaQueryCurrentTransId), |
| 906 | pHdr->sa, psessionEntry); |
| 907 | pStaDs->pmfSaQueryStartTransId = pStaDs->pmfSaQueryCurrentTransId; |
| 908 | pStaDs->pmfSaQueryCurrentTransId++; |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 909 | |
| 910 | // start timer for SA Query retry |
| 911 | if (tx_timer_activate(&pStaDs->pmfSaQueryTimer) != TX_SUCCESS) |
| 912 | { |
| 913 | limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!")); |
| 914 | goto error; |
| 915 | } |
| 916 | |
| 917 | pStaDs->pmfSaQueryState = DPH_SA_QUERY_IN_PROGRESS; |
| 918 | goto error; |
| 919 | |
| 920 | // SA Query procedure still going, respond to Association |
| 921 | // Request with try again later |
| 922 | case DPH_SA_QUERY_IN_PROGRESS: |
| 923 | limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1, |
| 924 | pHdr->sa, subType, 0, psessionEntry); |
| 925 | goto error; |
| 926 | |
| 927 | // SA Query procedure timed out, accept Association Request |
| 928 | // normally |
| 929 | case DPH_SA_QUERY_TIMED_OUT: |
| 930 | pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; |
| 931 | break; |
| 932 | } |
| 933 | } |
| 934 | #endif |
| 935 | |
| 936 | /* no change in the capability so drop the frame */ |
Madan Mohan Koyyalamudi | 9902720 | 2013-08-05 22:14:24 +0530 | [diff] [blame] | 937 | if ((VOS_TRUE == vos_mem_compare(&pStaDs->mlmStaContext.capabilityInfo, |
| 938 | &pAssocReq->capabilityInfo, |
| 939 | sizeof(tSirMacCapabilityInfo)))&& |
| 940 | (subType == LIM_ASSOC)) |
| 941 | { |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 942 | limLog(pMac, LOGE, FL(" Received Assoc req in state %d STAid=%d"), |
Madan Mohan Koyyalamudi | 9902720 | 2013-08-05 22:14:24 +0530 | [diff] [blame] | 943 | pStaDs->mlmStaContext.mlmState,peerIdx); |
| 944 | goto error; |
| 945 | } |
| 946 | else |
| 947 | { |
| 948 | /** |
| 949 | * STA sent Re/association Request frame while already in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 950 | * 'associated' state. Update STA capabilities and |
| 951 | * send Association response frame with same AID |
| 952 | */ |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 953 | limLog(pMac, LOG1, FL("Received Assoc req from STA already connected" |
| 954 | " UpdateConext")); |
Madan Mohan Koyyalamudi | 9902720 | 2013-08-05 22:14:24 +0530 | [diff] [blame] | 955 | pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo; |
| 956 | if (pStaPreAuthContext && |
| 957 | (pStaPreAuthContext->mlmState == |
| 958 | eLIM_MLM_AUTHENTICATED_STATE)) |
| 959 | { |
| 960 | /// STA has triggered pre-auth again |
| 961 | authType = pStaPreAuthContext->authType; |
| 962 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 963 | } |
| 964 | else |
| 965 | authType = pStaDs->mlmStaContext.authType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 966 | |
Madan Mohan Koyyalamudi | 9902720 | 2013-08-05 22:14:24 +0530 | [diff] [blame] | 967 | updateContext = true; |
| 968 | if (dphInitStaState(pMac, pHdr->sa, peerIdx, true, &psessionEntry->dph.dphHashTable) |
| 969 | == NULL) |
| 970 | { |
| 971 | limLog(pMac, LOGE, FL("could not Init STAid=%d"), peerIdx); |
| 972 | goto error; |
| 973 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 974 | } |
Madan Mohan Koyyalamudi | 9902720 | 2013-08-05 22:14:24 +0530 | [diff] [blame] | 975 | goto sendIndToSme; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 976 | } // end if (lookup for STA in perStaDs fails) |
| 977 | |
| 978 | |
| 979 | |
| 980 | // check if sta is allowed per QoS AC rules |
| 981 | //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled) |
| 982 | limGetWmeMode(psessionEntry, &wmeMode); |
| 983 | if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET)) |
| 984 | { |
| 985 | // for a qsta, check if the requested Traffic spec |
| 986 | // is admissible |
| 987 | // for a non-qsta check if the sta can be admitted |
| 988 | if (pAssocReq->addtsPresent) |
| 989 | { |
| 990 | tANI_U8 tspecIdx = 0; //index in the sch tspec table. |
| 991 | if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq), |
| 992 | &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS) |
| 993 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 994 | limLog(pMac, LOGE, FL("AdmitControl: TSPEC rejected")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | limSendAssocRspMgmtFrame( |
| 996 | pMac, |
| 997 | eSIR_MAC_QAP_NO_BANDWIDTH_REASON, |
| 998 | 1, |
| 999 | pHdr->sa, |
| 1000 | subType, 0,psessionEntry); |
| 1001 | #ifdef WLAN_DEBUG |
| 1002 | pMac->lim.gLimNumAssocReqDropACRejectTS++; |
| 1003 | #endif |
| 1004 | goto error; |
| 1005 | } |
| 1006 | } |
| 1007 | else if (limAdmitControlAddSta(pMac, pHdr->sa, false) |
| 1008 | != eSIR_SUCCESS) |
| 1009 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 1010 | limLog(pMac, LOGE, FL("AdmitControl: Sta rejected")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | limSendAssocRspMgmtFrame( |
| 1012 | pMac, |
| 1013 | eSIR_MAC_QAP_NO_BANDWIDTH_REASON, |
| 1014 | 1, |
| 1015 | pHdr->sa, |
| 1016 | subType, 0,psessionEntry); |
| 1017 | #ifdef WLAN_DEBUG |
| 1018 | pMac->lim.gLimNumAssocReqDropACRejectSta++; |
| 1019 | #endif |
| 1020 | goto error; |
| 1021 | } |
| 1022 | |
| 1023 | // else all ok |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1024 | limLog(pMac, LOG1, FL("AdmitControl: Sta OK!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1025 | } |
| 1026 | |
| 1027 | /** |
| 1028 | * STA is Associated ! |
| 1029 | */ |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1030 | limLog(pMac, LOGE, FL("Received %s Req successful from "MAC_ADDRESS_STR), |
| 1031 | (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | |
| 1033 | /** |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1034 | * AID for this association will be same as the peer Index used in DPH table. |
| 1035 | * Assign unused/least recently used peer Index from perStaDs. |
| 1036 | * NOTE: limAssignPeerIdx() assigns AID values ranging |
| 1037 | * between 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1038 | */ |
| 1039 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1040 | peerIdx = limAssignPeerIdx(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1041 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1042 | if (!peerIdx) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1043 | { |
| 1044 | // Could not assign AID |
| 1045 | // Reject association |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 1046 | limLog(pMac, LOGE, FL("PeerIdx not avaialble. Reject associaton")); |
| 1047 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1048 | limRejectAssociation(pMac, pHdr->sa, |
| 1049 | subType, true, authType, |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1050 | peerIdx, false, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1051 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 1052 | |
| 1053 | goto error; |
| 1054 | } |
| 1055 | |
| 1056 | /** |
| 1057 | * Add an entry to hash table maintained by DPH module |
| 1058 | */ |
| 1059 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1060 | pStaDs = dphAddHashEntry(pMac, pHdr->sa, peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1061 | |
| 1062 | if (pStaDs == NULL) |
| 1063 | { |
| 1064 | // Could not add hash table entry at DPH |
| 1065 | limLog(pMac, LOGE, |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1066 | FL("could not add hash entry at DPH for aid=%d, MacAddr:" |
| 1067 | MAC_ADDRESS_STR), |
| 1068 | peerIdx,MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | |
| 1070 | // Release AID |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1071 | limReleasePeerIdx(pMac, peerIdx, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1072 | |
| 1073 | limRejectAssociation(pMac, pHdr->sa, |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1074 | subType, true, authType, peerIdx, false, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1075 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 1076 | |
| 1077 | goto error; |
| 1078 | } |
| 1079 | |
| 1080 | |
| 1081 | sendIndToSme: |
| 1082 | |
| 1083 | psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq; |
| 1084 | |
| 1085 | pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1086 | #ifdef WLAN_FEATURE_11AC |
| 1087 | pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present; |
| 1088 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1089 | pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true; |
| 1090 | pStaDs->qos.addts = pAssocReq->addtsReq; |
| 1091 | pStaDs->qos.capability = pAssocReq->qosCapability; |
| 1092 | pStaDs->versionPresent = 0; |
| 1093 | /* short slot and short preamble should be updated before doing limaddsta */ |
| 1094 | pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble; |
| 1095 | pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime; |
| 1096 | |
| 1097 | if (pAssocReq->propIEinfo.versionPresent) //update STA version info |
| 1098 | { |
| 1099 | pStaDs->versionPresent = 1; |
| 1100 | pStaDs->version = pAssocReq->propIEinfo.version; |
| 1101 | } |
| 1102 | pStaDs->propCapability = 0; |
| 1103 | if (pAssocReq->propIEinfo.capabilityPresent) |
| 1104 | { |
| 1105 | if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability)) |
| 1106 | pStaDs->propCapability &= pAssocReq->propIEinfo.capability; |
| 1107 | } |
| 1108 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1109 | pStaDs->valid = 0; |
| 1110 | pStaDs->mlmStaContext.authType = authType; |
| 1111 | pStaDs->staType = STA_ENTRY_PEER; |
| 1112 | |
| 1113 | //TODO: If listen interval is more than certain limit, reject the association. |
| 1114 | //Need to check customer requirements and then implement. |
| 1115 | pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval; |
| 1116 | pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo; |
| 1117 | |
| 1118 | /* The following count will be used to knock-off the station if it doesn't |
| 1119 | * come back to receive the buffered data. The AP will wait for numTimSent number |
| 1120 | * of beacons after sending TIM information for the station, before assuming that |
| 1121 | * the station is no more associated and disassociates it |
| 1122 | */ |
| 1123 | |
| 1124 | /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/ |
| 1125 | pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval); |
| 1126 | |
| 1127 | /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */ |
| 1128 | pStaDs->curTxMpduCnt = 0; |
| 1129 | |
| 1130 | if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) && |
| 1131 | (pAssocReq->HTCaps.present)) |
| 1132 | { |
| 1133 | pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField; |
| 1134 | pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity; |
| 1135 | pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz; |
| 1136 | pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection; |
| 1137 | pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize; |
| 1138 | pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor; |
| 1139 | pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave; |
| 1140 | pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz; |
| 1141 | pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz; |
| 1142 | pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1143 | /* peer just follows AP; so when we are softAP/GO, we just store our session entry's secondary channel offset here in peer INFRA STA |
| 1144 | * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero |
| 1145 | */ |
| 1146 | pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0; |
| 1147 | #ifdef WLAN_FEATURE_11AC |
Mohit Khanna | 7d5aeb2 | 2012-09-11 16:21:57 -0700 | [diff] [blame] | 1148 | if(pAssocReq->operMode.present) |
| 1149 | { |
| 1150 | pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pAssocReq->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ); |
| 1151 | pStaDs->htSupportedChannelWidthSet = (tANI_U8)(pAssocReq->operMode.chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ); |
| 1152 | } |
| 1153 | else if (pAssocReq->VHTCaps.present) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1154 | { |
Madan Mohan Koyyalamudi | 740f780 | 2012-09-24 14:17:14 -0700 | [diff] [blame] | 1155 | // Check if STA has enabled it's channel bonding mode. |
| 1156 | // If channel bonding mode is enabled, we decide based on SAP's current configuration. |
| 1157 | // else, we set it to VHT20. |
| 1158 | pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pStaDs->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ? |
| 1159 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ : |
| 1160 | psessionEntry->vhtTxChannelWidthSet ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1161 | } |
Madan Mohan Koyyalamudi | cc39440 | 2012-10-05 10:48:19 -0700 | [diff] [blame] | 1162 | |
| 1163 | // Lesser among the AP and STA bandwidth of operation. |
| 1164 | pStaDs->htSupportedChannelWidthSet = |
| 1165 | (pStaDs->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ? |
| 1166 | pStaDs->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ; |
| 1167 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1168 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1169 | pStaDs->baPolicyFlag = 0xFF; |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1170 | pStaDs->htLdpcCapable = (tANI_U8)pAssocReq->HTCaps.advCodingCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1171 | } |
| 1172 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1173 | if(pAssocReq->VHTCaps.present) |
| 1174 | { |
| 1175 | pStaDs->vhtLdpcCapable = (tANI_U8)pAssocReq->VHTCaps.ldpcCodingCap; |
| 1176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1177 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1178 | #ifdef WLAN_FEATURE_11AC |
| 1179 | if (limPopulateMatchingRateSet(pMac, |
| 1180 | pStaDs, |
| 1181 | &(pAssocReq->supportedRates), |
| 1182 | &(pAssocReq->extendedRates), |
| 1183 | pAssocReq->HTCaps.supportedMCSSet, |
| 1184 | &(pAssocReq->propIEinfo.propRates), |
| 1185 | psessionEntry , &pAssocReq->VHTCaps) |
| 1186 | != eSIR_SUCCESS) |
| 1187 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1188 | |
| 1189 | if (limPopulateMatchingRateSet(pMac, |
| 1190 | pStaDs, |
| 1191 | &(pAssocReq->supportedRates), |
| 1192 | &(pAssocReq->extendedRates), |
| 1193 | pAssocReq->HTCaps.supportedMCSSet, |
| 1194 | &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1195 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1196 | { |
| 1197 | // Could not update hash table entry at DPH with rateset |
| 1198 | limLog(pMac, LOGE, |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1199 | FL("could not update hash entry at DPH for aid=%d, MacAddr: " |
| 1200 | MAC_ADDRESS_STR), |
| 1201 | peerIdx, MAC_ADDR_ARRAY(pHdr->sa)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1202 | |
| 1203 | // Release AID |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1204 | limReleasePeerIdx(pMac, peerIdx, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1205 | |
| 1206 | |
| 1207 | limRejectAssociation(pMac, pHdr->sa, |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1208 | subType, true, authType, peerIdx, true, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1209 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 1210 | |
Kiran Kumar Lokere | fdf4241 | 2013-07-17 17:40:58 -0700 | [diff] [blame] | 1211 | pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId]; |
| 1212 | goto error; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1213 | } |
| 1214 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1215 | vos_mem_copy((tANI_U8 *) &pStaDs->mlmStaContext.propRateSet, |
| 1216 | (tANI_U8 *) &(pAssocReq->propIEinfo.propRates), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1217 | pAssocReq->propIEinfo.propRates.numPropRates + 1); |
| 1218 | |
| 1219 | /// Add STA context at MAC HW (BMU, RHP & TFP) |
| 1220 | |
| 1221 | pStaDs->qosMode = eANI_BOOLEAN_FALSE; |
| 1222 | pStaDs->lleEnabled = eANI_BOOLEAN_FALSE; |
| 1223 | if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET)) |
| 1224 | { |
| 1225 | pStaDs->lleEnabled = eANI_BOOLEAN_TRUE; |
| 1226 | pStaDs->qosMode = eANI_BOOLEAN_TRUE; |
| 1227 | } |
| 1228 | |
| 1229 | pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE; |
| 1230 | pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE; |
| 1231 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1232 | //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled) |
| 1233 | if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET)) |
| 1234 | { |
| 1235 | pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE; |
| 1236 | pStaDs->qosMode = eANI_BOOLEAN_TRUE; |
| 1237 | limGetWsmMode(psessionEntry, &wsmMode); |
| 1238 | /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD |
| 1239 | can coexist */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1240 | if( pAssocReq->WMMInfoStation.present) |
| 1241 | { |
| 1242 | /* check whether AP supports or not */ |
| 1243 | if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1244 | && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd |
| 1245 | || pAssocReq->WMMInfoStation.acbk_uapsd |
| 1246 | || pAssocReq->WMMInfoStation.acvo_uapsd |
| 1247 | || pAssocReq->WMMInfoStation.acvi_uapsd)) |
| 1248 | { |
| 1249 | |
| 1250 | /** |
| 1251 | * Received Re/Association Request from |
| 1252 | * STA when UPASD is not supported. |
| 1253 | */ |
Deepthi Gowri | cabd4d1 | 2014-11-13 12:51:16 +0530 | [diff] [blame] | 1254 | limLog( pMac, LOGE, FL( "AP do not support UAPSD so reply " |
| 1255 | "to STA accordingly" )); |
| 1256 | /* update UAPSD and send it to LIM to add STA */ |
| 1257 | pStaDs->qos.capability.qosInfo.acbe_uapsd = 0; |
| 1258 | pStaDs->qos.capability.qosInfo.acbk_uapsd = 0; |
| 1259 | pStaDs->qos.capability.qosInfo.acvo_uapsd = 0; |
| 1260 | pStaDs->qos.capability.qosInfo.acvi_uapsd = 0; |
| 1261 | pStaDs->qos.capability.qosInfo.maxSpLen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1263 | } |
| 1264 | else |
| 1265 | { |
| 1266 | /* update UAPSD and send it to LIM to add STA */ |
| 1267 | pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd; |
| 1268 | pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd; |
| 1269 | pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd; |
| 1270 | pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd; |
| 1271 | pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length; |
| 1272 | } |
| 1273 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1274 | //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled) |
| 1275 | if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET)) |
| 1276 | pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE; |
| 1277 | |
| 1278 | } |
| 1279 | |
| 1280 | // Re/Assoc Response frame to requesting STA |
| 1281 | pStaDs->mlmStaContext.subType = subType; |
| 1282 | |
| 1283 | if (pAssocReq->propIEinfo.aniIndicator) |
| 1284 | pStaDs->aniPeer = 1; |
| 1285 | |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1286 | #ifdef WLAN_FEATURE_11W |
| 1287 | pStaDs->rmfEnabled = (pmfConnection) ? 1 : 0; |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1288 | pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; |
| 1289 | timerId.fields.sessionId = psessionEntry->peSessionId; |
| 1290 | timerId.fields.peerIdx = peerIdx; |
| 1291 | if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1292 | &retryInterval) != eSIR_SUCCESS) |
| 1293 | { |
| 1294 | limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query retry interval value")); |
| 1295 | limRejectAssociation(pMac, pHdr->sa, |
| 1296 | subType, true, authType, |
| 1297 | peerIdx, false, |
| 1298 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 1299 | goto error; |
| 1300 | } |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame^] | 1301 | if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN > retryInterval) |
Abhishek Singh | bf9f7d8 | 2014-09-25 16:24:59 +0530 | [diff] [blame] | 1302 | { |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame^] | 1303 | retryInterval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF; |
Abhishek Singh | bf9f7d8 | 2014-09-25 16:24:59 +0530 | [diff] [blame] | 1304 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1305 | if (tx_timer_create(&pStaDs->pmfSaQueryTimer, "PMF SA Query timer", |
| 1306 | limPmfSaQueryTimerHandler, timerId.value, |
| 1307 | SYS_MS_TO_TICKS((retryInterval * 1024) / 1000), |
| 1308 | 0, TX_NO_ACTIVATE) != TX_SUCCESS) |
| 1309 | { |
| 1310 | limLog(pMac, LOGE, FL("could not create PMF SA Query timer")); |
| 1311 | limRejectAssociation(pMac, pHdr->sa, |
| 1312 | subType, true, authType, |
| 1313 | peerIdx, false, |
| 1314 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 1315 | goto error; |
| 1316 | } |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1317 | #endif |
| 1318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1319 | // BTAMP: Storing the parsed assoc request in the psessionEntry array |
| 1320 | psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq; |
| 1321 | |
| 1322 | /* BTAMP: If STA context already exist (ie. updateContext = 1) |
| 1323 | * for this STA, then we should delete the old one, and add |
| 1324 | * the new STA. This is taken care of in the limDelSta() routine. |
| 1325 | * |
| 1326 | * Prior to BTAMP, we were setting this flag so that when |
| 1327 | * PE receives SME_ASSOC_CNF, and if this flag is set, then |
| 1328 | * PE shall delete the old station and then add. But now in |
| 1329 | * BTAMP, we're directly adding station before waiting for |
| 1330 | * SME_ASSOC_CNF, so we can do this now. |
| 1331 | */ |
| 1332 | if (!updateContext) |
| 1333 | { |
| 1334 | pStaDs->mlmStaContext.updateContext = 0; |
| 1335 | |
| 1336 | // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1337 | if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1338 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1339 | limLog(pMac, LOGE, FL("could not Add STA with assocId=%d"), |
| 1340 | pStaDs->assocId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1341 | limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, |
| 1342 | true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true, |
| 1343 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 1344 | |
Kiran Kumar Lokere | fdf4241 | 2013-07-17 17:40:58 -0700 | [diff] [blame] | 1345 | pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId]; |
| 1346 | goto error; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1347 | } |
| 1348 | } |
| 1349 | else |
| 1350 | { |
| 1351 | pStaDs->mlmStaContext.updateContext = 1; |
| 1352 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1353 | mlmPrevState = pStaDs->mlmStaContext.mlmState; |
| 1354 | |
| 1355 | /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */ |
| 1356 | if(subType != LIM_REASSOC) |
| 1357 | { |
| 1358 | //we need to set the mlmState here in order differentiate in limDelSta. |
| 1359 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE; |
| 1360 | if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS) |
| 1361 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1362 | limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d"), |
| 1363 | pStaDs->assocId, pStaDs->staIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1364 | limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType, |
| 1365 | pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 1366 | |
| 1367 | //Restoring the state back. |
| 1368 | pStaDs->mlmStaContext.mlmState = mlmPrevState; |
Kiran Kumar Lokere | fdf4241 | 2013-07-17 17:40:58 -0700 | [diff] [blame] | 1369 | pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1370 | goto error; |
| 1371 | } |
| 1372 | } |
| 1373 | else |
| 1374 | { |
| 1375 | /* mlmState is changed in limAddSta context */ |
| 1376 | /* use the same AID, already allocated */ |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1377 | if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1378 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 1379 | limLog(pMac, LOGE, FL( "Could not AddSta with assocId= %d staId %d"), |
| 1380 | pStaDs->assocId, pStaDs->staIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1381 | limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType, |
| 1382 | pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry); |
| 1383 | |
| 1384 | //Restoring the state back. |
| 1385 | pStaDs->mlmStaContext.mlmState = mlmPrevState; |
Kiran Kumar Lokere | fdf4241 | 2013-07-17 17:40:58 -0700 | [diff] [blame] | 1386 | pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1387 | goto error; |
| 1388 | } |
| 1389 | |
| 1390 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1391 | |
| 1392 | } |
| 1393 | |
| 1394 | return; |
| 1395 | |
| 1396 | error: |
| 1397 | if (pAssocReq != NULL) |
| 1398 | { |
| 1399 | if ( pAssocReq->assocReqFrame ) |
| 1400 | { |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1401 | vos_mem_free(pAssocReq->assocReqFrame); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1402 | pAssocReq->assocReqFrame = NULL; |
| 1403 | } |
| 1404 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1405 | vos_mem_free(pAssocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1406 | } |
| 1407 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1408 | /* If it is not duplicate Assoc request then only make to Null */ |
| 1409 | if ((pStaDs != NULL) && |
| 1410 | (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1411 | psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1412 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1413 | return; |
| 1414 | |
| 1415 | } /*** end limProcessAssocReqFrame() ***/ |
| 1416 | |
| 1417 | |
| 1418 | |
| 1419 | /**--------------------------------------------------------------- |
| 1420 | \fn limSendMlmAssocInd |
| 1421 | \brief This function sends either LIM_MLM_ASSOC_IND |
| 1422 | \ or LIM_MLM_REASSOC_IND to SME. |
| 1423 | \ |
| 1424 | \param pMac |
| 1425 | \param *pStaDs - Station DPH hash entry |
| 1426 | \param psessionEntry - PE session entry |
| 1427 | \return None |
| 1428 | |
| 1429 | * ?????? How do I get |
| 1430 | * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest |
| 1431 | * - aid =====> pStaDs->assocId |
| 1432 | * - pHdr->sa =====> pStaDs->staAddr |
| 1433 | * - authType |
| 1434 | * - pHdr->seqControl =====> no longer needed |
| 1435 | * - pStaDs |
| 1436 | ------------------------------------------------------------------*/ |
| 1437 | void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry) |
| 1438 | { |
| 1439 | tpLimMlmAssocInd pMlmAssocInd = NULL; |
| 1440 | tpLimMlmReassocInd pMlmReassocInd; |
| 1441 | tpSirAssocReq pAssocReq; |
| 1442 | tANI_U16 temp; |
| 1443 | tANI_U32 phyMode; |
| 1444 | tANI_U8 subType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1445 | tANI_U8 *wpsIe = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1446 | tANI_U32 tmp; |
| 1447 | // tANI_U16 statusCode; |
| 1448 | tANI_U16 i, j=0; |
| 1449 | |
| 1450 | // Get a copy of the already parsed Assoc Request |
| 1451 | pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId]; |
| 1452 | |
| 1453 | // Get the phyMode |
| 1454 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1455 | // Extract pre-auth context for the peer BTAMP-STA, if any. |
| 1456 | |
| 1457 | // Determiine if its Assoc or ReAssoc Request |
| 1458 | if (pAssocReq->reassocRequest == 1) |
| 1459 | subType = LIM_REASSOC; |
| 1460 | else |
| 1461 | subType = LIM_ASSOC; |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1462 | |
| 1463 | limLog(pMac, LOG1, FL("Sessionid %d ssid %s subtype %d Associd %d staAddr " |
| 1464 | MAC_ADDRESS_STR), psessionEntry->peSessionId, pAssocReq->ssId.ssId, |
| 1465 | subType,pStaDs->assocId,MAC_ADDR_ARRAY(pStaDs->staAddr)); |
| 1466 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1467 | if (subType == LIM_ASSOC || subType == LIM_REASSOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1468 | { |
| 1469 | temp = sizeof(tLimMlmAssocInd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1470 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1471 | pMlmAssocInd = vos_mem_malloc(temp); |
| 1472 | if (NULL == pMlmAssocInd) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1473 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1474 | limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry); |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1475 | limLog(pMac, LOGP, FL("AllocateMemory failed for pMlmAssocInd")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1476 | return; |
| 1477 | } |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1478 | vos_mem_set(pMlmAssocInd, temp ,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1479 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1480 | vos_mem_copy((tANI_U8 *)pMlmAssocInd->peerMacAddr, |
| 1481 | (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1482 | |
| 1483 | pMlmAssocInd->aid = pStaDs->assocId; |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1484 | vos_mem_copy((tANI_U8 *)&pMlmAssocInd->ssId, |
| 1485 | (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1486 | pMlmAssocInd->sessionId = psessionEntry->peSessionId; |
| 1487 | pMlmAssocInd->authType = pStaDs->mlmStaContext.authType; |
| 1488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1489 | pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo; |
| 1490 | |
| 1491 | // Fill in RSN IE information |
| 1492 | pMlmAssocInd->rsnIE.length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1493 | // if WPS IE is present, ignore RSN IE |
| 1494 | if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) { |
| 1495 | wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length); |
| 1496 | } |
| 1497 | if (pAssocReq->rsnPresent && (NULL == wpsIe)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1498 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1499 | limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d"), |
| 1500 | pAssocReq->rsn.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1501 | pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length; |
| 1502 | pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID; |
| 1503 | pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length; |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1504 | vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[2], |
| 1505 | pAssocReq->rsn.info, |
| 1506 | pAssocReq->rsn.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1507 | } |
| 1508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1509 | // Fill in 802.11h related info |
| 1510 | if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent) |
| 1511 | { |
| 1512 | pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE; |
| 1513 | pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower; |
| 1514 | pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower; |
| 1515 | limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq); |
| 1516 | } |
| 1517 | else |
| 1518 | pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE; |
| 1519 | |
| 1520 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1521 | /* This check is to avoid extra Sec IEs present incase of WPS */ |
| 1522 | if (pAssocReq->wpaPresent && (NULL == wpsIe)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1523 | { |
| 1524 | if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH) |
| 1525 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1526 | PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d"), |
| 1527 | pMlmAssocInd->rsnIE.length);) |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1528 | vos_mem_free(pMlmAssocInd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1529 | return; |
| 1530 | } |
| 1531 | pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID; |
| 1532 | pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length; |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1533 | vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2], |
| 1534 | pAssocReq->wpa.info, |
| 1535 | pAssocReq->wpa.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1536 | pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length; |
| 1537 | } |
| 1538 | |
| 1539 | |
| 1540 | pMlmAssocInd->addIE.length = 0; |
| 1541 | if (pAssocReq->addIEPresent) |
| 1542 | { |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1543 | vos_mem_copy(&pMlmAssocInd->addIE.addIEdata, |
| 1544 | pAssocReq->addIE.addIEdata, |
| 1545 | pAssocReq->addIE.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | |
| 1547 | pMlmAssocInd->addIE.length = pAssocReq->addIE.length; |
| 1548 | } |
| 1549 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1550 | if(pAssocReq->wmeInfoPresent) |
| 1551 | { |
| 1552 | |
| 1553 | if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS) |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1554 | limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"), |
| 1555 | WNI_CFG_WME_ENABLED ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1556 | |
| 1557 | /* check whether AP is enabled with WMM */ |
| 1558 | if(tmp) |
| 1559 | { |
| 1560 | pMlmAssocInd->WmmStaInfoPresent = 1; |
| 1561 | } |
| 1562 | else |
| 1563 | { |
| 1564 | pMlmAssocInd->WmmStaInfoPresent= 0; |
| 1565 | } |
| 1566 | /* Note: we are not rejecting association here because IOT will fail */ |
| 1567 | |
| 1568 | } |
Hardik Kantilal Patel | 1ba630f | 2014-11-21 04:32:05 +0530 | [diff] [blame] | 1569 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1570 | if(pAssocReq->HTCaps.present) |
| 1571 | { |
| 1572 | limLog(pMac, LOGW, FL("HT40MHzInto: %d"), |
| 1573 | pAssocReq->HTCaps.stbcControlFrame); |
| 1574 | pMlmAssocInd->HT40MHzIntoPresent = |
| 1575 | pAssocReq->HTCaps.stbcControlFrame; |
| 1576 | } |
| 1577 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1578 | |
| 1579 | // Required for indicating the frames to upper layer |
| 1580 | pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength; |
| 1581 | pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame; |
| 1582 | |
| 1583 | pMlmAssocInd->beaconPtr = psessionEntry->beacon; |
| 1584 | pMlmAssocInd->beaconLength = psessionEntry->bcnLen; |
| 1585 | |
| 1586 | limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd); |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1587 | vos_mem_free(pMlmAssocInd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1588 | } |
| 1589 | else |
| 1590 | { |
| 1591 | // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND |
| 1592 | temp = sizeof(tLimMlmReassocInd); |
| 1593 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1594 | pMlmReassocInd = vos_mem_malloc(temp); |
| 1595 | if (NULL == pMlmReassocInd) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1596 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1597 | limLog(pMac, LOGP, FL("call to AllocateMemory failed for " |
| 1598 | "pMlmReassocInd")); |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1599 | limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1600 | return; |
| 1601 | } |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1602 | vos_mem_set(pMlmReassocInd, temp, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1603 | |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1604 | vos_mem_copy((tANI_U8 *) pMlmReassocInd->peerMacAddr, |
| 1605 | (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr)); |
| 1606 | vos_mem_copy((tANI_U8 *) pMlmReassocInd->currentApAddr, |
| 1607 | (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | pMlmReassocInd->aid = pStaDs->assocId; |
| 1609 | pMlmReassocInd->authType = pStaDs->mlmStaContext.authType; |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1610 | vos_mem_copy((tANI_U8 *)&pMlmReassocInd->ssId, |
| 1611 | (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1612 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1613 | if (pAssocReq->propIEinfo.aniIndicator) |
| 1614 | pStaDs->aniPeer = 1; |
| 1615 | |
| 1616 | pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo; |
| 1617 | pMlmReassocInd->rsnIE.length = 0; |
| 1618 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1619 | if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) |
| 1620 | wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length); |
| 1621 | |
| 1622 | if (pAssocReq->rsnPresent && (NULL == wpsIe)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1623 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1624 | limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d"), |
| 1625 | pAssocReq->rsn.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1626 | pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length; |
| 1627 | pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID; |
| 1628 | pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length; |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1629 | vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[2], |
| 1630 | pAssocReq->rsn.info, pAssocReq->rsn.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1631 | } |
| 1632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1633 | // 802.11h support |
| 1634 | if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent) |
| 1635 | { |
| 1636 | pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE; |
| 1637 | pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower; |
| 1638 | pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower; |
| 1639 | pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2); |
| 1640 | |
| 1641 | limLog(pMac, LOG1, |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1642 | FL("Sending Reassoc Ind: spectrum ON, minPwr %d, " |
| 1643 | "maxPwr %d, numChnl %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1644 | pMlmReassocInd->powerCap.minTxPower, |
| 1645 | pMlmReassocInd->powerCap.maxTxPower, |
| 1646 | pMlmReassocInd->supportedChannels.numChnl); |
| 1647 | |
| 1648 | for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++) |
| 1649 | { |
| 1650 | pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j]; |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1651 | limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1652 | i, pMlmReassocInd->supportedChannels.channelList[i]); |
| 1653 | j+=2; |
| 1654 | } |
| 1655 | } |
| 1656 | else |
| 1657 | pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE; |
| 1658 | |
| 1659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1660 | /* This check is to avoid extra Sec IEs present incase of WPS */ |
| 1661 | if (pAssocReq->wpaPresent && (NULL == wpsIe)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1662 | { |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1663 | limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d"), |
| 1664 | pAssocReq->wpa.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1665 | pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID; |
| 1666 | pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length; |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1667 | vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2], |
| 1668 | pAssocReq->wpa.info, |
| 1669 | pAssocReq->wpa.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1670 | pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length; |
| 1671 | } |
| 1672 | |
| 1673 | pMlmReassocInd->addIE.length = 0; |
| 1674 | if (pAssocReq->addIEPresent) |
| 1675 | { |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1676 | vos_mem_copy(&pMlmReassocInd->addIE.addIEdata, |
| 1677 | pAssocReq->addIE.addIEdata, |
| 1678 | pAssocReq->addIE.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1679 | |
| 1680 | pMlmReassocInd->addIE.length = pAssocReq->addIE.length; |
| 1681 | } |
| 1682 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1683 | if(pAssocReq->wmeInfoPresent) |
| 1684 | { |
| 1685 | |
| 1686 | if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS) |
Abhishek Singh | 5170f9c | 2013-12-18 16:55:22 +0530 | [diff] [blame] | 1687 | limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"), |
| 1688 | WNI_CFG_WME_ENABLED ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1689 | |
| 1690 | /* check whether AP is enabled with WMM */ |
| 1691 | if(tmp) |
| 1692 | { |
| 1693 | pMlmReassocInd->WmmStaInfoPresent = 1; |
| 1694 | } |
| 1695 | else |
| 1696 | { |
| 1697 | pMlmReassocInd->WmmStaInfoPresent = 0; |
| 1698 | } |
| 1699 | /* Note: we are not rejecting Re-association here because IOT will fail */ |
| 1700 | |
| 1701 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1702 | |
Hardik Kantilal Patel | 1ba630f | 2014-11-21 04:32:05 +0530 | [diff] [blame] | 1703 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1704 | if(pAssocReq->HTCaps.present) |
| 1705 | { |
| 1706 | limLog(pMac, LOGW, FL("RASSOC HT40MHzInto: %d"), |
| 1707 | pAssocReq->HTCaps.stbcControlFrame); |
| 1708 | pMlmReassocInd->HT40MHzIntoPresent = |
| 1709 | pAssocReq->HTCaps.stbcControlFrame; |
| 1710 | } |
| 1711 | #endif |
| 1712 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1713 | // Required for indicating the frames to upper layer |
| 1714 | pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength; |
| 1715 | pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame; |
| 1716 | |
| 1717 | pMlmReassocInd->beaconPtr = psessionEntry->beacon; |
| 1718 | pMlmReassocInd->beaconLength = psessionEntry->bcnLen; |
| 1719 | |
| 1720 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd); |
Bansidhar Gopalachari | 2f7395d | 2013-07-12 11:24:23 +0530 | [diff] [blame] | 1721 | vos_mem_free(pMlmReassocInd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1722 | } |
| 1723 | |
| 1724 | return; |
| 1725 | |
| 1726 | } /*** end limSendMlmAssocInd() ***/ |