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