blob: ea5076b925bf6722f1e4d2411cdee0c92a8857fe [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"
Jeff Johnson62c27982013-02-27 17:53:55 -080041#include "wniCfgSta.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"
Chet Lanctot8cecea22014-02-11 19:09:36 -080057#ifdef WLAN_FEATURE_11W
58#include "wniCfgAp.h"
59#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070060
61
62#include "vos_types.h"
63/**
64 * limConvertSupportedChannels
65 *
66 *FUNCTION:
67 * This function is called by limProcessAssocReqFrame() to
68 * parse the channel support IE in the Assoc/Reassoc Request
69 * frame, and send relevant information in the SME_ASSOC_IND
70 *
71 *NOTE:
72 *
73 * @param pMac - A pointer to Global MAC structure
74 * @param pMlmAssocInd - A pointer to SME ASSOC/REASSOC IND
75 * @param assocReq - A pointer to ASSOC/REASSOC Request frame
76 *
77 * @return None
78 */
79static void
80limConvertSupportedChannels(tpAniSirGlobal pMac,
81 tpLimMlmAssocInd pMlmAssocInd,
82 tSirAssocReq *assocReq)
83{
84
85 tANI_U16 i, j, index=0;
86 tANI_U8 firstChannelNumber;
87 tANI_U8 numberOfChannel;
88 tANI_U8 nextChannelNumber;
89
90 if(assocReq->supportedChannels.length >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
91 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +053092 limLog(pMac, LOG1, FL("Number of supported channels:%d is more than "
93 "MAX"), assocReq->supportedChannels.length);
Jeff Johnson295189b2012-06-20 16:38:30 -070094 pMlmAssocInd->supportedChannels.numChnl = 0;
95 return;
96 }
97
98 for(i=0; i < (assocReq->supportedChannels.length); i++)
99 {
100 // Get First Channel Number
101 firstChannelNumber = assocReq->supportedChannels.supportedChannels[i];
102 pMlmAssocInd->supportedChannels.channelList[index] = firstChannelNumber;
103 i++;
104 index++;
105 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
106 {
107 pMlmAssocInd->supportedChannels.numChnl = 0;
108 return;
109 }
110 // Get Number of Channels in a Subband
111 numberOfChannel = assocReq->supportedChannels.supportedChannels[i];
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700112 PELOG2(limLog(pMac, LOG2, FL("Rcv AssocReq: chnl=%d, numOfChnl=%d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700113 firstChannelNumber, numberOfChannel);)
114
115 if (numberOfChannel > 1)
116 {
117 nextChannelNumber = firstChannelNumber;
118 if(SIR_BAND_5_GHZ == limGetRFBand(firstChannelNumber))
119 {
120 for (j=1; j < numberOfChannel; j++)
121 {
122 nextChannelNumber += SIR_11A_FREQUENCY_OFFSET;
123 pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
124 index++;
125 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
126 {
127 pMlmAssocInd->supportedChannels.numChnl = 0;
128 return;
129 }
130 }
131 }
132 else if(SIR_BAND_2_4_GHZ == limGetRFBand(firstChannelNumber))
133 {
134 for (j=1; j < numberOfChannel; j++)
135 {
136 nextChannelNumber += SIR_11B_FREQUENCY_OFFSET;
137 pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
138 index++;
139 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
140 {
141 pMlmAssocInd->supportedChannels.numChnl = 0;
142 return;
143 }
144 }
145 }
146 }
147 }
148
149 pMlmAssocInd->supportedChannels.numChnl = (tANI_U8) index;
150 PELOG2(limLog(pMac, LOG2,
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530151 FL("Send AssocInd to WSM: spectrum ON, minPwr %d, maxPwr %d, "
152 "numChnl %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700153 pMlmAssocInd->powerCap.minTxPower,
154 pMlmAssocInd->powerCap.maxTxPower,
155 pMlmAssocInd->supportedChannels.numChnl);)
156}
157
158
159/**---------------------------------------------------------------
160\fn limProcessAssocReqFrame
161\brief This function is called by limProcessMessageQueue()
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800162\ upon Re/Association Request frame reception in
Jeff Johnson295189b2012-06-20 16:38:30 -0700163\ BTAMP AP or Soft AP role.
164\
165\param pMac
166\param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800167\param subType - Indicates whether it is Association Request(=0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700168\ or Reassociation Request(=1) frame
169\return None
170------------------------------------------------------------------*/
171void
172limProcessAssocReqFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,
173 tANI_U8 subType, tpPESession psessionEntry)
174{
175 tANI_U8 updateContext;
176 tANI_U8 *pBody;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800177 tANI_U16 peerIdx, temp;
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 tANI_U32 val;
179 tANI_S32 framelen;
180 tSirRetStatus status;
181 tpSirMacMgmtHdr pHdr;
182 struct tLimPreAuthNode *pStaPreAuthContext;
183 tAniAuthType authType;
184 tSirMacCapabilityInfo localCapabilities;
185 tpDphHashNode pStaDs = NULL;
186 tpSirAssocReq pAssocReq;
Jeff Johnson295189b2012-06-20 16:38:30 -0700187 tLimMlmStates mlmPrevState;
188 tDot11fIERSN Dot11fIERSN;
189 tDot11fIEWPA Dot11fIEWPA;
Jeff Johnson295189b2012-06-20 16:38:30 -0700190 tANI_U32 phyMode;
191 tHalBitVal qosMode;
192 tHalBitVal wsmMode, wmeMode;
193 tANI_U8 *wpsIe = NULL;
194 tSirMacRateSet basicRates;
195 tANI_U8 i = 0, j = 0;
Chet Lanctot055d2a32013-08-31 17:29:03 -0700196 tANI_BOOLEAN pmfConnection = eANI_BOOLEAN_FALSE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800197#ifdef WLAN_FEATURE_11W
198 tPmfSaQueryTimerId timerId;
199 tANI_U32 retryInterval;
200#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700201
202 limGetPhyMode(pMac, &phyMode, psessionEntry);
203
204 limGetQosMode(psessionEntry, &qosMode);
205
206 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
207 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
208
Abhishek Singh744e0582014-11-20 15:32:32 +0530209 limLog(pMac, LOG1, FL("Received %s Req Frame on sessionid: %d systemrole %d"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530210 " limMlmState %d from: "MAC_ADDRESS_STR),
211 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
212 psessionEntry->peSessionId, psessionEntry->limSystemRole,
213 psessionEntry->limMlmState, MAC_ADDR_ARRAY(pHdr->sa));
214
Abhishek Singh744e0582014-11-20 15:32:32 +0530215 if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE )
216 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530217 limLog(pMac, LOGE, FL("received unexpected ASSOC REQ on sessionid: %d "
218 "sys subType=%d for role=%d from: "MAC_ADDRESS_STR),
219 psessionEntry->peSessionId,
220 subType, psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700221 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
222 WDA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen);
223 return;
224 }
225
Abhishek Singh744e0582014-11-20 15:32:32 +0530226 /*
227 * If a STA is already present in DPH and it
228 * is initiating a Assoc re-transmit, do not
229 * process it. This can happen when first Assoc Req frame
230 * is received but ACK lost at STA side. The ACK for this
231 * dropped Assoc Req frame should be sent by HW. Host simply
232 * does not process it once the entry for the STA is already
233 * present in DPH.
234 */
235 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx,
236 &psessionEntry->dph.dphHashTable);
237 if ((NULL != pStaDs) && (pHdr->fc.retry > 0))
238 {
239 limLog(pMac, LOGE,
240 FL("STA is initiating Assoc Req after ACK lost.So, do not Process"
241 "sessionid: %d sys subType=%d for role=%d from: "MAC_ADDRESS_STR),
242 psessionEntry->peSessionId, subType,
243 psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa));
244 return;
245 }
246
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 // Get pointer to Re/Association Request frame body
248 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
249
250 if (limIsGroupAddr(pHdr->sa))
251 {
252 // Received Re/Assoc Req frame from a BC/MC address
253 // Log error and ignore it
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530254 limLog(pMac, LOGE, FL("Received %s Req on sessionid: %d frame from a "
255 "BC/MC address"MAC_ADDRESS_STR),
256 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
257 psessionEntry->peSessionId,
258 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 return;
260 }
Mohit Khanna23863762012-09-11 17:40:09 -0700261
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
263
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530264 if (vos_mem_compare((tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da,
Jeff Johnsone7245742012-09-05 17:12:55 -0700265 (tANI_U8) (sizeof(tSirMacAddr))))
266 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530267 limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as"
268 " SAP/GO"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700269 limSendAssocRspMgmtFrame(pMac,
270 eSIR_MAC_UNSPEC_FAILURE_STATUS,
271 1,
272 pHdr->sa,
273 subType, 0,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700274 return ;
275 }
276
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
278 if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
279 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530280 limLog(pMac, LOGE, FL("TKIP counter measure is active"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 limSendAssocRspMgmtFrame(pMac,
282 eSIR_MAC_MIC_FAILURE_REASON,
283 1,
284 pHdr->sa,
285 subType, 0, psessionEntry);
286 return;
287 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700288
289 // Allocate memory for the Assoc Request frame
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530290 pAssocReq = vos_mem_malloc(sizeof(*pAssocReq));
291 if (NULL == pAssocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530293 limLog(pMac, LOGP, FL("Allocate Memory failed in AssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 return;
295 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530296 vos_mem_set((void *)pAssocReq , sizeof(*pAssocReq), 0);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800297
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 // Parse Assoc Request frame
299 if (subType == LIM_ASSOC)
300 status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
301 else
302 status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
303
304 if (status != eSIR_SUCCESS)
305 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530306 limLog(pMac, LOGW, FL("Parse error AssocRequest, length=%d from "MAC_ADDRESS_STR),
307 framelen, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry);
309 goto error;
310 }
311
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530312 pAssocReq->assocReqFrame = vos_mem_malloc(framelen);
313 if ( NULL == pAssocReq->assocReqFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -0700314 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530315 limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, "
316 "length=%d from "),framelen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 goto error;
318 }
319
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530320 vos_mem_copy((tANI_U8 *) pAssocReq->assocReqFrame,
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 (tANI_U8 *) pBody, framelen);
322 pAssocReq->assocReqFrameLength = framelen;
323
324 if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS)
325 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700326 limLog(pMac, LOGP, FL("could not retrieve Capabilities"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 goto error;
328 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 limCopyU16((tANI_U8 *) &localCapabilities, temp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700330
331 if (limCompareCapabilities(pMac,
332 pAssocReq,
333 &localCapabilities,psessionEntry) == false)
334 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530335 limLog(pMac, LOGW, FL("local caps mismatch received caps"));
336 limLog(pMac, LOGW, FL("Received %s Req with unsupported "
337 "capabilities from"MAC_ADDRESS_STR),
338 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
339 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 /**
341 * Capabilities of requesting STA does not match with
342 * local capabilities. Respond with 'unsupported capabilities'
343 * status code.
344 */
345 limSendAssocRspMgmtFrame(
346 pMac,
347 eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
348 1,
349 pHdr->sa,
350 subType, 0,psessionEntry);
351
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 goto error;
353 }
354
355 updateContext = false;
356
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
358 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530359 limLog(pMac, LOGW, FL("Received %s Req with unmatched ssid ( Received"
360 " SSID: %.*s current SSID: %.*s ) from "MAC_ADDRESS_STR),
361 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", pAssocReq->ssId.length,
362 pAssocReq->ssId.ssId, psessionEntry->ssId.length,
363 psessionEntry->ssId.ssId, MAC_ADDR_ARRAY(pHdr->sa));
364
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 /**
366 * Received Re/Association Request with either
367 * Broadcast SSID OR with SSID that does not
368 * match with local one.
369 * Respond with unspecified status code.
370 */
371 limSendAssocRspMgmtFrame(pMac,
372 eSIR_MAC_UNSPEC_FAILURE_STATUS,
373 1,
374 pHdr->sa,
375 subType, 0,psessionEntry);
376
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 goto error;
378 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700379
380 /***************************************************************
381 ** Verify if the requested rates are available in supported rate
382 ** set or Extended rate set. Some APs are adding basic rates in
383 ** Extended rateset IE
384 ***************************************************************/
385 basicRates.numRates = 0;
386
Gopichand Nakkala94273ab2013-03-25 14:47:39 +0530387 for(i = 0; i < pAssocReq->supportedRates.numRates && (i < SIR_MAC_RATESET_EID_MAX); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 {
389 basicRates.rate[i] = pAssocReq->supportedRates.rate[i];
390 basicRates.numRates++;
391 }
392
393 for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++)
394 {
395 basicRates.rate[i] = pAssocReq->extendedRates.rate[j];
396 basicRates.numRates++;
397 }
398 if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
399 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530400 limLog(pMac, LOGW, FL("Received %s Req with unsupported "
401 "rates from"MAC_ADDRESS_STR),
402 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
403 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 /**
405 * Requesting STA does not support ALL BSS basic
406 * rates. Respond with 'basic rates not supported'
407 * status code.
408 */
409 limSendAssocRspMgmtFrame(
410 pMac,
411 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
412 1,
413 pHdr->sa,
414 subType, 0,psessionEntry);
415
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 goto error;
417 }
418
Jeff Johnson295189b2012-06-20 16:38:30 -0700419
420 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
421 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) &&
422 ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present)))
423 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530424 limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy "
425 "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
427 1, pHdr->sa, subType, 0, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 goto error;
429
430 }//end if phyMode == 11G_only
431
432 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
433 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) &&
434 (!pAssocReq->HTCaps.present))
435 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530436 limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy "
437 "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
439 1, pHdr->sa, subType, 0, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 goto error;
441 }//end if PhyMode == 11N_only
442
Jeff Johnson295189b2012-06-20 16:38:30 -0700443
444 /* Spectrum Management (11h) specific checks */
445 if (localCapabilities.spectrumMgt)
446 {
447 tSirRetStatus status = eSIR_SUCCESS;
448
449 /* If station is 11h capable, then it SHOULD send all mandatory
450 * IEs in assoc request frame. Let us verify that
451 */
452 if (pAssocReq->capabilityInfo.spectrumMgt)
453 {
454 if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent)))
455 {
456 /* One or more required information elements are missing, log the peers error */
457 if (!pAssocReq->powerCapabilityPresent)
458 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530459 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability "
460 "IE in %s Req from "MAC_ADDRESS_STR),
461 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
462 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 }
464 if (!pAssocReq->supportedChannelsPresent)
465 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530466 limLog(pMac, LOGW, FL("LIM Info: Missing Supported channel "
467 "IE in %s Req from "MAC_ADDRESS_STR),
468 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
469 MAC_ADDR_ARRAY(pHdr->sa));
470
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700472 }
473 else
474 {
475 /* Assoc request has mandatory fields */
476 status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry);
477 if (eSIR_SUCCESS != status)
478 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530479 limLog(pMac, LOGW, FL("LIM Info: MinTxPower(STA) > "
480 "MaxTxPower(AP) in %s Req from "MAC_ADDRESS_STR),
481 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
482 MAC_ADDR_ARRAY(pHdr->sa));
483
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 }
485 status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq);
486 if (eSIR_SUCCESS != status)
487 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530488 limLog(pMac, LOGW, FL("LIM Info: wrong supported "
489 "channels (STA) in %s Req from "MAC_ADDRESS_STR),
490 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
491 MAC_ADDR_ARRAY(pHdr->sa));
492
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 }
494 /* IEs are valid, use them if needed */
495 }
496 } //if(assoc.capabilityInfo.spectrumMgt)
497 else
498 {
499 /* As per the capabiities, the spectrum management is not enabled on the station
500 * The AP may allow the associations to happen even if spectrum management is not
501 * allowed, if the transmit power of station is below the regulatory maximum
502 */
503
504 /* TODO: presently, this is not handled. In the current implemetation, the AP would
505 * allow the station to associate even if it doesn't support spectrum management.
506 */
507 }
508 }// end of spectrum management related processing
509
510 if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
511 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530512 limLog(pMac, LOGW, FL("received %s req with unsupported"
513 "MCS Rate Set from "MAC_ADDRESS_STR),
514 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
515 MAC_ADDR_ARRAY(pHdr->sa));
516
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 /**
518 * Requesting STA does not support ALL BSS MCS basic Rate set rates.
519 * Spec does not define any status code for this scenario.
520 */
521 limSendAssocRspMgmtFrame(
522 pMac,
523 eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS,
524 1,
525 pHdr->sa,
526 subType, 0,psessionEntry);
527
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 goto error;
529 }
530
531 //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G)
532 if (phyMode == WNI_CFG_PHY_MODE_11G)
533 {
534
535 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS)
536 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700537 limLog(pMac, LOGP, FL("could not retrieve 11g-only flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 goto error;
539 }
540
541 if (!pAssocReq->extendedRatesPresent && val)
542 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530543 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from 11b STA: "
544 MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 /**
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
Jeff Johnson295189b2012-06-20 16:38:30 -0700558
559#ifdef WLAN_DEBUG
560 pMac->lim.gLim11bStaAssocRejectCount++;
561#endif
562 goto error;
563 }
564 }
565
566#ifdef WMM_APSD
567 // Save the QOS info element in assoc request..
568 limGetWmeMode(pMac, &wmeMode);
569 if (wmeMode == eHAL_SET)
570 {
571 tpQosInfoSta qInfo;
572
573 qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo);
574
575 if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi))
576 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530577 limLog(pMac, LOGW,
578 FL("Rejecting Re/Assoc req from STA: "MAC_ADDRESS_STR),
579 MAC_ADDR_ARRAY(pHdr->sa));
580 limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x"), *qInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700581
582 /**
583 * Received Re/Association Request from
584 * 11b STA when 11g only policy option
585 * is set.
586 * Reject with unspecified status code.
587 */
588 limSendAssocRspMgmtFrame(
589 pMac,
590 eSIR_MAC_WME_REFUSED_STATUS,
591 1,
592 pHdr->sa,
593 subType, 0,psessionEntry);
594
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 goto error;
596 }
597 }
598#endif
599
600 // Check for 802.11n HT caps compatibility; are HT Capabilities
601 // turned on in lim?
Jeff Johnsone7245742012-09-05 17:12:55 -0700602 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 {
604 // There are; are they turned on in the STA?
605 if ( pAssocReq->HTCaps.present )
606 {
607 // The station *does* support 802.11n HT capability...
608
609 limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d "
610 "PowerSave:%d greenField:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700611 "shortGI20:%d shortGI40:%d"
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 "txSTBC:%d rxSTBC:%d delayBA:%d"
613 "maxAMSDUsize:%d DSSS/CCK:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700614 "PSMP:%d stbcCntl:%d lsigTXProt:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 pAssocReq->HTCaps.advCodingCap,
616 pAssocReq->HTCaps.supportedChannelWidthSet,
617 pAssocReq->HTCaps.mimoPowerSave,
618 pAssocReq->HTCaps.greenField,
619 pAssocReq->HTCaps.shortGI20MHz,
620 pAssocReq->HTCaps.shortGI40MHz,
621 pAssocReq->HTCaps.txSTBC,
622 pAssocReq->HTCaps.rxSTBC,
623 pAssocReq->HTCaps.delayedBA,
624 pAssocReq->HTCaps.maximalAMSDUsize,
625 pAssocReq->HTCaps.dsssCckMode40MHz,
626 pAssocReq->HTCaps.psmp,
627 pAssocReq->HTCaps.stbcControlFrame,
628 pAssocReq->HTCaps.lsigTXOPProtection );
629
630 // Make sure the STA's caps are compatible with our own:
631 //11.15.2 Support of DSSS/CCK in 40 MHz
632 //the AP shall refuse association requests from an HT STA that has the DSSS/CCK
633 //Mode in 40 MHz subfield set to 1;
634
635 //FIXME_BTAMP_AP : Need to be enabled
636 /*
637 if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz )
638 {
639 statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS;
640 limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700641 "STA rejected." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 // Reject association
643 limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry);
644 goto error;
645 }
646 */
647 }
648 } // End if on HT caps turned on in lim.
649
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 /* 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 +0530651 vos_mem_set((tANI_U8*)&Dot11fIERSN, sizeof( Dot11fIERSN ), 0);
652 vos_mem_set((tANI_U8*)&Dot11fIEWPA, sizeof( Dot11fIEWPA ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700653
654 /* if additional IE is present, check if it has WscIE */
655 if( pAssocReq->addIEPresent && pAssocReq->addIE.length )
656 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
657 /* when wpsIe is present, RSN/WPA IE is ignored */
658 if( wpsIe == NULL )
659 {
660 /** check whether as RSN IE is present */
661 if(psessionEntry->limSystemRole == eLIM_AP_ROLE
662 && psessionEntry->pLimStartBssReq->privacy
663 && psessionEntry->pLimStartBssReq->rsnIE.length)
664 {
665 limLog(pMac, LOGE,
Kiet Lam82004c62013-11-11 13:24:28 +0530666 FL("RSN enabled auth, Re/Assoc req from STA: "MAC_ADDRESS_STR),
667 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 if(pAssocReq->rsnPresent)
669 {
670 if(pAssocReq->rsn.length)
671 {
672 // Unpack the RSN IE
673 dot11fUnpackIeRSN(pMac,
674 &pAssocReq->rsn.info[0],
675 pAssocReq->rsn.length,
676 &Dot11fIERSN);
677
678 /* Check RSN version is supported or not */
679 if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version)
680 {
681 /* check the groupwise and pairwise cipher suites */
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700682 if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry,
683 pAssocReq->HTCaps.present, &pmfConnection)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530685 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from "
686 "STA: "MAC_ADDRESS_STR),
687 MAC_ADDR_ARRAY(pHdr->sa));
688
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 /* some IE is not properly sent */
690 /* received Association req frame with RSN IE but length is 0 */
691 limSendAssocRspMgmtFrame(
692 pMac,
693 status,
694 1,
695 pHdr->sa,
696 subType, 0,psessionEntry);
697
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 goto error;
699
700 }
701 }
702 else
703 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530704 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from "
705 "STA: "MAC_ADDRESS_STR),
706 MAC_ADDR_ARRAY(pHdr->sa));
707
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 /* received Association req frame with RSN IE version wrong */
709 limSendAssocRspMgmtFrame(
710 pMac,
711 eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS,
712 1,
713 pHdr->sa,
714 subType, 0,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 goto error;
716
717 }
718 }
719 else
720 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530721 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA:"
722 MAC_ADDRESS_STR),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 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530747 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from "
748 "STA: "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 /* received Association req frame with WPA IE but mismatch */
750 limSendAssocRspMgmtFrame(
751 pMac,
752 status,
753 1,
754 pHdr->sa,
755 subType, 0,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 goto error;
757
758 }
759 }
760 else
761 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530762 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "
763 MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 /* received Association req frame with invalid WPA IE */
765 limSendAssocRspMgmtFrame(
766 pMac,
767 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
768 1,
769 pHdr->sa,
770 subType, 0,psessionEntry);
771
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 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 ) */
Jeff Johnson295189b2012-06-20 16:38:30 -0700779
780 /**
781 * Extract 'associated' context for STA, if any.
782 * This is maintained by DPH and created by LIM.
783 */
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800784 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700785
786 /// Extract pre-auth context for the STA, if any.
787 pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa);
788
789 if (pStaDs == NULL)
790 {
791 /// Requesting STA is not currently associated
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800792 if (peGetCurrentSTAsCount(pMac) == pMac->lim.maxStation)
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 {
794 /**
795 * Maximum number of STAs that AP can handle reached.
796 * Send Association response to peer MAC entity
797 */
798 limRejectAssociation(pMac, pHdr->sa,
799 subType, false,
800 (tAniAuthType) 0, 0,
801 false,
802 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
803
804 goto error;
805 }
806
807 /// Check if STA is pre-authenticated.
808 if ((pStaPreAuthContext == NULL) ||
809 (pStaPreAuthContext &&
810 (pStaPreAuthContext->mlmState !=
811 eLIM_MLM_AUTHENTICATED_STATE)))
812 {
813 /**
814 * STA is not pre-authenticated yet requesting
815 * Re/Association before Authentication.
816 * OR STA is in the process of getting authenticated
817 * and sent Re/Association request.
818 * Send Deauthentication frame with 'prior
819 * authentication required' reason code.
820 */
821 limSendDeauthMgmtFrame(
822 pMac,
823 eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800824 pHdr->sa, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700825
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530826 limLog(pMac, LOGW, FL("received %s req on sessionid: %d from STA "
827 "that does not have pre-auth context"MAC_ADDRESS_STR),
828 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
829 psessionEntry->peSessionId,
830 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 goto error;
832 }
833
834 /// Delete 'pre-auth' context of STA
835 authType = pStaPreAuthContext->authType;
836 limDeletePreAuthNode(pMac, pHdr->sa);
837
838 // All is well. Assign AID (after else part)
839
840 } // if (pStaDs == NULL)
841 else
842 {
843 // STA context does exist for this STA
844
845 if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
846 {
847 /**
848 * Requesting STA is in some 'transient' state?
849 * Ignore the Re/Assoc Req frame by incrementing
850 * debug counter & logging error.
851 */
852 if (subType == LIM_ASSOC)
853 {
854
855#ifdef WLAN_DEBUG
856 pMac->lim.gLimNumAssocReqDropInvldState++;
857#endif
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530858 limLog(pMac, LOG1, FL("received Assoc req in state "
Sushant Kaushik1b645382014-10-13 16:39:36 +0530859 "%d from "), pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 }
861 else
862 {
863#ifdef WLAN_DEBUG
864 pMac->lim.gLimNumReassocReqDropInvldState++;
865#endif
Sushant Kaushik1b645382014-10-13 16:39:36 +0530866 limLog(pMac, LOG1, FL("received ReAssoc req in state %d"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530867 " from "), pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 }
869 limPrintMacAddr(pMac, pHdr->sa, LOG1);
870 limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -0700871
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 goto error;
873 } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
874
Chet Lanctot8cecea22014-02-11 19:09:36 -0800875 /* STA sent association Request frame while already in
876 * 'associated' state */
877
878#ifdef WLAN_FEATURE_11W
879 limLog(pMac, LOG1, FL("Re/Assoc request from station that is already associated"));
880 limLog(pMac, LOG1, FL("PMF enabled %d, SA Query state %d"), pStaDs->rmfEnabled,
881 pStaDs->pmfSaQueryState);
882 if (pStaDs->rmfEnabled)
883 {
884 switch (pStaDs->pmfSaQueryState)
885 {
886
887 // start SA Query procedure, respond to Association Request
888 // with try again later
889 case DPH_SA_QUERY_NOT_IN_PROGRESS:
Abhishek Singh65d66352014-07-15 23:14:38 +0530890 /*
891 * We should reset the retry counter before we start
892 * the SA query procedure, otherwise in next set of SA query
893 * procedure we will end up using the stale value.
894 */
895 pStaDs->pmfSaQueryRetryCount = 0;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800896 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1,
897 pHdr->sa, subType, pStaDs, psessionEntry);
898 limSendSaQueryRequestFrame(
899 pMac, (tANI_U8 *)&(pStaDs->pmfSaQueryCurrentTransId),
900 pHdr->sa, psessionEntry);
901 pStaDs->pmfSaQueryStartTransId = pStaDs->pmfSaQueryCurrentTransId;
902 pStaDs->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800903
904 // start timer for SA Query retry
905 if (tx_timer_activate(&pStaDs->pmfSaQueryTimer) != TX_SUCCESS)
906 {
907 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
908 goto error;
909 }
910
911 pStaDs->pmfSaQueryState = DPH_SA_QUERY_IN_PROGRESS;
912 goto error;
913
914 // SA Query procedure still going, respond to Association
915 // Request with try again later
916 case DPH_SA_QUERY_IN_PROGRESS:
917 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1,
918 pHdr->sa, subType, 0, psessionEntry);
919 goto error;
920
921 // SA Query procedure timed out, accept Association Request
922 // normally
923 case DPH_SA_QUERY_TIMED_OUT:
924 pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
925 break;
926 }
927 }
928#endif
929
930 /* no change in the capability so drop the frame */
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530931 if ((VOS_TRUE == vos_mem_compare(&pStaDs->mlmStaContext.capabilityInfo,
932 &pAssocReq->capabilityInfo,
933 sizeof(tSirMacCapabilityInfo)))&&
934 (subType == LIM_ASSOC))
935 {
Sushant Kaushik1b645382014-10-13 16:39:36 +0530936 limLog(pMac, LOGE, FL(" Received Assoc req in state %d STAid=%d"),
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530937 pStaDs->mlmStaContext.mlmState,peerIdx);
938 goto error;
939 }
940 else
941 {
942 /**
943 * STA sent Re/association Request frame while already in
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 * 'associated' state. Update STA capabilities and
945 * send Association response frame with same AID
946 */
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530947 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
948 if (pStaPreAuthContext &&
949 (pStaPreAuthContext->mlmState ==
950 eLIM_MLM_AUTHENTICATED_STATE))
951 {
952 /// STA has triggered pre-auth again
953 authType = pStaPreAuthContext->authType;
954 limDeletePreAuthNode(pMac, pHdr->sa);
955 }
956 else
957 authType = pStaDs->mlmStaContext.authType;
Jeff Johnson295189b2012-06-20 16:38:30 -0700958
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530959 updateContext = true;
960 if (dphInitStaState(pMac, pHdr->sa, peerIdx, true, &psessionEntry->dph.dphHashTable)
961 == NULL)
962 {
963 limLog(pMac, LOGE, FL("could not Init STAid=%d"), peerIdx);
964 goto error;
965 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 }
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530967 goto sendIndToSme;
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 } // end if (lookup for STA in perStaDs fails)
969
970
971
972 // check if sta is allowed per QoS AC rules
973 //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled)
974 limGetWmeMode(psessionEntry, &wmeMode);
975 if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET))
976 {
977 // for a qsta, check if the requested Traffic spec
978 // is admissible
979 // for a non-qsta check if the sta can be admitted
980 if (pAssocReq->addtsPresent)
981 {
982 tANI_U8 tspecIdx = 0; //index in the sch tspec table.
983 if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
984 &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
985 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700986 limLog(pMac, LOGW, FL("AdmitControl: TSPEC rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 limSendAssocRspMgmtFrame(
988 pMac,
989 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
990 1,
991 pHdr->sa,
992 subType, 0,psessionEntry);
993#ifdef WLAN_DEBUG
994 pMac->lim.gLimNumAssocReqDropACRejectTS++;
995#endif
996 goto error;
997 }
998 }
999 else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
1000 != eSIR_SUCCESS)
1001 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001002 limLog(pMac, LOGW, FL("AdmitControl: Sta rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 limSendAssocRspMgmtFrame(
1004 pMac,
1005 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
1006 1,
1007 pHdr->sa,
1008 subType, 0,psessionEntry);
1009#ifdef WLAN_DEBUG
1010 pMac->lim.gLimNumAssocReqDropACRejectSta++;
1011#endif
1012 goto error;
1013 }
1014
1015 // else all ok
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001016 limLog(pMac, LOG1, FL("AdmitControl: Sta OK!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 }
1018
1019 /**
1020 * STA is Associated !
1021 */
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301022 limLog(pMac, LOGE, FL("Received %s Req successful from "MAC_ADDRESS_STR),
1023 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001024
1025 /**
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001026 * AID for this association will be same as the peer Index used in DPH table.
1027 * Assign unused/least recently used peer Index from perStaDs.
1028 * NOTE: limAssignPeerIdx() assigns AID values ranging
1029 * between 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT)
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 */
1031
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001032 peerIdx = limAssignPeerIdx(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001033
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001034 if (!peerIdx)
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 {
1036 // Could not assign AID
1037 // Reject association
1038 limRejectAssociation(pMac, pHdr->sa,
1039 subType, true, authType,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001040 peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -07001041 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1042
1043 goto error;
1044 }
1045
1046 /**
1047 * Add an entry to hash table maintained by DPH module
1048 */
1049
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001050 pStaDs = dphAddHashEntry(pMac, pHdr->sa, peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001051
1052 if (pStaDs == NULL)
1053 {
1054 // Could not add hash table entry at DPH
1055 limLog(pMac, LOGE,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301056 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
1057 MAC_ADDRESS_STR),
1058 peerIdx,MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001059
1060 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001061 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001062
1063 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001064 subType, true, authType, peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1066
1067 goto error;
1068 }
1069
1070
1071sendIndToSme:
1072
1073 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1074
1075 pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
Jeff Johnsone7245742012-09-05 17:12:55 -07001076#ifdef WLAN_FEATURE_11AC
1077 pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
1078#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
1080 pStaDs->qos.addts = pAssocReq->addtsReq;
1081 pStaDs->qos.capability = pAssocReq->qosCapability;
1082 pStaDs->versionPresent = 0;
1083 /* short slot and short preamble should be updated before doing limaddsta */
1084 pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble;
1085 pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime;
1086
1087 if (pAssocReq->propIEinfo.versionPresent) //update STA version info
1088 {
1089 pStaDs->versionPresent = 1;
1090 pStaDs->version = pAssocReq->propIEinfo.version;
1091 }
1092 pStaDs->propCapability = 0;
1093 if (pAssocReq->propIEinfo.capabilityPresent)
1094 {
1095 if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability))
1096 pStaDs->propCapability &= pAssocReq->propIEinfo.capability;
1097 }
1098
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 pStaDs->valid = 0;
1100 pStaDs->mlmStaContext.authType = authType;
1101 pStaDs->staType = STA_ENTRY_PEER;
1102
1103 //TODO: If listen interval is more than certain limit, reject the association.
1104 //Need to check customer requirements and then implement.
1105 pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval;
1106 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1107
1108 /* The following count will be used to knock-off the station if it doesn't
1109 * come back to receive the buffered data. The AP will wait for numTimSent number
1110 * of beacons after sending TIM information for the station, before assuming that
1111 * the station is no more associated and disassociates it
1112 */
1113
1114 /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
1115 pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval);
1116
1117 /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */
1118 pStaDs->curTxMpduCnt = 0;
1119
1120 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
1121 (pAssocReq->HTCaps.present))
1122 {
1123 pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField;
1124 pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity;
1125 pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz;
1126 pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection;
1127 pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
1128 pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
1129 pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
1130 pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
1131 pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
1132 pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07001133 /* 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
1134 * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
1135 */
1136 pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
1137#ifdef WLAN_FEATURE_11AC
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07001138 if(pAssocReq->operMode.present)
1139 {
1140 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pAssocReq->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
1141 pStaDs->htSupportedChannelWidthSet = (tANI_U8)(pAssocReq->operMode.chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
1142 }
1143 else if (pAssocReq->VHTCaps.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07001144 {
Madan Mohan Koyyalamudi740f7802012-09-24 14:17:14 -07001145 // Check if STA has enabled it's channel bonding mode.
1146 // If channel bonding mode is enabled, we decide based on SAP's current configuration.
1147 // else, we set it to VHT20.
1148 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pStaDs->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ?
1149 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
1150 psessionEntry->vhtTxChannelWidthSet );
Jeff Johnsone7245742012-09-05 17:12:55 -07001151 }
Madan Mohan Koyyalamudicc394402012-10-05 10:48:19 -07001152
1153 // Lesser among the AP and STA bandwidth of operation.
1154 pStaDs->htSupportedChannelWidthSet =
1155 (pStaDs->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1156 pStaDs->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1157
Jeff Johnsone7245742012-09-05 17:12:55 -07001158#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 pStaDs->baPolicyFlag = 0xFF;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001160 pStaDs->htLdpcCapable = (tANI_U8)pAssocReq->HTCaps.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 }
1162
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001163 if(pAssocReq->VHTCaps.present)
1164 {
1165 pStaDs->vhtLdpcCapable = (tANI_U8)pAssocReq->VHTCaps.ldpcCodingCap;
1166 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001167
Jeff Johnsone7245742012-09-05 17:12:55 -07001168#ifdef WLAN_FEATURE_11AC
1169if (limPopulateMatchingRateSet(pMac,
1170 pStaDs,
1171 &(pAssocReq->supportedRates),
1172 &(pAssocReq->extendedRates),
1173 pAssocReq->HTCaps.supportedMCSSet,
1174 &(pAssocReq->propIEinfo.propRates),
1175 psessionEntry , &pAssocReq->VHTCaps)
1176 != eSIR_SUCCESS)
1177#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001178
1179 if (limPopulateMatchingRateSet(pMac,
1180 pStaDs,
1181 &(pAssocReq->supportedRates),
1182 &(pAssocReq->extendedRates),
1183 pAssocReq->HTCaps.supportedMCSSet,
1184 &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -07001185#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001186 {
1187 // Could not update hash table entry at DPH with rateset
1188 limLog(pMac, LOGE,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301189 FL("could not update hash entry at DPH for aid=%d, MacAddr: "
1190 MAC_ADDRESS_STR),
1191 peerIdx, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001192
1193 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001194 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001195
1196
1197 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001198 subType, true, authType, peerIdx, true,
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1200
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001201 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1202 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 }
1204
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301205 vos_mem_copy((tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
1206 (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 pAssocReq->propIEinfo.propRates.numPropRates + 1);
1208
1209 /// Add STA context at MAC HW (BMU, RHP & TFP)
1210
1211 pStaDs->qosMode = eANI_BOOLEAN_FALSE;
1212 pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
1213 if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
1214 {
1215 pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
1216 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1217 }
1218
1219 pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
1220 pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
1221 limGetWmeMode(psessionEntry, &wmeMode);
1222 //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
1223 if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
1224 {
1225 pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
1226 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1227 limGetWsmMode(psessionEntry, &wsmMode);
1228 /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
1229 can coexist */
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 if( pAssocReq->WMMInfoStation.present)
1231 {
1232 /* check whether AP supports or not */
1233 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
1234 && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
1235 || pAssocReq->WMMInfoStation.acbk_uapsd
1236 || pAssocReq->WMMInfoStation.acvo_uapsd
1237 || pAssocReq->WMMInfoStation.acvi_uapsd))
1238 {
1239
1240 /**
1241 * Received Re/Association Request from
1242 * STA when UPASD is not supported.
1243 */
Deepthi Gowricabd4d12014-11-13 12:51:16 +05301244 limLog( pMac, LOGE, FL( "AP do not support UAPSD so reply "
1245 "to STA accordingly" ));
1246 /* update UAPSD and send it to LIM to add STA */
1247 pStaDs->qos.capability.qosInfo.acbe_uapsd = 0;
1248 pStaDs->qos.capability.qosInfo.acbk_uapsd = 0;
1249 pStaDs->qos.capability.qosInfo.acvo_uapsd = 0;
1250 pStaDs->qos.capability.qosInfo.acvi_uapsd = 0;
1251 pStaDs->qos.capability.qosInfo.maxSpLen = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001252
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 }
1254 else
1255 {
1256 /* update UAPSD and send it to LIM to add STA */
1257 pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
1258 pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
1259 pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
1260 pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
1261 pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
1262 }
1263 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001264 //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
1265 if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
1266 pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
1267
1268 }
1269
1270 // Re/Assoc Response frame to requesting STA
1271 pStaDs->mlmStaContext.subType = subType;
1272
1273 if (pAssocReq->propIEinfo.aniIndicator)
1274 pStaDs->aniPeer = 1;
1275
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001276#ifdef WLAN_FEATURE_11W
1277 pStaDs->rmfEnabled = (pmfConnection) ? 1 : 0;
Chet Lanctot8cecea22014-02-11 19:09:36 -08001278 pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
1279 timerId.fields.sessionId = psessionEntry->peSessionId;
1280 timerId.fields.peerIdx = peerIdx;
1281 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL,
1282 &retryInterval) != eSIR_SUCCESS)
1283 {
1284 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query retry interval value"));
1285 limRejectAssociation(pMac, pHdr->sa,
1286 subType, true, authType,
1287 peerIdx, false,
1288 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1289 goto error;
1290 }
Abhishek Singhbf9f7d82014-09-25 16:24:59 +05301291 if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_APMIN > retryInterval)
1292 {
1293 retryInterval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_APDEF;
1294 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08001295 if (tx_timer_create(&pStaDs->pmfSaQueryTimer, "PMF SA Query timer",
1296 limPmfSaQueryTimerHandler, timerId.value,
1297 SYS_MS_TO_TICKS((retryInterval * 1024) / 1000),
1298 0, TX_NO_ACTIVATE) != TX_SUCCESS)
1299 {
1300 limLog(pMac, LOGE, FL("could not create PMF SA Query timer"));
1301 limRejectAssociation(pMac, pHdr->sa,
1302 subType, true, authType,
1303 peerIdx, false,
1304 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1305 goto error;
1306 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001307#endif
1308
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 // BTAMP: Storing the parsed assoc request in the psessionEntry array
1310 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1311
1312 /* BTAMP: If STA context already exist (ie. updateContext = 1)
1313 * for this STA, then we should delete the old one, and add
1314 * the new STA. This is taken care of in the limDelSta() routine.
1315 *
1316 * Prior to BTAMP, we were setting this flag so that when
1317 * PE receives SME_ASSOC_CNF, and if this flag is set, then
1318 * PE shall delete the old station and then add. But now in
1319 * BTAMP, we're directly adding station before waiting for
1320 * SME_ASSOC_CNF, so we can do this now.
1321 */
1322 if (!updateContext)
1323 {
1324 pStaDs->mlmStaContext.updateContext = 0;
1325
1326 // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001327 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301329 limLog(pMac, LOGE, FL("could not Add STA with assocId=%d"),
1330 pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
1332 true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
1333 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1334
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001335 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1336 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 }
1338 }
1339 else
1340 {
1341 pStaDs->mlmStaContext.updateContext = 1;
1342
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 mlmPrevState = pStaDs->mlmStaContext.mlmState;
1344
1345 /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
1346 if(subType != LIM_REASSOC)
1347 {
1348 //we need to set the mlmState here in order differentiate in limDelSta.
1349 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
1350 if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
1351 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301352 limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d"),
1353 pStaDs->assocId, pStaDs->staIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1355 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1356
1357 //Restoring the state back.
1358 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001359 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 goto error;
1361 }
1362 }
1363 else
1364 {
1365 /* mlmState is changed in limAddSta context */
1366 /* use the same AID, already allocated */
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001367 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301369 limLog( pMac, LOGE, FL( "AP do not support UPASD "
1370 "REASSOC Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001371 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1372 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1373
1374 //Restoring the state back.
1375 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001376 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001377 goto error;
1378 }
1379
1380 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001381
1382 }
1383
1384 return;
1385
1386error:
1387 if (pAssocReq != NULL)
1388 {
1389 if ( pAssocReq->assocReqFrame )
1390 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301391 vos_mem_free(pAssocReq->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 pAssocReq->assocReqFrame = NULL;
1393 }
1394
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301395 vos_mem_free(pAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 }
1397
Jeff Johnsone7245742012-09-05 17:12:55 -07001398 /* If it is not duplicate Assoc request then only make to Null */
1399 if ((pStaDs != NULL) &&
1400 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001402
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 return;
1404
1405} /*** end limProcessAssocReqFrame() ***/
1406
1407
1408
1409/**---------------------------------------------------------------
1410\fn limSendMlmAssocInd
1411\brief This function sends either LIM_MLM_ASSOC_IND
1412\ or LIM_MLM_REASSOC_IND to SME.
1413\
1414\param pMac
1415\param *pStaDs - Station DPH hash entry
1416\param psessionEntry - PE session entry
1417\return None
1418
1419 * ?????? How do I get
1420 * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
1421 * - aid =====> pStaDs->assocId
1422 * - pHdr->sa =====> pStaDs->staAddr
1423 * - authType
1424 * - pHdr->seqControl =====> no longer needed
1425 * - pStaDs
1426------------------------------------------------------------------*/
1427void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1428{
1429 tpLimMlmAssocInd pMlmAssocInd = NULL;
1430 tpLimMlmReassocInd pMlmReassocInd;
1431 tpSirAssocReq pAssocReq;
1432 tANI_U16 temp;
1433 tANI_U32 phyMode;
1434 tANI_U8 subType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 tANI_U8 *wpsIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 tANI_U32 tmp;
1437// tANI_U16 statusCode;
1438 tANI_U16 i, j=0;
1439
1440 // Get a copy of the already parsed Assoc Request
1441 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
1442
1443 // Get the phyMode
1444 limGetPhyMode(pMac, &phyMode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 // Extract pre-auth context for the peer BTAMP-STA, if any.
1446
1447 // Determiine if its Assoc or ReAssoc Request
1448 if (pAssocReq->reassocRequest == 1)
1449 subType = LIM_REASSOC;
1450 else
1451 subType = LIM_ASSOC;
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301452
1453 limLog(pMac, LOG1, FL("Sessionid %d ssid %s subtype %d Associd %d staAddr "
1454 MAC_ADDRESS_STR), psessionEntry->peSessionId, pAssocReq->ssId.ssId,
1455 subType,pStaDs->assocId,MAC_ADDR_ARRAY(pStaDs->staAddr));
1456
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 if (subType == LIM_ASSOC || subType == LIM_REASSOC)
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 {
1459 temp = sizeof(tLimMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001460
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301461 pMlmAssocInd = vos_mem_malloc(temp);
1462 if (NULL == pMlmAssocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001464 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301465 limLog(pMac, LOGP, FL("AllocateMemory failed for pMlmAssocInd"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 return;
1467 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301468 vos_mem_set(pMlmAssocInd, temp ,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001469
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301470 vos_mem_copy((tANI_U8 *)pMlmAssocInd->peerMacAddr,
1471 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001472
1473 pMlmAssocInd->aid = pStaDs->assocId;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301474 vos_mem_copy((tANI_U8 *)&pMlmAssocInd->ssId,
1475 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 pMlmAssocInd->sessionId = psessionEntry->peSessionId;
1477 pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
1478
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
1480
1481 // Fill in RSN IE information
1482 pMlmAssocInd->rsnIE.length = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 // if WPS IE is present, ignore RSN IE
1484 if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
1485 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1486 }
1487 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301489 limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d"),
1490 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1492 pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1493 pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301494 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[2],
1495 pAssocReq->rsn.info,
1496 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 }
1498
Jeff Johnson295189b2012-06-20 16:38:30 -07001499 // Fill in 802.11h related info
1500 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1501 {
1502 pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
1503 pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1504 pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1505 limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
1506 }
1507 else
1508 pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
1509
1510
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 /* This check is to avoid extra Sec IEs present incase of WPS */
1512 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 {
1514 if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
1515 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301516 PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d"),
1517 pMlmAssocInd->rsnIE.length);)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301518 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 return;
1520 }
1521 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1522 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301523 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
1524 pAssocReq->wpa.info,
1525 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001526 pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1527 }
1528
1529
1530 pMlmAssocInd->addIE.length = 0;
1531 if (pAssocReq->addIEPresent)
1532 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301533 vos_mem_copy(&pMlmAssocInd->addIE.addIEdata,
1534 pAssocReq->addIE.addIEdata,
1535 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001536
1537 pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
1538 }
1539
Jeff Johnson295189b2012-06-20 16:38:30 -07001540 if(pAssocReq->wmeInfoPresent)
1541 {
1542
1543 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301544 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"),
1545 WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001546
1547 /* check whether AP is enabled with WMM */
1548 if(tmp)
1549 {
1550 pMlmAssocInd->WmmStaInfoPresent = 1;
1551 }
1552 else
1553 {
1554 pMlmAssocInd->WmmStaInfoPresent= 0;
1555 }
1556 /* Note: we are not rejecting association here because IOT will fail */
1557
1558 }
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301559#ifdef WLAN_FEATURE_AP_HT40_24G
1560 if(pAssocReq->HTCaps.present)
1561 {
1562 limLog(pMac, LOGW, FL("HT40MHzInto: %d"),
1563 pAssocReq->HTCaps.stbcControlFrame);
1564 pMlmAssocInd->HT40MHzIntoPresent =
1565 pAssocReq->HTCaps.stbcControlFrame;
1566 }
1567#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001568
1569 // Required for indicating the frames to upper layer
1570 pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1571 pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
1572
1573 pMlmAssocInd->beaconPtr = psessionEntry->beacon;
1574 pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
1575
1576 limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301577 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001578 }
1579 else
1580 {
1581 // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
1582 temp = sizeof(tLimMlmReassocInd);
1583
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301584 pMlmReassocInd = vos_mem_malloc(temp);
1585 if (NULL == pMlmReassocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301587 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1588 "pMlmReassocInd"));
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001589 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001590 return;
1591 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301592 vos_mem_set(pMlmReassocInd, temp, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001593
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301594 vos_mem_copy((tANI_U8 *) pMlmReassocInd->peerMacAddr,
1595 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
1596 vos_mem_copy((tANI_U8 *) pMlmReassocInd->currentApAddr,
1597 (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001598 pMlmReassocInd->aid = pStaDs->assocId;
1599 pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301600 vos_mem_copy((tANI_U8 *)&pMlmReassocInd->ssId,
1601 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001602
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 if (pAssocReq->propIEinfo.aniIndicator)
1604 pStaDs->aniPeer = 1;
1605
1606 pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
1607 pMlmReassocInd->rsnIE.length = 0;
1608
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
1610 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1611
1612 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301614 limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d"),
1615 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1617 pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1618 pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301619 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[2],
1620 pAssocReq->rsn.info, pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 }
1622
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 // 802.11h support
1624 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1625 {
1626 pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
1627 pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1628 pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1629 pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
1630
1631 limLog(pMac, LOG1,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301632 FL("Sending Reassoc Ind: spectrum ON, minPwr %d, "
1633 "maxPwr %d, numChnl %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 pMlmReassocInd->powerCap.minTxPower,
1635 pMlmReassocInd->powerCap.maxTxPower,
1636 pMlmReassocInd->supportedChannels.numChnl);
1637
1638 for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
1639 {
1640 pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001641 limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 i, pMlmReassocInd->supportedChannels.channelList[i]);
1643 j+=2;
1644 }
1645 }
1646 else
1647 pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
1648
1649
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 /* This check is to avoid extra Sec IEs present incase of WPS */
1651 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301653 limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d"),
1654 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1656 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301657 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
1658 pAssocReq->wpa.info,
1659 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1661 }
1662
1663 pMlmReassocInd->addIE.length = 0;
1664 if (pAssocReq->addIEPresent)
1665 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301666 vos_mem_copy(&pMlmReassocInd->addIE.addIEdata,
1667 pAssocReq->addIE.addIEdata,
1668 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001669
1670 pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
1671 }
1672
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 if(pAssocReq->wmeInfoPresent)
1674 {
1675
1676 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301677 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"),
1678 WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001679
1680 /* check whether AP is enabled with WMM */
1681 if(tmp)
1682 {
1683 pMlmReassocInd->WmmStaInfoPresent = 1;
1684 }
1685 else
1686 {
1687 pMlmReassocInd->WmmStaInfoPresent = 0;
1688 }
1689 /* Note: we are not rejecting Re-association here because IOT will fail */
1690
1691 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001692
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301693#ifdef WLAN_FEATURE_AP_HT40_24G
1694 if(pAssocReq->HTCaps.present)
1695 {
1696 limLog(pMac, LOGW, FL("RASSOC HT40MHzInto: %d"),
1697 pAssocReq->HTCaps.stbcControlFrame);
1698 pMlmReassocInd->HT40MHzIntoPresent =
1699 pAssocReq->HTCaps.stbcControlFrame;
1700 }
1701#endif
1702
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 // Required for indicating the frames to upper layer
1704 pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1705 pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
1706
1707 pMlmReassocInd->beaconPtr = psessionEntry->beacon;
1708 pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
1709
1710 limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301711 vos_mem_free(pMlmReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 }
1713
1714 return;
1715
1716} /*** end limSendMlmAssocInd() ***/