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