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