blob: b5de245dda021abe95c0eab1eeb9877295126622 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam842dad02014-02-18 18:44:02 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file limProcessAssocReqFrame.cc contains the code
30 * for processing Re/Association Request Frame.
31 * Author: Chandra Modumudi
32 * Date: 03/18/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 * 05/26/10 js WPA handling in (Re)Assoc frames
37 *
38 */
39#include "palTypes.h"
40#include "aniGlobal.h"
Satyanarayana Dash6f438272015-03-03 18:01:06 +053041#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070042#include "sirApi.h"
43#include "cfgApi.h"
44
45#include "schApi.h"
46#include "pmmApi.h"
47#include "utilsApi.h"
48#include "limTypes.h"
49#include "limUtils.h"
50#include "limAssocUtils.h"
51#include "limSecurityUtils.h"
52#include "limSerDesUtils.h"
53#include "limStaHashApi.h"
54#include "limAdmitControl.h"
55#include "palApi.h"
Gopichand Nakkala777e6032012-12-31 16:39:21 -080056#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057
58
59#include "vos_types.h"
60/**
61 * limConvertSupportedChannels
62 *
63 *FUNCTION:
64 * This function is called by limProcessAssocReqFrame() to
65 * parse the channel support IE in the Assoc/Reassoc Request
66 * frame, and send relevant information in the SME_ASSOC_IND
67 *
68 *NOTE:
69 *
70 * @param pMac - A pointer to Global MAC structure
71 * @param pMlmAssocInd - A pointer to SME ASSOC/REASSOC IND
72 * @param assocReq - A pointer to ASSOC/REASSOC Request frame
73 *
74 * @return None
75 */
76static void
77limConvertSupportedChannels(tpAniSirGlobal pMac,
78 tpLimMlmAssocInd pMlmAssocInd,
79 tSirAssocReq *assocReq)
80{
81
82 tANI_U16 i, j, index=0;
83 tANI_U8 firstChannelNumber;
84 tANI_U8 numberOfChannel;
85 tANI_U8 nextChannelNumber;
86
87 if(assocReq->supportedChannels.length >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
88 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +053089 limLog(pMac, LOG1, FL("Number of supported channels:%d is more than "
90 "MAX"), assocReq->supportedChannels.length);
Jeff Johnson295189b2012-06-20 16:38:30 -070091 pMlmAssocInd->supportedChannels.numChnl = 0;
92 return;
93 }
94
95 for(i=0; i < (assocReq->supportedChannels.length); i++)
96 {
97 // Get First Channel Number
98 firstChannelNumber = assocReq->supportedChannels.supportedChannels[i];
99 pMlmAssocInd->supportedChannels.channelList[index] = firstChannelNumber;
100 i++;
101 index++;
102 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
103 {
104 pMlmAssocInd->supportedChannels.numChnl = 0;
105 return;
106 }
107 // Get Number of Channels in a Subband
108 numberOfChannel = assocReq->supportedChannels.supportedChannels[i];
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700109 PELOG2(limLog(pMac, LOG2, FL("Rcv AssocReq: chnl=%d, numOfChnl=%d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700110 firstChannelNumber, numberOfChannel);)
111
112 if (numberOfChannel > 1)
113 {
114 nextChannelNumber = firstChannelNumber;
115 if(SIR_BAND_5_GHZ == limGetRFBand(firstChannelNumber))
116 {
117 for (j=1; j < numberOfChannel; j++)
118 {
119 nextChannelNumber += SIR_11A_FREQUENCY_OFFSET;
120 pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
121 index++;
122 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
123 {
124 pMlmAssocInd->supportedChannels.numChnl = 0;
125 return;
126 }
127 }
128 }
129 else if(SIR_BAND_2_4_GHZ == limGetRFBand(firstChannelNumber))
130 {
131 for (j=1; j < numberOfChannel; j++)
132 {
133 nextChannelNumber += SIR_11B_FREQUENCY_OFFSET;
134 pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
135 index++;
136 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
137 {
138 pMlmAssocInd->supportedChannels.numChnl = 0;
139 return;
140 }
141 }
142 }
143 }
144 }
145
146 pMlmAssocInd->supportedChannels.numChnl = (tANI_U8) index;
147 PELOG2(limLog(pMac, LOG2,
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530148 FL("Send AssocInd to WSM: spectrum ON, minPwr %d, maxPwr %d, "
149 "numChnl %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700150 pMlmAssocInd->powerCap.minTxPower,
151 pMlmAssocInd->powerCap.maxTxPower,
152 pMlmAssocInd->supportedChannels.numChnl);)
153}
154
155
156/**---------------------------------------------------------------
157\fn limProcessAssocReqFrame
158\brief This function is called by limProcessMessageQueue()
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800159\ upon Re/Association Request frame reception in
Jeff Johnson295189b2012-06-20 16:38:30 -0700160\ BTAMP AP or Soft AP role.
161\
162\param pMac
163\param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800164\param subType - Indicates whether it is Association Request(=0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700165\ or Reassociation Request(=1) frame
166\return None
167------------------------------------------------------------------*/
168void
169limProcessAssocReqFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,
170 tANI_U8 subType, tpPESession psessionEntry)
171{
172 tANI_U8 updateContext;
173 tANI_U8 *pBody;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800174 tANI_U16 peerIdx, temp;
Jeff Johnson295189b2012-06-20 16:38:30 -0700175 tANI_U32 val;
176 tANI_S32 framelen;
177 tSirRetStatus status;
178 tpSirMacMgmtHdr pHdr;
179 struct tLimPreAuthNode *pStaPreAuthContext;
180 tAniAuthType authType;
181 tSirMacCapabilityInfo localCapabilities;
182 tpDphHashNode pStaDs = NULL;
183 tpSirAssocReq pAssocReq;
Jeff Johnson295189b2012-06-20 16:38:30 -0700184 tLimMlmStates mlmPrevState;
185 tDot11fIERSN Dot11fIERSN;
186 tDot11fIEWPA Dot11fIEWPA;
Jeff Johnson295189b2012-06-20 16:38:30 -0700187 tANI_U32 phyMode;
188 tHalBitVal qosMode;
189 tHalBitVal wsmMode, wmeMode;
190 tANI_U8 *wpsIe = NULL;
191 tSirMacRateSet basicRates;
192 tANI_U8 i = 0, j = 0;
Chet Lanctot055d2a32013-08-31 17:29:03 -0700193 tANI_BOOLEAN pmfConnection = eANI_BOOLEAN_FALSE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800194#ifdef WLAN_FEATURE_11W
195 tPmfSaQueryTimerId timerId;
196 tANI_U32 retryInterval;
197#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700198
199 limGetPhyMode(pMac, &phyMode, psessionEntry);
200
201 limGetQosMode(psessionEntry, &qosMode);
202
203 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
204 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
205
Abhishek Singh744e0582014-11-20 15:32:32 +0530206 limLog(pMac, LOG1, FL("Received %s Req Frame on sessionid: %d systemrole %d"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530207 " limMlmState %d from: "MAC_ADDRESS_STR),
208 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
209 psessionEntry->peSessionId, psessionEntry->limSystemRole,
210 psessionEntry->limMlmState, MAC_ADDR_ARRAY(pHdr->sa));
211
Abhishek Singh744e0582014-11-20 15:32:32 +0530212 if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE )
213 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530214 limLog(pMac, LOGE, FL("received unexpected ASSOC REQ on sessionid: %d "
215 "sys subType=%d for role=%d from: "MAC_ADDRESS_STR),
216 psessionEntry->peSessionId,
217 subType, psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700218 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
219 WDA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen);
220 return;
221 }
222
Abhishek Singh744e0582014-11-20 15:32:32 +0530223 /*
224 * If a STA is already present in DPH and it
225 * is initiating a Assoc re-transmit, do not
226 * process it. This can happen when first Assoc Req frame
227 * is received but ACK lost at STA side. The ACK for this
228 * dropped Assoc Req frame should be sent by HW. Host simply
229 * does not process it once the entry for the STA is already
230 * present in DPH.
231 */
232 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx,
233 &psessionEntry->dph.dphHashTable);
234 if ((NULL != pStaDs) && (pHdr->fc.retry > 0))
235 {
236 limLog(pMac, LOGE,
237 FL("STA is initiating Assoc Req after ACK lost.So, do not Process"
238 "sessionid: %d sys subType=%d for role=%d from: "MAC_ADDRESS_STR),
239 psessionEntry->peSessionId, subType,
240 psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa));
241 return;
242 }
243
Jeff Johnson295189b2012-06-20 16:38:30 -0700244 // Get pointer to Re/Association Request frame body
245 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
246
247 if (limIsGroupAddr(pHdr->sa))
248 {
249 // Received Re/Assoc Req frame from a BC/MC address
250 // Log error and ignore it
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530251 limLog(pMac, LOGE, FL("Received %s Req on sessionid: %d frame from a "
252 "BC/MC address"MAC_ADDRESS_STR),
253 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
254 psessionEntry->peSessionId,
255 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 return;
257 }
Mohit Khanna23863762012-09-11 17:40:09 -0700258
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
260
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530261 if (vos_mem_compare((tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da,
Jeff Johnsone7245742012-09-05 17:12:55 -0700262 (tANI_U8) (sizeof(tSirMacAddr))))
263 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530264 limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as"
265 " SAP/GO"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700266 limSendAssocRspMgmtFrame(pMac,
267 eSIR_MAC_UNSPEC_FAILURE_STATUS,
268 1,
269 pHdr->sa,
270 subType, 0,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700271 return ;
272 }
273
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
275 if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
276 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530277 limLog(pMac, LOGE, FL("TKIP counter measure is active"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 limSendAssocRspMgmtFrame(pMac,
279 eSIR_MAC_MIC_FAILURE_REASON,
280 1,
281 pHdr->sa,
282 subType, 0, psessionEntry);
283 return;
284 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700285
286 // Allocate memory for the Assoc Request frame
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530287 pAssocReq = vos_mem_malloc(sizeof(*pAssocReq));
288 if (NULL == pAssocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530290 limLog(pMac, LOGP, FL("Allocate Memory failed in AssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 return;
292 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530293 vos_mem_set((void *)pAssocReq , sizeof(*pAssocReq), 0);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800294
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 // Parse Assoc Request frame
296 if (subType == LIM_ASSOC)
297 status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
298 else
299 status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
300
301 if (status != eSIR_SUCCESS)
302 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530303 limLog(pMac, LOGE, FL("Parse error AssocRequest, length=%d from "MAC_ADDRESS_STR),
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530304 framelen, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry);
306 goto error;
307 }
308
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530309 pAssocReq->assocReqFrame = vos_mem_malloc(framelen);
310 if ( NULL == pAssocReq->assocReqFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530312 limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, "
313 "length=%d from "),framelen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700314 goto error;
315 }
316
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530317 vos_mem_copy((tANI_U8 *) pAssocReq->assocReqFrame,
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 (tANI_U8 *) pBody, framelen);
319 pAssocReq->assocReqFrameLength = framelen;
320
321 if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS)
322 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700323 limLog(pMac, LOGP, FL("could not retrieve Capabilities"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 goto error;
325 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 limCopyU16((tANI_U8 *) &localCapabilities, temp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700327
328 if (limCompareCapabilities(pMac,
329 pAssocReq,
330 &localCapabilities,psessionEntry) == false)
331 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530332 limLog(pMac, LOGE, FL("local caps mismatch received caps"));
333 limLog(pMac, LOGE, FL("Received %s Req with unsupported "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530334 "capabilities from"MAC_ADDRESS_STR),
335 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
336 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 /**
338 * Capabilities of requesting STA does not match with
339 * local capabilities. Respond with 'unsupported capabilities'
340 * status code.
341 */
342 limSendAssocRspMgmtFrame(
343 pMac,
344 eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
345 1,
346 pHdr->sa,
347 subType, 0,psessionEntry);
348
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 goto error;
350 }
351
352 updateContext = false;
353
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
355 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530356 limLog(pMac, LOGE, FL("Received %s Req with unmatched ssid ( Received"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530357 " SSID: %.*s current SSID: %.*s ) from "MAC_ADDRESS_STR),
358 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", pAssocReq->ssId.length,
359 pAssocReq->ssId.ssId, psessionEntry->ssId.length,
360 psessionEntry->ssId.ssId, MAC_ADDR_ARRAY(pHdr->sa));
361
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 /**
363 * Received Re/Association Request with either
364 * Broadcast SSID OR with SSID that does not
365 * match with local one.
366 * Respond with unspecified status code.
367 */
368 limSendAssocRspMgmtFrame(pMac,
369 eSIR_MAC_UNSPEC_FAILURE_STATUS,
370 1,
371 pHdr->sa,
372 subType, 0,psessionEntry);
373
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 goto error;
375 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
377 /***************************************************************
378 ** Verify if the requested rates are available in supported rate
379 ** set or Extended rate set. Some APs are adding basic rates in
380 ** Extended rateset IE
381 ***************************************************************/
382 basicRates.numRates = 0;
383
Gopichand Nakkala94273ab2013-03-25 14:47:39 +0530384 for(i = 0; i < pAssocReq->supportedRates.numRates && (i < SIR_MAC_RATESET_EID_MAX); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 {
386 basicRates.rate[i] = pAssocReq->supportedRates.rate[i];
387 basicRates.numRates++;
388 }
389
390 for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++)
391 {
392 basicRates.rate[i] = pAssocReq->extendedRates.rate[j];
393 basicRates.numRates++;
394 }
395 if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
396 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530397 limLog(pMac, LOGE, FL("Received %s Req with unsupported "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530398 "rates from"MAC_ADDRESS_STR),
399 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
400 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 /**
402 * Requesting STA does not support ALL BSS basic
403 * rates. Respond with 'basic rates not supported'
404 * status code.
405 */
406 limSendAssocRspMgmtFrame(
407 pMac,
408 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
409 1,
410 pHdr->sa,
411 subType, 0,psessionEntry);
412
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 goto error;
414 }
415
Jeff Johnson295189b2012-06-20 16:38:30 -0700416
417 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
418 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) &&
419 ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present)))
420 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530421 limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy "
422 "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700423 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
424 1, pHdr->sa, subType, 0, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 goto error;
426
427 }//end if phyMode == 11G_only
428
429 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
430 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) &&
431 (!pAssocReq->HTCaps.present))
432 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530433 limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy "
434 "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
436 1, pHdr->sa, subType, 0, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 goto error;
438 }//end if PhyMode == 11N_only
439
Jeff Johnson295189b2012-06-20 16:38:30 -0700440
441 /* Spectrum Management (11h) specific checks */
442 if (localCapabilities.spectrumMgt)
443 {
444 tSirRetStatus status = eSIR_SUCCESS;
445
446 /* If station is 11h capable, then it SHOULD send all mandatory
447 * IEs in assoc request frame. Let us verify that
448 */
449 if (pAssocReq->capabilityInfo.spectrumMgt)
450 {
451 if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent)))
452 {
453 /* One or more required information elements are missing, log the peers error */
454 if (!pAssocReq->powerCapabilityPresent)
455 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530456 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability "
457 "IE in %s Req from "MAC_ADDRESS_STR),
458 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
459 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 }
461 if (!pAssocReq->supportedChannelsPresent)
462 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530463 limLog(pMac, LOGW, FL("LIM Info: Missing Supported channel "
464 "IE in %s Req from "MAC_ADDRESS_STR),
465 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
466 MAC_ADDR_ARRAY(pHdr->sa));
467
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 }
470 else
471 {
472 /* Assoc request has mandatory fields */
473 status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry);
474 if (eSIR_SUCCESS != status)
475 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530476 limLog(pMac, LOGW, FL("LIM Info: MinTxPower(STA) > "
477 "MaxTxPower(AP) in %s Req from "MAC_ADDRESS_STR),
478 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
479 MAC_ADDR_ARRAY(pHdr->sa));
480
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 }
482 status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq);
483 if (eSIR_SUCCESS != status)
484 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530485 limLog(pMac, LOGW, FL("LIM Info: wrong supported "
486 "channels (STA) in %s Req from "MAC_ADDRESS_STR),
487 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
488 MAC_ADDR_ARRAY(pHdr->sa));
489
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 }
491 /* IEs are valid, use them if needed */
492 }
493 } //if(assoc.capabilityInfo.spectrumMgt)
494 else
495 {
496 /* As per the capabiities, the spectrum management is not enabled on the station
497 * The AP may allow the associations to happen even if spectrum management is not
498 * allowed, if the transmit power of station is below the regulatory maximum
499 */
500
501 /* TODO: presently, this is not handled. In the current implemetation, the AP would
502 * allow the station to associate even if it doesn't support spectrum management.
503 */
504 }
505 }// end of spectrum management related processing
506
507 if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
508 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530509 limLog(pMac, LOGE, FL("received %s req with unsupported"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530510 "MCS Rate Set from "MAC_ADDRESS_STR),
511 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
512 MAC_ADDR_ARRAY(pHdr->sa));
513
Jeff Johnson295189b2012-06-20 16:38:30 -0700514 /**
515 * Requesting STA does not support ALL BSS MCS basic Rate set rates.
516 * Spec does not define any status code for this scenario.
517 */
518 limSendAssocRspMgmtFrame(
519 pMac,
520 eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS,
521 1,
522 pHdr->sa,
523 subType, 0,psessionEntry);
524
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 goto error;
526 }
527
528 //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G)
529 if (phyMode == WNI_CFG_PHY_MODE_11G)
530 {
531
532 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS)
533 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700534 limLog(pMac, LOGP, FL("could not retrieve 11g-only flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 goto error;
536 }
537
538 if (!pAssocReq->extendedRatesPresent && val)
539 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530540 limLog(pMac, LOGE, FL("Rejecting Re/Assoc req from 11b STA: "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530541 MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 /**
543 * Received Re/Association Request from
544 * 11b STA when 11g only policy option
545 * is set.
546 * Reject with unspecified status code.
547 */
548 limSendAssocRspMgmtFrame(
549 pMac,
550 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
551 1,
552 pHdr->sa,
553 subType, 0,psessionEntry);
554
Jeff Johnson295189b2012-06-20 16:38:30 -0700555
556#ifdef WLAN_DEBUG
557 pMac->lim.gLim11bStaAssocRejectCount++;
558#endif
559 goto error;
560 }
561 }
562
563#ifdef WMM_APSD
564 // Save the QOS info element in assoc request..
565 limGetWmeMode(pMac, &wmeMode);
566 if (wmeMode == eHAL_SET)
567 {
568 tpQosInfoSta qInfo;
569
570 qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo);
571
572 if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi))
573 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530574 limLog(pMac, LOGW,
575 FL("Rejecting Re/Assoc req from STA: "MAC_ADDRESS_STR),
576 MAC_ADDR_ARRAY(pHdr->sa));
577 limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x"), *qInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700578
579 /**
580 * Received Re/Association Request from
581 * 11b STA when 11g only policy option
582 * is set.
583 * Reject with unspecified status code.
584 */
585 limSendAssocRspMgmtFrame(
586 pMac,
587 eSIR_MAC_WME_REFUSED_STATUS,
588 1,
589 pHdr->sa,
590 subType, 0,psessionEntry);
591
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 goto error;
593 }
594 }
595#endif
596
597 // Check for 802.11n HT caps compatibility; are HT Capabilities
598 // turned on in lim?
Jeff Johnsone7245742012-09-05 17:12:55 -0700599 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 {
601 // There are; are they turned on in the STA?
602 if ( pAssocReq->HTCaps.present )
603 {
604 // The station *does* support 802.11n HT capability...
605
606 limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d "
607 "PowerSave:%d greenField:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700608 "shortGI20:%d shortGI40:%d"
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 "txSTBC:%d rxSTBC:%d delayBA:%d"
610 "maxAMSDUsize:%d DSSS/CCK:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700611 "PSMP:%d stbcCntl:%d lsigTXProt:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 pAssocReq->HTCaps.advCodingCap,
613 pAssocReq->HTCaps.supportedChannelWidthSet,
614 pAssocReq->HTCaps.mimoPowerSave,
615 pAssocReq->HTCaps.greenField,
616 pAssocReq->HTCaps.shortGI20MHz,
617 pAssocReq->HTCaps.shortGI40MHz,
618 pAssocReq->HTCaps.txSTBC,
619 pAssocReq->HTCaps.rxSTBC,
620 pAssocReq->HTCaps.delayedBA,
621 pAssocReq->HTCaps.maximalAMSDUsize,
622 pAssocReq->HTCaps.dsssCckMode40MHz,
623 pAssocReq->HTCaps.psmp,
624 pAssocReq->HTCaps.stbcControlFrame,
625 pAssocReq->HTCaps.lsigTXOPProtection );
626
627 // Make sure the STA's caps are compatible with our own:
628 //11.15.2 Support of DSSS/CCK in 40 MHz
629 //the AP shall refuse association requests from an HT STA that has the DSSS/CCK
630 //Mode in 40 MHz subfield set to 1;
631
632 //FIXME_BTAMP_AP : Need to be enabled
633 /*
634 if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz )
635 {
636 statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS;
637 limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700638 "STA rejected." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 // Reject association
640 limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry);
641 goto error;
642 }
643 */
644 }
645 } // End if on HT caps turned on in lim.
646
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 /* Clear the buffers so that frame parser knows that there isn't a previously decoded IE in these buffers */
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530648 vos_mem_set((tANI_U8*)&Dot11fIERSN, sizeof( Dot11fIERSN ), 0);
649 vos_mem_set((tANI_U8*)&Dot11fIEWPA, sizeof( Dot11fIEWPA ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700650
651 /* if additional IE is present, check if it has WscIE */
652 if( pAssocReq->addIEPresent && pAssocReq->addIE.length )
653 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
654 /* when wpsIe is present, RSN/WPA IE is ignored */
655 if( wpsIe == NULL )
656 {
657 /** check whether as RSN IE is present */
658 if(psessionEntry->limSystemRole == eLIM_AP_ROLE
659 && psessionEntry->pLimStartBssReq->privacy
660 && psessionEntry->pLimStartBssReq->rsnIE.length)
661 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530662 limLog(pMac, LOG1,
Kiet Lam82004c62013-11-11 13:24:28 +0530663 FL("RSN enabled auth, Re/Assoc req from STA: "MAC_ADDRESS_STR),
664 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 if(pAssocReq->rsnPresent)
666 {
667 if(pAssocReq->rsn.length)
668 {
669 // Unpack the RSN IE
670 dot11fUnpackIeRSN(pMac,
671 &pAssocReq->rsn.info[0],
672 pAssocReq->rsn.length,
673 &Dot11fIERSN);
674
675 /* Check RSN version is supported or not */
676 if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version)
677 {
678 /* check the groupwise and pairwise cipher suites */
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700679 if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry,
680 pAssocReq->HTCaps.present, &pmfConnection)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530682 limLog(pMac, LOGE, FL("RSN Mismatch. Rejecting Re/Assoc req from "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530683 "STA: "MAC_ADDRESS_STR),
684 MAC_ADDR_ARRAY(pHdr->sa));
685
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 /* some IE is not properly sent */
687 /* received Association req frame with RSN IE but length is 0 */
688 limSendAssocRspMgmtFrame(
689 pMac,
690 status,
691 1,
692 pHdr->sa,
693 subType, 0,psessionEntry);
694
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 goto error;
696
697 }
698 }
699 else
700 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530701 limLog(pMac, LOGE, FL("RSN Version mismatch. "
702 "Rejecting Re/Assoc req from "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530703 "STA: "MAC_ADDRESS_STR),
704 MAC_ADDR_ARRAY(pHdr->sa));
705
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 /* received Association req frame with RSN IE version wrong */
707 limSendAssocRspMgmtFrame(
708 pMac,
709 eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS,
710 1,
711 pHdr->sa,
712 subType, 0,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 goto error;
714
715 }
716 }
717 else
718 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530719 limLog(pMac, LOGW, FL("RSN length not correct. "
720 "Rejecting Re/Assoc req from STA:"
721 MAC_ADDRESS_STR),
722 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 /* received Association req frame with RSN IE but length is 0 */
724 limSendAssocRspMgmtFrame(
725 pMac,
726 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
727 1,
728 pHdr->sa,
729 subType, 0,psessionEntry);
730
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 goto error;
732
733 }
734 } /* end - if(pAssocReq->rsnPresent) */
735 if((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent)
736 {
737 // Unpack the WPA IE
738 if(pAssocReq->wpa.length)
739 {
740 dot11fUnpackIeWPA(pMac,
741 &pAssocReq->wpa.info[4], //OUI is not taken care
742 pAssocReq->wpa.length,
743 &Dot11fIEWPA);
744 /* check the groupwise and pairwise cipher suites */
745 if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present)))
746 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530747 limLog(pMac, LOGW, FL("WPA IE mismatch. "
748 "Rejecting Re/Assoc req from "
749 "STA: "MAC_ADDRESS_STR),
750 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 /* received Association req frame with WPA IE but mismatch */
752 limSendAssocRspMgmtFrame(
753 pMac,
754 status,
755 1,
756 pHdr->sa,
757 subType, 0,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 goto error;
759
760 }
761 }
762 else
763 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530764 limLog(pMac, LOGW, FL("WPA len incorrect. "
765 "Rejecting Re/Assoc req from STA: "
766 MAC_ADDRESS_STR),
767 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 /* received Association req frame with invalid WPA IE */
769 limSendAssocRspMgmtFrame(
770 pMac,
771 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
772 1,
773 pHdr->sa,
774 subType, 0,psessionEntry);
775
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 goto error;
777 }/* end - if(pAssocReq->wpa.length) */
778 } /* end - if(pAssocReq->wpaPresent) */
779 } /* end of if(psessionEntry->pLimStartBssReq->privacy
780 && psessionEntry->pLimStartBssReq->rsnIE->length) */
781
782 } /* end of if( ! pAssocReq->wscInfo.present ) */
Jeff Johnson295189b2012-06-20 16:38:30 -0700783
784 /**
785 * Extract 'associated' context for STA, if any.
786 * This is maintained by DPH and created by LIM.
787 */
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800788 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700789
790 /// Extract pre-auth context for the STA, if any.
791 pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa);
792
793 if (pStaDs == NULL)
794 {
795 /// Requesting STA is not currently associated
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800796 if (peGetCurrentSTAsCount(pMac) == pMac->lim.maxStation)
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 {
798 /**
799 * Maximum number of STAs that AP can handle reached.
800 * Send Association response to peer MAC entity
801 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530802 limLog(pMac, LOGE, FL("Max Sta count reached : %d"),
803 pMac->lim.maxStation);
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 limRejectAssociation(pMac, pHdr->sa,
805 subType, false,
806 (tAniAuthType) 0, 0,
807 false,
808 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
809
810 goto error;
811 }
812
813 /// Check if STA is pre-authenticated.
814 if ((pStaPreAuthContext == NULL) ||
815 (pStaPreAuthContext &&
816 (pStaPreAuthContext->mlmState !=
817 eLIM_MLM_AUTHENTICATED_STATE)))
818 {
819 /**
820 * STA is not pre-authenticated yet requesting
821 * Re/Association before Authentication.
822 * OR STA is in the process of getting authenticated
823 * and sent Re/Association request.
824 * Send Deauthentication frame with 'prior
825 * authentication required' reason code.
826 */
827 limSendDeauthMgmtFrame(
828 pMac,
829 eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800830 pHdr->sa, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700831
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530832 limLog(pMac, LOGE, FL("received %s req on sessionid: %d from STA "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530833 "that does not have pre-auth context"MAC_ADDRESS_STR),
834 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
835 psessionEntry->peSessionId,
836 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 goto error;
838 }
839
840 /// Delete 'pre-auth' context of STA
841 authType = pStaPreAuthContext->authType;
842 limDeletePreAuthNode(pMac, pHdr->sa);
843
844 // All is well. Assign AID (after else part)
845
846 } // if (pStaDs == NULL)
847 else
848 {
849 // STA context does exist for this STA
850
851 if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
852 {
853 /**
854 * Requesting STA is in some 'transient' state?
855 * Ignore the Re/Assoc Req frame by incrementing
856 * debug counter & logging error.
857 */
858 if (subType == LIM_ASSOC)
859 {
860
861#ifdef WLAN_DEBUG
862 pMac->lim.gLimNumAssocReqDropInvldState++;
863#endif
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530864 limLog(pMac, LOGE, FL("received Assoc req in state "
Sushant Kaushik1b645382014-10-13 16:39:36 +0530865 "%d from "), pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 }
867 else
868 {
869#ifdef WLAN_DEBUG
870 pMac->lim.gLimNumReassocReqDropInvldState++;
871#endif
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530872 limLog(pMac, LOGE, FL("received ReAssoc req in state %d"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530873 " from "), pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 }
875 limPrintMacAddr(pMac, pHdr->sa, LOG1);
876 limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -0700877
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 goto error;
879 } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
880
Chet Lanctot8cecea22014-02-11 19:09:36 -0800881 /* STA sent association Request frame while already in
882 * 'associated' state */
883
884#ifdef WLAN_FEATURE_11W
885 limLog(pMac, LOG1, FL("Re/Assoc request from station that is already associated"));
886 limLog(pMac, LOG1, FL("PMF enabled %d, SA Query state %d"), pStaDs->rmfEnabled,
887 pStaDs->pmfSaQueryState);
888 if (pStaDs->rmfEnabled)
889 {
890 switch (pStaDs->pmfSaQueryState)
891 {
892
893 // start SA Query procedure, respond to Association Request
894 // with try again later
895 case DPH_SA_QUERY_NOT_IN_PROGRESS:
Abhishek Singh65d66352014-07-15 23:14:38 +0530896 /*
897 * We should reset the retry counter before we start
898 * the SA query procedure, otherwise in next set of SA query
899 * procedure we will end up using the stale value.
900 */
901 pStaDs->pmfSaQueryRetryCount = 0;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800902 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1,
903 pHdr->sa, subType, pStaDs, psessionEntry);
904 limSendSaQueryRequestFrame(
905 pMac, (tANI_U8 *)&(pStaDs->pmfSaQueryCurrentTransId),
906 pHdr->sa, psessionEntry);
907 pStaDs->pmfSaQueryStartTransId = pStaDs->pmfSaQueryCurrentTransId;
908 pStaDs->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800909
910 // start timer for SA Query retry
911 if (tx_timer_activate(&pStaDs->pmfSaQueryTimer) != TX_SUCCESS)
912 {
913 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
914 goto error;
915 }
916
917 pStaDs->pmfSaQueryState = DPH_SA_QUERY_IN_PROGRESS;
918 goto error;
919
920 // SA Query procedure still going, respond to Association
921 // Request with try again later
922 case DPH_SA_QUERY_IN_PROGRESS:
923 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1,
924 pHdr->sa, subType, 0, psessionEntry);
925 goto error;
926
927 // SA Query procedure timed out, accept Association Request
928 // normally
929 case DPH_SA_QUERY_TIMED_OUT:
930 pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
931 break;
932 }
933 }
934#endif
935
936 /* no change in the capability so drop the frame */
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530937 if ((VOS_TRUE == vos_mem_compare(&pStaDs->mlmStaContext.capabilityInfo,
938 &pAssocReq->capabilityInfo,
939 sizeof(tSirMacCapabilityInfo)))&&
940 (subType == LIM_ASSOC))
941 {
Sushant Kaushik1b645382014-10-13 16:39:36 +0530942 limLog(pMac, LOGE, FL(" Received Assoc req in state %d STAid=%d"),
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530943 pStaDs->mlmStaContext.mlmState,peerIdx);
944 goto error;
945 }
946 else
947 {
948 /**
949 * STA sent Re/association Request frame while already in
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 * 'associated' state. Update STA capabilities and
951 * send Association response frame with same AID
952 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530953 limLog(pMac, LOG1, FL("Received Assoc req from STA already connected"
954 " UpdateConext"));
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530955 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
956 if (pStaPreAuthContext &&
957 (pStaPreAuthContext->mlmState ==
958 eLIM_MLM_AUTHENTICATED_STATE))
959 {
960 /// STA has triggered pre-auth again
961 authType = pStaPreAuthContext->authType;
962 limDeletePreAuthNode(pMac, pHdr->sa);
963 }
964 else
965 authType = pStaDs->mlmStaContext.authType;
Jeff Johnson295189b2012-06-20 16:38:30 -0700966
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530967 updateContext = true;
968 if (dphInitStaState(pMac, pHdr->sa, peerIdx, true, &psessionEntry->dph.dphHashTable)
969 == NULL)
970 {
971 limLog(pMac, LOGE, FL("could not Init STAid=%d"), peerIdx);
972 goto error;
973 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700974 }
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530975 goto sendIndToSme;
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 } // end if (lookup for STA in perStaDs fails)
977
978
979
980 // check if sta is allowed per QoS AC rules
981 //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled)
982 limGetWmeMode(psessionEntry, &wmeMode);
983 if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET))
984 {
985 // for a qsta, check if the requested Traffic spec
986 // is admissible
987 // for a non-qsta check if the sta can be admitted
988 if (pAssocReq->addtsPresent)
989 {
990 tANI_U8 tspecIdx = 0; //index in the sch tspec table.
991 if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
992 &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
993 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530994 limLog(pMac, LOGE, FL("AdmitControl: TSPEC rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700995 limSendAssocRspMgmtFrame(
996 pMac,
997 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
998 1,
999 pHdr->sa,
1000 subType, 0,psessionEntry);
1001#ifdef WLAN_DEBUG
1002 pMac->lim.gLimNumAssocReqDropACRejectTS++;
1003#endif
1004 goto error;
1005 }
1006 }
1007 else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
1008 != eSIR_SUCCESS)
1009 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301010 limLog(pMac, LOGE, FL("AdmitControl: Sta rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 limSendAssocRspMgmtFrame(
1012 pMac,
1013 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
1014 1,
1015 pHdr->sa,
1016 subType, 0,psessionEntry);
1017#ifdef WLAN_DEBUG
1018 pMac->lim.gLimNumAssocReqDropACRejectSta++;
1019#endif
1020 goto error;
1021 }
1022
1023 // else all ok
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001024 limLog(pMac, LOG1, FL("AdmitControl: Sta OK!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 }
1026
1027 /**
1028 * STA is Associated !
1029 */
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301030 limLog(pMac, LOGE, FL("Received %s Req successful from "MAC_ADDRESS_STR),
1031 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001032
1033 /**
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001034 * AID for this association will be same as the peer Index used in DPH table.
1035 * Assign unused/least recently used peer Index from perStaDs.
1036 * NOTE: limAssignPeerIdx() assigns AID values ranging
1037 * between 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT)
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 */
1039
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001040 peerIdx = limAssignPeerIdx(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001041
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001042 if (!peerIdx)
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 {
1044 // Could not assign AID
1045 // Reject association
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301046 limLog(pMac, LOGE, FL("PeerIdx not avaialble. Reject associaton"));
1047
Jeff Johnson295189b2012-06-20 16:38:30 -07001048 limRejectAssociation(pMac, pHdr->sa,
1049 subType, true, authType,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001050 peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -07001051 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1052
1053 goto error;
1054 }
1055
1056 /**
1057 * Add an entry to hash table maintained by DPH module
1058 */
1059
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001060 pStaDs = dphAddHashEntry(pMac, pHdr->sa, peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001061
1062 if (pStaDs == NULL)
1063 {
1064 // Could not add hash table entry at DPH
1065 limLog(pMac, LOGE,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301066 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
1067 MAC_ADDRESS_STR),
1068 peerIdx,MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001069
1070 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001071 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001072
1073 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001074 subType, true, authType, peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1076
1077 goto error;
1078 }
1079
1080
1081sendIndToSme:
1082
1083 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1084
1085 pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
Jeff Johnsone7245742012-09-05 17:12:55 -07001086#ifdef WLAN_FEATURE_11AC
1087 pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
1088#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001089 pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
1090 pStaDs->qos.addts = pAssocReq->addtsReq;
1091 pStaDs->qos.capability = pAssocReq->qosCapability;
1092 pStaDs->versionPresent = 0;
1093 /* short slot and short preamble should be updated before doing limaddsta */
1094 pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble;
1095 pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime;
1096
1097 if (pAssocReq->propIEinfo.versionPresent) //update STA version info
1098 {
1099 pStaDs->versionPresent = 1;
1100 pStaDs->version = pAssocReq->propIEinfo.version;
1101 }
1102 pStaDs->propCapability = 0;
1103 if (pAssocReq->propIEinfo.capabilityPresent)
1104 {
1105 if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability))
1106 pStaDs->propCapability &= pAssocReq->propIEinfo.capability;
1107 }
1108
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 pStaDs->valid = 0;
1110 pStaDs->mlmStaContext.authType = authType;
1111 pStaDs->staType = STA_ENTRY_PEER;
1112
1113 //TODO: If listen interval is more than certain limit, reject the association.
1114 //Need to check customer requirements and then implement.
1115 pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval;
1116 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1117
1118 /* The following count will be used to knock-off the station if it doesn't
1119 * come back to receive the buffered data. The AP will wait for numTimSent number
1120 * of beacons after sending TIM information for the station, before assuming that
1121 * the station is no more associated and disassociates it
1122 */
1123
1124 /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
1125 pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval);
1126
1127 /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */
1128 pStaDs->curTxMpduCnt = 0;
1129
1130 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
1131 (pAssocReq->HTCaps.present))
1132 {
1133 pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField;
1134 pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity;
1135 pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz;
1136 pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection;
1137 pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
1138 pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
1139 pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
1140 pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
1141 pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
1142 pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07001143 /* peer just follows AP; so when we are softAP/GO, we just store our session entry's secondary channel offset here in peer INFRA STA
1144 * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
1145 */
1146 pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
1147#ifdef WLAN_FEATURE_11AC
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07001148 if(pAssocReq->operMode.present)
1149 {
1150 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pAssocReq->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
1151 pStaDs->htSupportedChannelWidthSet = (tANI_U8)(pAssocReq->operMode.chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
1152 }
1153 else if (pAssocReq->VHTCaps.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07001154 {
Madan Mohan Koyyalamudi740f7802012-09-24 14:17:14 -07001155 // Check if STA has enabled it's channel bonding mode.
1156 // If channel bonding mode is enabled, we decide based on SAP's current configuration.
1157 // else, we set it to VHT20.
1158 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pStaDs->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ?
1159 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
1160 psessionEntry->vhtTxChannelWidthSet );
Jeff Johnsone7245742012-09-05 17:12:55 -07001161 }
Madan Mohan Koyyalamudicc394402012-10-05 10:48:19 -07001162
1163 // Lesser among the AP and STA bandwidth of operation.
1164 pStaDs->htSupportedChannelWidthSet =
1165 (pStaDs->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1166 pStaDs->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1167
Jeff Johnsone7245742012-09-05 17:12:55 -07001168#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 pStaDs->baPolicyFlag = 0xFF;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001170 pStaDs->htLdpcCapable = (tANI_U8)pAssocReq->HTCaps.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -07001171 }
1172
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001173 if(pAssocReq->VHTCaps.present)
1174 {
1175 pStaDs->vhtLdpcCapable = (tANI_U8)pAssocReq->VHTCaps.ldpcCodingCap;
1176 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001177
Jeff Johnsone7245742012-09-05 17:12:55 -07001178#ifdef WLAN_FEATURE_11AC
1179if (limPopulateMatchingRateSet(pMac,
1180 pStaDs,
1181 &(pAssocReq->supportedRates),
1182 &(pAssocReq->extendedRates),
1183 pAssocReq->HTCaps.supportedMCSSet,
1184 &(pAssocReq->propIEinfo.propRates),
1185 psessionEntry , &pAssocReq->VHTCaps)
1186 != eSIR_SUCCESS)
1187#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001188
1189 if (limPopulateMatchingRateSet(pMac,
1190 pStaDs,
1191 &(pAssocReq->supportedRates),
1192 &(pAssocReq->extendedRates),
1193 pAssocReq->HTCaps.supportedMCSSet,
1194 &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -07001195#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001196 {
1197 // Could not update hash table entry at DPH with rateset
1198 limLog(pMac, LOGE,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301199 FL("could not update hash entry at DPH for aid=%d, MacAddr: "
1200 MAC_ADDRESS_STR),
1201 peerIdx, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001202
1203 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001204 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001205
1206
1207 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001208 subType, true, authType, peerIdx, true,
Jeff Johnson295189b2012-06-20 16:38:30 -07001209 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1210
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001211 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1212 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 }
1214
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301215 vos_mem_copy((tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
1216 (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 pAssocReq->propIEinfo.propRates.numPropRates + 1);
1218
1219 /// Add STA context at MAC HW (BMU, RHP & TFP)
1220
1221 pStaDs->qosMode = eANI_BOOLEAN_FALSE;
1222 pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
1223 if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
1224 {
1225 pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
1226 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1227 }
1228
1229 pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
1230 pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
1231 limGetWmeMode(psessionEntry, &wmeMode);
1232 //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
1233 if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
1234 {
1235 pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
1236 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1237 limGetWsmMode(psessionEntry, &wsmMode);
1238 /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
1239 can coexist */
Jeff Johnson295189b2012-06-20 16:38:30 -07001240 if( pAssocReq->WMMInfoStation.present)
1241 {
1242 /* check whether AP supports or not */
1243 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
1244 && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
1245 || pAssocReq->WMMInfoStation.acbk_uapsd
1246 || pAssocReq->WMMInfoStation.acvo_uapsd
1247 || pAssocReq->WMMInfoStation.acvi_uapsd))
1248 {
1249
1250 /**
1251 * Received Re/Association Request from
1252 * STA when UPASD is not supported.
1253 */
Deepthi Gowricabd4d12014-11-13 12:51:16 +05301254 limLog( pMac, LOGE, FL( "AP do not support UAPSD so reply "
1255 "to STA accordingly" ));
1256 /* update UAPSD and send it to LIM to add STA */
1257 pStaDs->qos.capability.qosInfo.acbe_uapsd = 0;
1258 pStaDs->qos.capability.qosInfo.acbk_uapsd = 0;
1259 pStaDs->qos.capability.qosInfo.acvo_uapsd = 0;
1260 pStaDs->qos.capability.qosInfo.acvi_uapsd = 0;
1261 pStaDs->qos.capability.qosInfo.maxSpLen = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001262
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 }
1264 else
1265 {
1266 /* update UAPSD and send it to LIM to add STA */
1267 pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
1268 pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
1269 pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
1270 pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
1271 pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
1272 }
1273 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
1275 if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
1276 pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
1277
1278 }
1279
1280 // Re/Assoc Response frame to requesting STA
1281 pStaDs->mlmStaContext.subType = subType;
1282
1283 if (pAssocReq->propIEinfo.aniIndicator)
1284 pStaDs->aniPeer = 1;
1285
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001286#ifdef WLAN_FEATURE_11W
1287 pStaDs->rmfEnabled = (pmfConnection) ? 1 : 0;
Chet Lanctot8cecea22014-02-11 19:09:36 -08001288 pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
1289 timerId.fields.sessionId = psessionEntry->peSessionId;
1290 timerId.fields.peerIdx = peerIdx;
1291 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL,
1292 &retryInterval) != eSIR_SUCCESS)
1293 {
1294 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query retry interval value"));
1295 limRejectAssociation(pMac, pHdr->sa,
1296 subType, true, authType,
1297 peerIdx, false,
1298 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1299 goto error;
1300 }
Satyanarayana Dash6f438272015-03-03 18:01:06 +05301301 if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN > retryInterval)
Abhishek Singhbf9f7d82014-09-25 16:24:59 +05301302 {
Satyanarayana Dash6f438272015-03-03 18:01:06 +05301303 retryInterval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF;
Abhishek Singhbf9f7d82014-09-25 16:24:59 +05301304 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08001305 if (tx_timer_create(&pStaDs->pmfSaQueryTimer, "PMF SA Query timer",
1306 limPmfSaQueryTimerHandler, timerId.value,
1307 SYS_MS_TO_TICKS((retryInterval * 1024) / 1000),
1308 0, TX_NO_ACTIVATE) != TX_SUCCESS)
1309 {
1310 limLog(pMac, LOGE, FL("could not create PMF SA Query timer"));
1311 limRejectAssociation(pMac, pHdr->sa,
1312 subType, true, authType,
1313 peerIdx, false,
1314 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1315 goto error;
1316 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001317#endif
1318
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 // BTAMP: Storing the parsed assoc request in the psessionEntry array
1320 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1321
1322 /* BTAMP: If STA context already exist (ie. updateContext = 1)
1323 * for this STA, then we should delete the old one, and add
1324 * the new STA. This is taken care of in the limDelSta() routine.
1325 *
1326 * Prior to BTAMP, we were setting this flag so that when
1327 * PE receives SME_ASSOC_CNF, and if this flag is set, then
1328 * PE shall delete the old station and then add. But now in
1329 * BTAMP, we're directly adding station before waiting for
1330 * SME_ASSOC_CNF, so we can do this now.
1331 */
1332 if (!updateContext)
1333 {
1334 pStaDs->mlmStaContext.updateContext = 0;
1335
1336 // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001337 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301339 limLog(pMac, LOGE, FL("could not Add STA with assocId=%d"),
1340 pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
1342 true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
1343 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1344
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001345 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1346 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 }
1348 }
1349 else
1350 {
1351 pStaDs->mlmStaContext.updateContext = 1;
1352
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 mlmPrevState = pStaDs->mlmStaContext.mlmState;
1354
1355 /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
1356 if(subType != LIM_REASSOC)
1357 {
1358 //we need to set the mlmState here in order differentiate in limDelSta.
1359 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
1360 if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
1361 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301362 limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d"),
1363 pStaDs->assocId, pStaDs->staIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001364 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1365 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1366
1367 //Restoring the state back.
1368 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001369 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 goto error;
1371 }
1372 }
1373 else
1374 {
1375 /* mlmState is changed in limAddSta context */
1376 /* use the same AID, already allocated */
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001377 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001378 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301379 limLog(pMac, LOGE, FL( "Could not AddSta with assocId= %d staId %d"),
1380 pStaDs->assocId, pStaDs->staIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001381 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1382 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1383
1384 //Restoring the state back.
1385 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001386 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 goto error;
1388 }
1389
1390 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001391
1392 }
1393
1394 return;
1395
1396error:
1397 if (pAssocReq != NULL)
1398 {
1399 if ( pAssocReq->assocReqFrame )
1400 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301401 vos_mem_free(pAssocReq->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 pAssocReq->assocReqFrame = NULL;
1403 }
1404
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301405 vos_mem_free(pAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 }
1407
Jeff Johnsone7245742012-09-05 17:12:55 -07001408 /* If it is not duplicate Assoc request then only make to Null */
1409 if ((pStaDs != NULL) &&
1410 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001411 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001412
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 return;
1414
1415} /*** end limProcessAssocReqFrame() ***/
1416
1417
1418
1419/**---------------------------------------------------------------
1420\fn limSendMlmAssocInd
1421\brief This function sends either LIM_MLM_ASSOC_IND
1422\ or LIM_MLM_REASSOC_IND to SME.
1423\
1424\param pMac
1425\param *pStaDs - Station DPH hash entry
1426\param psessionEntry - PE session entry
1427\return None
1428
1429 * ?????? How do I get
1430 * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
1431 * - aid =====> pStaDs->assocId
1432 * - pHdr->sa =====> pStaDs->staAddr
1433 * - authType
1434 * - pHdr->seqControl =====> no longer needed
1435 * - pStaDs
1436------------------------------------------------------------------*/
1437void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1438{
1439 tpLimMlmAssocInd pMlmAssocInd = NULL;
1440 tpLimMlmReassocInd pMlmReassocInd;
1441 tpSirAssocReq pAssocReq;
1442 tANI_U16 temp;
1443 tANI_U32 phyMode;
1444 tANI_U8 subType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 tANI_U8 *wpsIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001446 tANI_U32 tmp;
1447// tANI_U16 statusCode;
1448 tANI_U16 i, j=0;
1449
1450 // Get a copy of the already parsed Assoc Request
1451 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
1452
1453 // Get the phyMode
1454 limGetPhyMode(pMac, &phyMode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 // Extract pre-auth context for the peer BTAMP-STA, if any.
1456
1457 // Determiine if its Assoc or ReAssoc Request
1458 if (pAssocReq->reassocRequest == 1)
1459 subType = LIM_REASSOC;
1460 else
1461 subType = LIM_ASSOC;
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301462
1463 limLog(pMac, LOG1, FL("Sessionid %d ssid %s subtype %d Associd %d staAddr "
1464 MAC_ADDRESS_STR), psessionEntry->peSessionId, pAssocReq->ssId.ssId,
1465 subType,pStaDs->assocId,MAC_ADDR_ARRAY(pStaDs->staAddr));
1466
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 if (subType == LIM_ASSOC || subType == LIM_REASSOC)
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 {
1469 temp = sizeof(tLimMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001470
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301471 pMlmAssocInd = vos_mem_malloc(temp);
1472 if (NULL == pMlmAssocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001474 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301475 limLog(pMac, LOGP, FL("AllocateMemory failed for pMlmAssocInd"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 return;
1477 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301478 vos_mem_set(pMlmAssocInd, temp ,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001479
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301480 vos_mem_copy((tANI_U8 *)pMlmAssocInd->peerMacAddr,
1481 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001482
1483 pMlmAssocInd->aid = pStaDs->assocId;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301484 vos_mem_copy((tANI_U8 *)&pMlmAssocInd->ssId,
1485 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 pMlmAssocInd->sessionId = psessionEntry->peSessionId;
1487 pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
1488
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
1490
1491 // Fill in RSN IE information
1492 pMlmAssocInd->rsnIE.length = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 // if WPS IE is present, ignore RSN IE
1494 if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
1495 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1496 }
1497 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301499 limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d"),
1500 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1502 pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1503 pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301504 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[2],
1505 pAssocReq->rsn.info,
1506 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001507 }
1508
Jeff Johnson295189b2012-06-20 16:38:30 -07001509 // Fill in 802.11h related info
1510 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1511 {
1512 pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
1513 pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1514 pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1515 limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
1516 }
1517 else
1518 pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
1519
1520
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 /* This check is to avoid extra Sec IEs present incase of WPS */
1522 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 {
1524 if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
1525 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301526 PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d"),
1527 pMlmAssocInd->rsnIE.length);)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301528 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001529 return;
1530 }
1531 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1532 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301533 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
1534 pAssocReq->wpa.info,
1535 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001536 pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1537 }
1538
1539
1540 pMlmAssocInd->addIE.length = 0;
1541 if (pAssocReq->addIEPresent)
1542 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301543 vos_mem_copy(&pMlmAssocInd->addIE.addIEdata,
1544 pAssocReq->addIE.addIEdata,
1545 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001546
1547 pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
1548 }
1549
Jeff Johnson295189b2012-06-20 16:38:30 -07001550 if(pAssocReq->wmeInfoPresent)
1551 {
1552
1553 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301554 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"),
1555 WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001556
1557 /* check whether AP is enabled with WMM */
1558 if(tmp)
1559 {
1560 pMlmAssocInd->WmmStaInfoPresent = 1;
1561 }
1562 else
1563 {
1564 pMlmAssocInd->WmmStaInfoPresent= 0;
1565 }
1566 /* Note: we are not rejecting association here because IOT will fail */
1567
1568 }
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301569#ifdef WLAN_FEATURE_AP_HT40_24G
1570 if(pAssocReq->HTCaps.present)
1571 {
1572 limLog(pMac, LOGW, FL("HT40MHzInto: %d"),
1573 pAssocReq->HTCaps.stbcControlFrame);
1574 pMlmAssocInd->HT40MHzIntoPresent =
1575 pAssocReq->HTCaps.stbcControlFrame;
1576 }
1577#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001578
1579 // Required for indicating the frames to upper layer
1580 pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1581 pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
1582
1583 pMlmAssocInd->beaconPtr = psessionEntry->beacon;
1584 pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
1585
1586 limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301587 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 }
1589 else
1590 {
1591 // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
1592 temp = sizeof(tLimMlmReassocInd);
1593
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301594 pMlmReassocInd = vos_mem_malloc(temp);
1595 if (NULL == pMlmReassocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001596 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301597 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1598 "pMlmReassocInd"));
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001599 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 return;
1601 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301602 vos_mem_set(pMlmReassocInd, temp, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001603
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301604 vos_mem_copy((tANI_U8 *) pMlmReassocInd->peerMacAddr,
1605 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
1606 vos_mem_copy((tANI_U8 *) pMlmReassocInd->currentApAddr,
1607 (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 pMlmReassocInd->aid = pStaDs->assocId;
1609 pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301610 vos_mem_copy((tANI_U8 *)&pMlmReassocInd->ssId,
1611 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001612
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 if (pAssocReq->propIEinfo.aniIndicator)
1614 pStaDs->aniPeer = 1;
1615
1616 pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
1617 pMlmReassocInd->rsnIE.length = 0;
1618
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
1620 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1621
1622 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301624 limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d"),
1625 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1627 pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1628 pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301629 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[2],
1630 pAssocReq->rsn.info, pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001631 }
1632
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 // 802.11h support
1634 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1635 {
1636 pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
1637 pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1638 pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1639 pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
1640
1641 limLog(pMac, LOG1,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301642 FL("Sending Reassoc Ind: spectrum ON, minPwr %d, "
1643 "maxPwr %d, numChnl %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 pMlmReassocInd->powerCap.minTxPower,
1645 pMlmReassocInd->powerCap.maxTxPower,
1646 pMlmReassocInd->supportedChannels.numChnl);
1647
1648 for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
1649 {
1650 pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001651 limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 i, pMlmReassocInd->supportedChannels.channelList[i]);
1653 j+=2;
1654 }
1655 }
1656 else
1657 pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
1658
1659
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 /* This check is to avoid extra Sec IEs present incase of WPS */
1661 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301663 limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d"),
1664 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1666 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301667 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
1668 pAssocReq->wpa.info,
1669 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1671 }
1672
1673 pMlmReassocInd->addIE.length = 0;
1674 if (pAssocReq->addIEPresent)
1675 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301676 vos_mem_copy(&pMlmReassocInd->addIE.addIEdata,
1677 pAssocReq->addIE.addIEdata,
1678 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001679
1680 pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
1681 }
1682
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 if(pAssocReq->wmeInfoPresent)
1684 {
1685
1686 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301687 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"),
1688 WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001689
1690 /* check whether AP is enabled with WMM */
1691 if(tmp)
1692 {
1693 pMlmReassocInd->WmmStaInfoPresent = 1;
1694 }
1695 else
1696 {
1697 pMlmReassocInd->WmmStaInfoPresent = 0;
1698 }
1699 /* Note: we are not rejecting Re-association here because IOT will fail */
1700
1701 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001702
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301703#ifdef WLAN_FEATURE_AP_HT40_24G
1704 if(pAssocReq->HTCaps.present)
1705 {
1706 limLog(pMac, LOGW, FL("RASSOC HT40MHzInto: %d"),
1707 pAssocReq->HTCaps.stbcControlFrame);
1708 pMlmReassocInd->HT40MHzIntoPresent =
1709 pAssocReq->HTCaps.stbcControlFrame;
1710 }
1711#endif
1712
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 // Required for indicating the frames to upper layer
1714 pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1715 pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
1716
1717 pMlmReassocInd->beaconPtr = psessionEntry->beacon;
1718 pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
1719
1720 limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301721 vos_mem_free(pMlmReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001722 }
1723
1724 return;
1725
1726} /*** end limSendMlmAssocInd() ***/