blob: c08e9e098851f4022f50c473f6040d9432914bbe [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kapil Gupta083f3912017-06-06 12:05:22 +05302 * Copyright (c) 2012-2013, 2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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);
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530234 if (NULL != pStaDs)
Abhishek Singh744e0582014-11-20 15:32:32 +0530235 {
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530236 if (pHdr->fc.retry > 0)
237 {
238 /* Ignore the Retry */
239 limLog(pMac, LOGE,
240 FL("STA is initiating Assoc Req after ACK lost. "
241 "So, do not Process sessionid: %d sys subType=%d "
242 "for role=%d from: "MAC_ADDRESS_STR),
243 psessionEntry->peSessionId, subType,
244 psessionEntry->limSystemRole,
245 MAC_ADDR_ARRAY(pHdr->sa));
246 return;
247 }
248 else
249 {
Abhishek Singhbb729a22015-09-21 10:19:25 +0530250#ifdef WLAN_FEATURE_11W
251 /* Do not send Assoc rsp for duplicate assoc req in case of PMF
252 * enabled STA, as driver needs to start SA Querry in this case
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530253 */
Abhishek Singhbb729a22015-09-21 10:19:25 +0530254 if (!pStaDs->rmfEnabled)
255#endif
256 {
257 /* STA might have missed the assoc response,
258 * so it is sending assoc request frame again.
259 */
260 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS,
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530261 pStaDs->assocId, pStaDs->staAddr,
262 pStaDs->mlmStaContext.subType, pStaDs,
263 psessionEntry);
Abhishek Singhbb729a22015-09-21 10:19:25 +0530264 limLog(pMac, LOGE,
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530265 FL("DUT already received an assoc request frame "
266 "and STA is sending another assoc req.So, do not "
267 "Process sessionid: %d sys subType=%d for role=%d "
268 "from: "MAC_ADDRESS_STR),
269 psessionEntry->peSessionId, subType,
270 psessionEntry->limSystemRole,
271 MAC_ADDR_ARRAY(pHdr->sa));
Abhishek Singhbb729a22015-09-21 10:19:25 +0530272 return;
273 }
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530274 }
Abhishek Singh744e0582014-11-20 15:32:32 +0530275 }
276
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 // Get pointer to Re/Association Request frame body
278 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
279
280 if (limIsGroupAddr(pHdr->sa))
281 {
282 // Received Re/Assoc Req frame from a BC/MC address
283 // Log error and ignore it
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530284 limLog(pMac, LOGE, FL("Received %s Req on sessionid: %d frame from a "
285 "BC/MC address"MAC_ADDRESS_STR),
286 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
287 psessionEntry->peSessionId,
288 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 return;
290 }
Mohit Khanna23863762012-09-11 17:40:09 -0700291
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
293
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530294 if (vos_mem_compare((tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da,
Jeff Johnsone7245742012-09-05 17:12:55 -0700295 (tANI_U8) (sizeof(tSirMacAddr))))
296 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530297 limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as"
298 " SAP/GO"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700299 limSendAssocRspMgmtFrame(pMac,
300 eSIR_MAC_UNSPEC_FAILURE_STATUS,
301 1,
302 pHdr->sa,
303 subType, 0,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700304 return ;
305 }
306
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
308 if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
309 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530310 limLog(pMac, LOGE, FL("TKIP counter measure is active"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 limSendAssocRspMgmtFrame(pMac,
312 eSIR_MAC_MIC_FAILURE_REASON,
313 1,
314 pHdr->sa,
315 subType, 0, psessionEntry);
316 return;
317 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700318
319 // Allocate memory for the Assoc Request frame
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530320 pAssocReq = vos_mem_malloc(sizeof(*pAssocReq));
321 if (NULL == pAssocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530323 limLog(pMac, LOGP, FL("Allocate Memory failed in AssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 return;
325 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530326 vos_mem_set((void *)pAssocReq , sizeof(*pAssocReq), 0);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800327
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 // Parse Assoc Request frame
329 if (subType == LIM_ASSOC)
330 status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
331 else
332 status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
333
334 if (status != eSIR_SUCCESS)
335 {
Agarwal Ashish3b3f3cb2015-07-02 16:43:47 +0530336 limLog(pMac, LOGW,
337 FL("Parse error AssocRequest, length=%d from "MAC_ADDRESS_STR),
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530338 framelen, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry);
340 goto error;
341 }
342
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530343 pAssocReq->assocReqFrame = vos_mem_malloc(framelen);
344 if ( NULL == pAssocReq->assocReqFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530346 limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, "
347 "length=%d from "),framelen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 goto error;
349 }
350
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530351 vos_mem_copy((tANI_U8 *) pAssocReq->assocReqFrame,
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 (tANI_U8 *) pBody, framelen);
353 pAssocReq->assocReqFrameLength = framelen;
354
355 if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS)
356 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700357 limLog(pMac, LOGP, FL("could not retrieve Capabilities"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 goto error;
359 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 limCopyU16((tANI_U8 *) &localCapabilities, temp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700361
362 if (limCompareCapabilities(pMac,
363 pAssocReq,
364 &localCapabilities,psessionEntry) == false)
365 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530366 limLog(pMac, LOGE, FL("local caps mismatch received caps"));
367 limLog(pMac, LOGE, FL("Received %s Req with unsupported "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530368 "capabilities from"MAC_ADDRESS_STR),
369 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
370 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 /**
372 * Capabilities of requesting STA does not match with
373 * local capabilities. Respond with 'unsupported capabilities'
374 * status code.
375 */
376 limSendAssocRspMgmtFrame(
377 pMac,
378 eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
379 1,
380 pHdr->sa,
381 subType, 0,psessionEntry);
382
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 goto error;
384 }
385
386 updateContext = false;
387
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
389 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530390 limLog(pMac, LOGE, FL("Received %s Req with unmatched ssid ( Received"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530391 " SSID: %.*s current SSID: %.*s ) from "MAC_ADDRESS_STR),
392 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", pAssocReq->ssId.length,
393 pAssocReq->ssId.ssId, psessionEntry->ssId.length,
394 psessionEntry->ssId.ssId, MAC_ADDR_ARRAY(pHdr->sa));
395
Jeff Johnson295189b2012-06-20 16:38:30 -0700396 /**
397 * Received Re/Association Request with either
398 * Broadcast SSID OR with SSID that does not
399 * match with local one.
400 * Respond with unspecified status code.
401 */
402 limSendAssocRspMgmtFrame(pMac,
403 eSIR_MAC_UNSPEC_FAILURE_STATUS,
404 1,
405 pHdr->sa,
406 subType, 0,psessionEntry);
407
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 goto error;
409 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700410
411 /***************************************************************
412 ** Verify if the requested rates are available in supported rate
413 ** set or Extended rate set. Some APs are adding basic rates in
414 ** Extended rateset IE
415 ***************************************************************/
416 basicRates.numRates = 0;
417
Gopichand Nakkala94273ab2013-03-25 14:47:39 +0530418 for(i = 0; i < pAssocReq->supportedRates.numRates && (i < SIR_MAC_RATESET_EID_MAX); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 {
420 basicRates.rate[i] = pAssocReq->supportedRates.rate[i];
421 basicRates.numRates++;
422 }
423
424 for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++)
425 {
426 basicRates.rate[i] = pAssocReq->extendedRates.rate[j];
427 basicRates.numRates++;
428 }
429 if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
430 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530431 limLog(pMac, LOGE, FL("Received %s Req with unsupported "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530432 "rates from"MAC_ADDRESS_STR),
433 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
434 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 /**
436 * Requesting STA does not support ALL BSS basic
437 * rates. Respond with 'basic rates not supported'
438 * status code.
439 */
440 limSendAssocRspMgmtFrame(
441 pMac,
442 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
443 1,
444 pHdr->sa,
445 subType, 0,psessionEntry);
446
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 goto error;
448 }
449
Jeff Johnson295189b2012-06-20 16:38:30 -0700450
451 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
452 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) &&
453 ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present)))
454 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530455 limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy "
456 "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
458 1, pHdr->sa, subType, 0, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 goto error;
460
461 }//end if phyMode == 11G_only
462
463 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
464 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) &&
465 (!pAssocReq->HTCaps.present))
466 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530467 limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy "
468 "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
470 1, pHdr->sa, subType, 0, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 goto error;
472 }//end if PhyMode == 11N_only
473
Jeff Johnson295189b2012-06-20 16:38:30 -0700474
475 /* Spectrum Management (11h) specific checks */
476 if (localCapabilities.spectrumMgt)
477 {
478 tSirRetStatus status = eSIR_SUCCESS;
479
480 /* If station is 11h capable, then it SHOULD send all mandatory
481 * IEs in assoc request frame. Let us verify that
482 */
483 if (pAssocReq->capabilityInfo.spectrumMgt)
484 {
485 if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent)))
486 {
487 /* One or more required information elements are missing, log the peers error */
488 if (!pAssocReq->powerCapabilityPresent)
489 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530490 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability "
491 "IE in %s Req from "MAC_ADDRESS_STR),
492 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
493 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 }
495 if (!pAssocReq->supportedChannelsPresent)
496 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530497 limLog(pMac, LOGW, FL("LIM Info: Missing Supported channel "
498 "IE in %s Req from "MAC_ADDRESS_STR),
499 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
500 MAC_ADDR_ARRAY(pHdr->sa));
501
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 }
504 else
505 {
506 /* Assoc request has mandatory fields */
507 status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry);
508 if (eSIR_SUCCESS != status)
509 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530510 limLog(pMac, LOGW, FL("LIM Info: MinTxPower(STA) > "
511 "MaxTxPower(AP) in %s Req from "MAC_ADDRESS_STR),
512 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
513 MAC_ADDR_ARRAY(pHdr->sa));
514
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 }
516 status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq);
517 if (eSIR_SUCCESS != status)
518 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530519 limLog(pMac, LOGW, FL("LIM Info: wrong supported "
520 "channels (STA) in %s Req from "MAC_ADDRESS_STR),
521 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
522 MAC_ADDR_ARRAY(pHdr->sa));
523
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 }
525 /* IEs are valid, use them if needed */
526 }
527 } //if(assoc.capabilityInfo.spectrumMgt)
528 else
529 {
530 /* As per the capabiities, the spectrum management is not enabled on the station
531 * The AP may allow the associations to happen even if spectrum management is not
532 * allowed, if the transmit power of station is below the regulatory maximum
533 */
534
535 /* TODO: presently, this is not handled. In the current implemetation, the AP would
536 * allow the station to associate even if it doesn't support spectrum management.
537 */
538 }
539 }// end of spectrum management related processing
540
541 if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
542 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530543 limLog(pMac, LOGE, FL("received %s req with unsupported"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530544 "MCS Rate Set from "MAC_ADDRESS_STR),
545 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
546 MAC_ADDR_ARRAY(pHdr->sa));
547
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 /**
549 * Requesting STA does not support ALL BSS MCS basic Rate set rates.
550 * Spec does not define any status code for this scenario.
551 */
552 limSendAssocRspMgmtFrame(
553 pMac,
554 eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS,
555 1,
556 pHdr->sa,
557 subType, 0,psessionEntry);
558
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 goto error;
560 }
561
562 //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G)
563 if (phyMode == WNI_CFG_PHY_MODE_11G)
564 {
565
566 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS)
567 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700568 limLog(pMac, LOGP, FL("could not retrieve 11g-only flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 goto error;
570 }
571
572 if (!pAssocReq->extendedRatesPresent && val)
573 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530574 limLog(pMac, LOGE, FL("Rejecting Re/Assoc req from 11b STA: "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530575 MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 /**
577 * Received Re/Association Request from
578 * 11b STA when 11g only policy option
579 * is set.
580 * Reject with unspecified status code.
581 */
582 limSendAssocRspMgmtFrame(
583 pMac,
584 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
585 1,
586 pHdr->sa,
587 subType, 0,psessionEntry);
588
Jeff Johnson295189b2012-06-20 16:38:30 -0700589
590#ifdef WLAN_DEBUG
591 pMac->lim.gLim11bStaAssocRejectCount++;
592#endif
593 goto error;
594 }
595 }
596
597#ifdef WMM_APSD
598 // Save the QOS info element in assoc request..
599 limGetWmeMode(pMac, &wmeMode);
600 if (wmeMode == eHAL_SET)
601 {
602 tpQosInfoSta qInfo;
603
604 qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo);
605
606 if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi))
607 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530608 limLog(pMac, LOGW,
609 FL("Rejecting Re/Assoc req from STA: "MAC_ADDRESS_STR),
610 MAC_ADDR_ARRAY(pHdr->sa));
611 limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x"), *qInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700612
613 /**
614 * Received Re/Association Request from
615 * 11b STA when 11g only policy option
616 * is set.
617 * Reject with unspecified status code.
618 */
619 limSendAssocRspMgmtFrame(
620 pMac,
621 eSIR_MAC_WME_REFUSED_STATUS,
622 1,
623 pHdr->sa,
624 subType, 0,psessionEntry);
625
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 goto error;
627 }
628 }
629#endif
630
631 // Check for 802.11n HT caps compatibility; are HT Capabilities
632 // turned on in lim?
Jeff Johnsone7245742012-09-05 17:12:55 -0700633 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 {
635 // There are; are they turned on in the STA?
636 if ( pAssocReq->HTCaps.present )
637 {
638 // The station *does* support 802.11n HT capability...
639
640 limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d "
641 "PowerSave:%d greenField:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700642 "shortGI20:%d shortGI40:%d"
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 "txSTBC:%d rxSTBC:%d delayBA:%d"
644 "maxAMSDUsize:%d DSSS/CCK:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700645 "PSMP:%d stbcCntl:%d lsigTXProt:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 pAssocReq->HTCaps.advCodingCap,
647 pAssocReq->HTCaps.supportedChannelWidthSet,
648 pAssocReq->HTCaps.mimoPowerSave,
649 pAssocReq->HTCaps.greenField,
650 pAssocReq->HTCaps.shortGI20MHz,
651 pAssocReq->HTCaps.shortGI40MHz,
652 pAssocReq->HTCaps.txSTBC,
653 pAssocReq->HTCaps.rxSTBC,
654 pAssocReq->HTCaps.delayedBA,
655 pAssocReq->HTCaps.maximalAMSDUsize,
656 pAssocReq->HTCaps.dsssCckMode40MHz,
657 pAssocReq->HTCaps.psmp,
658 pAssocReq->HTCaps.stbcControlFrame,
659 pAssocReq->HTCaps.lsigTXOPProtection );
660
661 // Make sure the STA's caps are compatible with our own:
662 //11.15.2 Support of DSSS/CCK in 40 MHz
663 //the AP shall refuse association requests from an HT STA that has the DSSS/CCK
664 //Mode in 40 MHz subfield set to 1;
665
666 //FIXME_BTAMP_AP : Need to be enabled
667 /*
668 if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz )
669 {
670 statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS;
671 limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700672 "STA rejected." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 // Reject association
674 limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry);
675 goto error;
676 }
677 */
678 }
679 } // End if on HT caps turned on in lim.
680
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 /* 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 +0530682 vos_mem_set((tANI_U8*)&Dot11fIERSN, sizeof( Dot11fIERSN ), 0);
683 vos_mem_set((tANI_U8*)&Dot11fIEWPA, sizeof( Dot11fIEWPA ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700684
685 /* if additional IE is present, check if it has WscIE */
686 if( pAssocReq->addIEPresent && pAssocReq->addIE.length )
687 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
688 /* when wpsIe is present, RSN/WPA IE is ignored */
689 if( wpsIe == NULL )
690 {
691 /** check whether as RSN IE is present */
692 if(psessionEntry->limSystemRole == eLIM_AP_ROLE
693 && psessionEntry->pLimStartBssReq->privacy
694 && psessionEntry->pLimStartBssReq->rsnIE.length)
695 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530696 limLog(pMac, LOG1,
Kiet Lam82004c62013-11-11 13:24:28 +0530697 FL("RSN enabled auth, Re/Assoc req from STA: "MAC_ADDRESS_STR),
698 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 if(pAssocReq->rsnPresent)
700 {
701 if(pAssocReq->rsn.length)
702 {
703 // Unpack the RSN IE
Kapil Gupta083f3912017-06-06 12:05:22 +0530704 if (dot11fUnpackIeRSN(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 &pAssocReq->rsn.info[0],
706 pAssocReq->rsn.length,
Kapil Gupta083f3912017-06-06 12:05:22 +0530707 &Dot11fIERSN) != DOT11F_PARSE_SUCCESS)
708 {
709 limLog(pMac, LOGE,
710 FL("Invalid RSNIE received"));
711 limSendAssocRspMgmtFrame(pMac,
712 eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS,
713 1, pHdr->sa, subType, 0,psessionEntry);
714 goto error;
715 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700716
717 /* Check RSN version is supported or not */
718 if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version)
719 {
720 /* check the groupwise and pairwise cipher suites */
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700721 if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry,
722 pAssocReq->HTCaps.present, &pmfConnection)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530724 limLog(pMac, LOGE, FL("RSN Mismatch. Rejecting Re/Assoc req from "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530725 "STA: "MAC_ADDRESS_STR),
726 MAC_ADDR_ARRAY(pHdr->sa));
727
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 /* some IE is not properly sent */
729 /* received Association req frame with RSN IE but length is 0 */
730 limSendAssocRspMgmtFrame(
731 pMac,
732 status,
733 1,
734 pHdr->sa,
735 subType, 0,psessionEntry);
736
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 goto error;
738
739 }
740 }
741 else
742 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530743 limLog(pMac, LOGE, FL("RSN Version mismatch. "
744 "Rejecting Re/Assoc req from "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530745 "STA: "MAC_ADDRESS_STR),
746 MAC_ADDR_ARRAY(pHdr->sa));
747
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 /* received Association req frame with RSN IE version wrong */
749 limSendAssocRspMgmtFrame(
750 pMac,
751 eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS,
752 1,
753 pHdr->sa,
754 subType, 0,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 goto error;
756
757 }
758 }
759 else
760 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530761 limLog(pMac, LOGW, FL("RSN length not correct. "
762 "Rejecting Re/Assoc req from STA:"
763 MAC_ADDRESS_STR),
764 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 /* received Association req frame with RSN IE but length is 0 */
766 limSendAssocRspMgmtFrame(
767 pMac,
768 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
769 1,
770 pHdr->sa,
771 subType, 0,psessionEntry);
772
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 goto error;
774
775 }
776 } /* end - if(pAssocReq->rsnPresent) */
777 if((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent)
778 {
779 // Unpack the WPA IE
780 if(pAssocReq->wpa.length)
781 {
Kapil Gupta083f3912017-06-06 12:05:22 +0530782 if (dot11fUnpackIeWPA(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 &pAssocReq->wpa.info[4], //OUI is not taken care
784 pAssocReq->wpa.length,
Kapil Gupta083f3912017-06-06 12:05:22 +0530785 &Dot11fIEWPA) != DOT11F_PARSE_SUCCESS)
786 {
787 limLog(pMac, LOGE, FL("Invalid WPA IE"));
788 limSendAssocRspMgmtFrame(pMac,
789 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
790 1, pHdr->sa, subType, 0,psessionEntry);
791 goto error;
792 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 /* check the groupwise and pairwise cipher suites */
794 if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present)))
795 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530796 limLog(pMac, LOGW, FL("WPA IE mismatch. "
797 "Rejecting Re/Assoc req from "
798 "STA: "MAC_ADDRESS_STR),
799 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 /* received Association req frame with WPA IE but mismatch */
801 limSendAssocRspMgmtFrame(
802 pMac,
803 status,
804 1,
805 pHdr->sa,
806 subType, 0,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 goto error;
808
809 }
810 }
811 else
812 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530813 limLog(pMac, LOGW, FL("WPA len incorrect. "
814 "Rejecting Re/Assoc req from STA: "
815 MAC_ADDRESS_STR),
816 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 /* received Association req frame with invalid WPA IE */
818 limSendAssocRspMgmtFrame(
819 pMac,
820 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
821 1,
822 pHdr->sa,
823 subType, 0,psessionEntry);
824
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 goto error;
826 }/* end - if(pAssocReq->wpa.length) */
827 } /* end - if(pAssocReq->wpaPresent) */
828 } /* end of if(psessionEntry->pLimStartBssReq->privacy
829 && psessionEntry->pLimStartBssReq->rsnIE->length) */
830
831 } /* end of if( ! pAssocReq->wscInfo.present ) */
Jeff Johnson295189b2012-06-20 16:38:30 -0700832
833 /**
834 * Extract 'associated' context for STA, if any.
835 * This is maintained by DPH and created by LIM.
836 */
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800837 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700838
839 /// Extract pre-auth context for the STA, if any.
840 pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa);
841
842 if (pStaDs == NULL)
843 {
844 /// Requesting STA is not currently associated
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800845 if (peGetCurrentSTAsCount(pMac) == pMac->lim.maxStation)
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 {
847 /**
848 * Maximum number of STAs that AP can handle reached.
849 * Send Association response to peer MAC entity
850 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530851 limLog(pMac, LOGE, FL("Max Sta count reached : %d"),
852 pMac->lim.maxStation);
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 limRejectAssociation(pMac, pHdr->sa,
854 subType, false,
855 (tAniAuthType) 0, 0,
856 false,
857 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
858
859 goto error;
860 }
861
862 /// Check if STA is pre-authenticated.
863 if ((pStaPreAuthContext == NULL) ||
864 (pStaPreAuthContext &&
865 (pStaPreAuthContext->mlmState !=
866 eLIM_MLM_AUTHENTICATED_STATE)))
867 {
868 /**
869 * STA is not pre-authenticated yet requesting
870 * Re/Association before Authentication.
871 * OR STA is in the process of getting authenticated
872 * and sent Re/Association request.
873 * Send Deauthentication frame with 'prior
874 * authentication required' reason code.
875 */
876 limSendDeauthMgmtFrame(
877 pMac,
878 eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800879 pHdr->sa, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700880
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530881 limLog(pMac, LOGE, FL("received %s req on sessionid: %d from STA "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530882 "that does not have pre-auth context"MAC_ADDRESS_STR),
883 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
884 psessionEntry->peSessionId,
885 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 goto error;
887 }
888
889 /// Delete 'pre-auth' context of STA
890 authType = pStaPreAuthContext->authType;
891 limDeletePreAuthNode(pMac, pHdr->sa);
892
893 // All is well. Assign AID (after else part)
894
895 } // if (pStaDs == NULL)
896 else
897 {
898 // STA context does exist for this STA
899
900 if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
901 {
902 /**
903 * Requesting STA is in some 'transient' state?
904 * Ignore the Re/Assoc Req frame by incrementing
905 * debug counter & logging error.
906 */
907 if (subType == LIM_ASSOC)
908 {
909
910#ifdef WLAN_DEBUG
911 pMac->lim.gLimNumAssocReqDropInvldState++;
912#endif
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530913 limLog(pMac, LOGE, FL("received Assoc req in state "
Sushant Kaushik1b645382014-10-13 16:39:36 +0530914 "%d from "), pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700915 }
916 else
917 {
918#ifdef WLAN_DEBUG
919 pMac->lim.gLimNumReassocReqDropInvldState++;
920#endif
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530921 limLog(pMac, LOGE, FL("received ReAssoc req in state %d"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530922 " from "), pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700923 }
924 limPrintMacAddr(pMac, pHdr->sa, LOG1);
925 limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -0700926
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 goto error;
928 } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
929
Chet Lanctot8cecea22014-02-11 19:09:36 -0800930 /* STA sent association Request frame while already in
931 * 'associated' state */
932
933#ifdef WLAN_FEATURE_11W
934 limLog(pMac, LOG1, FL("Re/Assoc request from station that is already associated"));
935 limLog(pMac, LOG1, FL("PMF enabled %d, SA Query state %d"), pStaDs->rmfEnabled,
936 pStaDs->pmfSaQueryState);
937 if (pStaDs->rmfEnabled)
938 {
939 switch (pStaDs->pmfSaQueryState)
940 {
941
942 // start SA Query procedure, respond to Association Request
943 // with try again later
944 case DPH_SA_QUERY_NOT_IN_PROGRESS:
Abhishek Singh65d66352014-07-15 23:14:38 +0530945 /*
946 * We should reset the retry counter before we start
947 * the SA query procedure, otherwise in next set of SA query
948 * procedure we will end up using the stale value.
949 */
950 pStaDs->pmfSaQueryRetryCount = 0;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800951 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1,
952 pHdr->sa, subType, pStaDs, psessionEntry);
953 limSendSaQueryRequestFrame(
954 pMac, (tANI_U8 *)&(pStaDs->pmfSaQueryCurrentTransId),
955 pHdr->sa, psessionEntry);
956 pStaDs->pmfSaQueryStartTransId = pStaDs->pmfSaQueryCurrentTransId;
957 pStaDs->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800958
959 // start timer for SA Query retry
960 if (tx_timer_activate(&pStaDs->pmfSaQueryTimer) != TX_SUCCESS)
961 {
962 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
963 goto error;
964 }
965
966 pStaDs->pmfSaQueryState = DPH_SA_QUERY_IN_PROGRESS;
967 goto error;
968
969 // SA Query procedure still going, respond to Association
970 // Request with try again later
971 case DPH_SA_QUERY_IN_PROGRESS:
972 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1,
973 pHdr->sa, subType, 0, psessionEntry);
974 goto error;
975
976 // SA Query procedure timed out, accept Association Request
977 // normally
978 case DPH_SA_QUERY_TIMED_OUT:
979 pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
980 break;
981 }
982 }
983#endif
984
985 /* no change in the capability so drop the frame */
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530986 if ((VOS_TRUE == vos_mem_compare(&pStaDs->mlmStaContext.capabilityInfo,
987 &pAssocReq->capabilityInfo,
988 sizeof(tSirMacCapabilityInfo)))&&
989 (subType == LIM_ASSOC))
990 {
Sushant Kaushik1b645382014-10-13 16:39:36 +0530991 limLog(pMac, LOGE, FL(" Received Assoc req in state %d STAid=%d"),
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530992 pStaDs->mlmStaContext.mlmState,peerIdx);
993 goto error;
994 }
995 else
996 {
997 /**
998 * STA sent Re/association Request frame while already in
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 * 'associated' state. Update STA capabilities and
1000 * send Association response frame with same AID
1001 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301002 limLog(pMac, LOG1, FL("Received Assoc req from STA already connected"
1003 " UpdateConext"));
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +05301004 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1005 if (pStaPreAuthContext &&
1006 (pStaPreAuthContext->mlmState ==
1007 eLIM_MLM_AUTHENTICATED_STATE))
1008 {
1009 /// STA has triggered pre-auth again
1010 authType = pStaPreAuthContext->authType;
1011 limDeletePreAuthNode(pMac, pHdr->sa);
1012 }
1013 else
1014 authType = pStaDs->mlmStaContext.authType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001015
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +05301016 updateContext = true;
1017 if (dphInitStaState(pMac, pHdr->sa, peerIdx, true, &psessionEntry->dph.dphHashTable)
1018 == NULL)
1019 {
1020 limLog(pMac, LOGE, FL("could not Init STAid=%d"), peerIdx);
1021 goto error;
1022 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 }
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +05301024 goto sendIndToSme;
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 } // end if (lookup for STA in perStaDs fails)
1026
1027
1028
1029 // check if sta is allowed per QoS AC rules
1030 //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled)
1031 limGetWmeMode(psessionEntry, &wmeMode);
1032 if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET))
1033 {
1034 // for a qsta, check if the requested Traffic spec
1035 // is admissible
1036 // for a non-qsta check if the sta can be admitted
1037 if (pAssocReq->addtsPresent)
1038 {
1039 tANI_U8 tspecIdx = 0; //index in the sch tspec table.
1040 if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
1041 &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
1042 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301043 limLog(pMac, LOGE, FL("AdmitControl: TSPEC rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 limSendAssocRspMgmtFrame(
1045 pMac,
1046 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
1047 1,
1048 pHdr->sa,
1049 subType, 0,psessionEntry);
1050#ifdef WLAN_DEBUG
1051 pMac->lim.gLimNumAssocReqDropACRejectTS++;
1052#endif
1053 goto error;
1054 }
1055 }
1056 else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
1057 != eSIR_SUCCESS)
1058 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301059 limLog(pMac, LOGE, FL("AdmitControl: Sta rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 limSendAssocRspMgmtFrame(
1061 pMac,
1062 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
1063 1,
1064 pHdr->sa,
1065 subType, 0,psessionEntry);
1066#ifdef WLAN_DEBUG
1067 pMac->lim.gLimNumAssocReqDropACRejectSta++;
1068#endif
1069 goto error;
1070 }
1071
1072 // else all ok
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001073 limLog(pMac, LOG1, FL("AdmitControl: Sta OK!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001074 }
1075
1076 /**
1077 * STA is Associated !
1078 */
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301079 limLog(pMac, LOGE, FL("Received %s Req successful from "MAC_ADDRESS_STR),
1080 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001081
1082 /**
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001083 * AID for this association will be same as the peer Index used in DPH table.
1084 * Assign unused/least recently used peer Index from perStaDs.
1085 * NOTE: limAssignPeerIdx() assigns AID values ranging
1086 * between 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT)
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 */
1088
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001089 peerIdx = limAssignPeerIdx(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001090
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001091 if (!peerIdx)
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 {
1093 // Could not assign AID
1094 // Reject association
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301095 limLog(pMac, LOGE, FL("PeerIdx not avaialble. Reject associaton"));
1096
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 limRejectAssociation(pMac, pHdr->sa,
1098 subType, true, authType,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001099 peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1101
1102 goto error;
1103 }
1104
1105 /**
1106 * Add an entry to hash table maintained by DPH module
1107 */
1108
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001109 pStaDs = dphAddHashEntry(pMac, pHdr->sa, peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001110
1111 if (pStaDs == NULL)
1112 {
1113 // Could not add hash table entry at DPH
1114 limLog(pMac, LOGE,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301115 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
1116 MAC_ADDRESS_STR),
1117 peerIdx,MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001118
1119 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001120 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001121
1122 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001123 subType, true, authType, peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1125
1126 goto error;
1127 }
1128
1129
1130sendIndToSme:
1131
1132 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1133
1134 pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
Jeff Johnsone7245742012-09-05 17:12:55 -07001135#ifdef WLAN_FEATURE_11AC
1136 pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
1137#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001138 pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
1139 pStaDs->qos.addts = pAssocReq->addtsReq;
1140 pStaDs->qos.capability = pAssocReq->qosCapability;
1141 pStaDs->versionPresent = 0;
1142 /* short slot and short preamble should be updated before doing limaddsta */
1143 pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble;
1144 pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime;
1145
1146 if (pAssocReq->propIEinfo.versionPresent) //update STA version info
1147 {
1148 pStaDs->versionPresent = 1;
1149 pStaDs->version = pAssocReq->propIEinfo.version;
1150 }
1151 pStaDs->propCapability = 0;
1152 if (pAssocReq->propIEinfo.capabilityPresent)
1153 {
1154 if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability))
1155 pStaDs->propCapability &= pAssocReq->propIEinfo.capability;
1156 }
1157
Jeff Johnson295189b2012-06-20 16:38:30 -07001158 pStaDs->valid = 0;
1159 pStaDs->mlmStaContext.authType = authType;
1160 pStaDs->staType = STA_ENTRY_PEER;
1161
1162 //TODO: If listen interval is more than certain limit, reject the association.
1163 //Need to check customer requirements and then implement.
1164 pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval;
1165 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1166
1167 /* The following count will be used to knock-off the station if it doesn't
1168 * come back to receive the buffered data. The AP will wait for numTimSent number
1169 * of beacons after sending TIM information for the station, before assuming that
1170 * the station is no more associated and disassociates it
1171 */
1172
1173 /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
1174 pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval);
1175
1176 /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */
1177 pStaDs->curTxMpduCnt = 0;
1178
1179 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
1180 (pAssocReq->HTCaps.present))
1181 {
1182 pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField;
1183 pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity;
1184 pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz;
1185 pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection;
1186 pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
1187 pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
1188 pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
Krishna Kumaar Natarajan58ec70d2015-07-28 16:16:29 +05301189
1190 /* pAssocReq will be copied to psessionEntry->parsedAssocReq later */
1191 /* check whether AP is enabled with shortGI */
1192 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val) !=
1193 eSIR_SUCCESS) {
1194 limLog(pMac, LOGE,
1195 FL("could not retrieve shortGI 20Mhz CFG"));
1196 goto error;
1197 }
1198 if (val) {
1199 pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
1200 } else {
1201 /* Unset htShortGI20Mhz in ht_caps*/
1202 pAssocReq->HTCaps.shortGI20MHz = 0;
1203 pStaDs->htShortGI20Mhz = 0;
1204 }
1205
1206 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val) !=
1207 eSIR_SUCCESS) {
1208 limLog(pMac, LOGE,
1209 FL("could not retrieve shortGI 40Mhz CFG"));
1210 goto error;
1211 }
1212 if (val) {
1213 pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
1214 } else {
1215 /* Unset htShortGI40Mhz in ht_caps */
1216 pAssocReq->HTCaps.shortGI40MHz = 0;
1217 pStaDs->htShortGI40Mhz = 0;
1218 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001219 pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07001220 /* 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
1221 * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
1222 */
1223 pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
1224#ifdef WLAN_FEATURE_11AC
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07001225 if(pAssocReq->operMode.present)
1226 {
1227 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pAssocReq->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
1228 pStaDs->htSupportedChannelWidthSet = (tANI_U8)(pAssocReq->operMode.chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
1229 }
1230 else if (pAssocReq->VHTCaps.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07001231 {
Madan Mohan Koyyalamudi740f7802012-09-24 14:17:14 -07001232 // Check if STA has enabled it's channel bonding mode.
1233 // If channel bonding mode is enabled, we decide based on SAP's current configuration.
1234 // else, we set it to VHT20.
1235 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pStaDs->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ?
1236 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
1237 psessionEntry->vhtTxChannelWidthSet );
Jeff Johnsone7245742012-09-05 17:12:55 -07001238 }
Madan Mohan Koyyalamudicc394402012-10-05 10:48:19 -07001239
1240 // Lesser among the AP and STA bandwidth of operation.
1241 pStaDs->htSupportedChannelWidthSet =
1242 (pStaDs->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1243 pStaDs->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1244
Jeff Johnsone7245742012-09-05 17:12:55 -07001245#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001246 pStaDs->baPolicyFlag = 0xFF;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001247 pStaDs->htLdpcCapable = (tANI_U8)pAssocReq->HTCaps.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -07001248 }
1249
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001250 if(pAssocReq->VHTCaps.present)
1251 {
1252 pStaDs->vhtLdpcCapable = (tANI_U8)pAssocReq->VHTCaps.ldpcCodingCap;
1253 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001254
Jeff Johnsone7245742012-09-05 17:12:55 -07001255#ifdef WLAN_FEATURE_11AC
1256if (limPopulateMatchingRateSet(pMac,
1257 pStaDs,
1258 &(pAssocReq->supportedRates),
1259 &(pAssocReq->extendedRates),
1260 pAssocReq->HTCaps.supportedMCSSet,
1261 &(pAssocReq->propIEinfo.propRates),
1262 psessionEntry , &pAssocReq->VHTCaps)
1263 != eSIR_SUCCESS)
1264#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001265
1266 if (limPopulateMatchingRateSet(pMac,
1267 pStaDs,
1268 &(pAssocReq->supportedRates),
1269 &(pAssocReq->extendedRates),
1270 pAssocReq->HTCaps.supportedMCSSet,
1271 &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -07001272#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001273 {
1274 // Could not update hash table entry at DPH with rateset
1275 limLog(pMac, LOGE,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301276 FL("could not update hash entry at DPH for aid=%d, MacAddr: "
1277 MAC_ADDRESS_STR),
1278 peerIdx, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001279
1280 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001281 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001282
1283
1284 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001285 subType, true, authType, peerIdx, true,
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1287
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001288 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1289 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 }
1291
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301292 vos_mem_copy((tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
1293 (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 pAssocReq->propIEinfo.propRates.numPropRates + 1);
1295
1296 /// Add STA context at MAC HW (BMU, RHP & TFP)
1297
1298 pStaDs->qosMode = eANI_BOOLEAN_FALSE;
1299 pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
1300 if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
1301 {
1302 pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
1303 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1304 }
1305
1306 pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
1307 pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
1308 limGetWmeMode(psessionEntry, &wmeMode);
1309 //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
1310 if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
1311 {
1312 pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
1313 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1314 limGetWsmMode(psessionEntry, &wsmMode);
1315 /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
1316 can coexist */
Jeff Johnson295189b2012-06-20 16:38:30 -07001317 if( pAssocReq->WMMInfoStation.present)
1318 {
1319 /* check whether AP supports or not */
1320 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
1321 && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
1322 || pAssocReq->WMMInfoStation.acbk_uapsd
1323 || pAssocReq->WMMInfoStation.acvo_uapsd
1324 || pAssocReq->WMMInfoStation.acvi_uapsd))
1325 {
1326
1327 /**
1328 * Received Re/Association Request from
1329 * STA when UPASD is not supported.
1330 */
Deepthi Gowricabd4d12014-11-13 12:51:16 +05301331 limLog( pMac, LOGE, FL( "AP do not support UAPSD so reply "
1332 "to STA accordingly" ));
1333 /* update UAPSD and send it to LIM to add STA */
1334 pStaDs->qos.capability.qosInfo.acbe_uapsd = 0;
1335 pStaDs->qos.capability.qosInfo.acbk_uapsd = 0;
1336 pStaDs->qos.capability.qosInfo.acvo_uapsd = 0;
1337 pStaDs->qos.capability.qosInfo.acvi_uapsd = 0;
1338 pStaDs->qos.capability.qosInfo.maxSpLen = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001339
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 }
1341 else
1342 {
1343 /* update UAPSD and send it to LIM to add STA */
1344 pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
1345 pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
1346 pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
1347 pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
1348 pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
1349 }
1350 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
1352 if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
1353 pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
1354
1355 }
1356
1357 // Re/Assoc Response frame to requesting STA
1358 pStaDs->mlmStaContext.subType = subType;
1359
1360 if (pAssocReq->propIEinfo.aniIndicator)
1361 pStaDs->aniPeer = 1;
1362
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001363#ifdef WLAN_FEATURE_11W
1364 pStaDs->rmfEnabled = (pmfConnection) ? 1 : 0;
Chet Lanctot8cecea22014-02-11 19:09:36 -08001365 pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
1366 timerId.fields.sessionId = psessionEntry->peSessionId;
1367 timerId.fields.peerIdx = peerIdx;
1368 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL,
1369 &retryInterval) != eSIR_SUCCESS)
1370 {
1371 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query retry interval value"));
1372 limRejectAssociation(pMac, pHdr->sa,
1373 subType, true, authType,
1374 peerIdx, false,
1375 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1376 goto error;
1377 }
Satyanarayana Dash6f438272015-03-03 18:01:06 +05301378 if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN > retryInterval)
Abhishek Singhbf9f7d82014-09-25 16:24:59 +05301379 {
Satyanarayana Dash6f438272015-03-03 18:01:06 +05301380 retryInterval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF;
Abhishek Singhbf9f7d82014-09-25 16:24:59 +05301381 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08001382 if (tx_timer_create(&pStaDs->pmfSaQueryTimer, "PMF SA Query timer",
1383 limPmfSaQueryTimerHandler, timerId.value,
1384 SYS_MS_TO_TICKS((retryInterval * 1024) / 1000),
1385 0, TX_NO_ACTIVATE) != TX_SUCCESS)
1386 {
1387 limLog(pMac, LOGE, FL("could not create PMF SA Query timer"));
1388 limRejectAssociation(pMac, pHdr->sa,
1389 subType, true, authType,
1390 peerIdx, false,
1391 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1392 goto error;
1393 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001394#endif
1395
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 // BTAMP: Storing the parsed assoc request in the psessionEntry array
1397 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1398
1399 /* BTAMP: If STA context already exist (ie. updateContext = 1)
1400 * for this STA, then we should delete the old one, and add
1401 * the new STA. This is taken care of in the limDelSta() routine.
1402 *
1403 * Prior to BTAMP, we were setting this flag so that when
1404 * PE receives SME_ASSOC_CNF, and if this flag is set, then
1405 * PE shall delete the old station and then add. But now in
1406 * BTAMP, we're directly adding station before waiting for
1407 * SME_ASSOC_CNF, so we can do this now.
1408 */
1409 if (!updateContext)
1410 {
1411 pStaDs->mlmStaContext.updateContext = 0;
1412
1413 // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001414 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301416 limLog(pMac, LOGE, FL("could not Add STA with assocId=%d"),
1417 pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
1419 true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
1420 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1421
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001422 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1423 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001424 }
1425 }
1426 else
1427 {
1428 pStaDs->mlmStaContext.updateContext = 1;
1429
Jeff Johnson295189b2012-06-20 16:38:30 -07001430 mlmPrevState = pStaDs->mlmStaContext.mlmState;
1431
1432 /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
1433 if(subType != LIM_REASSOC)
1434 {
1435 //we need to set the mlmState here in order differentiate in limDelSta.
1436 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
1437 if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
1438 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301439 limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d"),
1440 pStaDs->assocId, pStaDs->staIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001441 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1442 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1443
1444 //Restoring the state back.
1445 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001446 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 goto error;
1448 }
1449 }
1450 else
1451 {
1452 /* mlmState is changed in limAddSta context */
1453 /* use the same AID, already allocated */
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001454 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301456 limLog(pMac, LOGE, FL( "Could not AddSta with assocId= %d staId %d"),
1457 pStaDs->assocId, pStaDs->staIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1459 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1460
1461 //Restoring the state back.
1462 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001463 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 goto error;
1465 }
1466
1467 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001468
1469 }
1470
1471 return;
1472
1473error:
1474 if (pAssocReq != NULL)
1475 {
1476 if ( pAssocReq->assocReqFrame )
1477 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301478 vos_mem_free(pAssocReq->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 pAssocReq->assocReqFrame = NULL;
1480 }
1481
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301482 vos_mem_free(pAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 }
1484
Jeff Johnsone7245742012-09-05 17:12:55 -07001485 /* If it is not duplicate Assoc request then only make to Null */
1486 if ((pStaDs != NULL) &&
1487 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001489
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 return;
1491
1492} /*** end limProcessAssocReqFrame() ***/
1493
1494
1495
1496/**---------------------------------------------------------------
1497\fn limSendMlmAssocInd
1498\brief This function sends either LIM_MLM_ASSOC_IND
1499\ or LIM_MLM_REASSOC_IND to SME.
1500\
1501\param pMac
1502\param *pStaDs - Station DPH hash entry
1503\param psessionEntry - PE session entry
1504\return None
1505
1506 * ?????? How do I get
1507 * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
1508 * - aid =====> pStaDs->assocId
1509 * - pHdr->sa =====> pStaDs->staAddr
1510 * - authType
1511 * - pHdr->seqControl =====> no longer needed
1512 * - pStaDs
1513------------------------------------------------------------------*/
1514void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1515{
1516 tpLimMlmAssocInd pMlmAssocInd = NULL;
1517 tpLimMlmReassocInd pMlmReassocInd;
1518 tpSirAssocReq pAssocReq;
1519 tANI_U16 temp;
1520 tANI_U32 phyMode;
1521 tANI_U8 subType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 tANI_U8 *wpsIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 tANI_U32 tmp;
1524// tANI_U16 statusCode;
1525 tANI_U16 i, j=0;
1526
1527 // Get a copy of the already parsed Assoc Request
1528 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
1529
1530 // Get the phyMode
1531 limGetPhyMode(pMac, &phyMode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001532 // Extract pre-auth context for the peer BTAMP-STA, if any.
1533
1534 // Determiine if its Assoc or ReAssoc Request
1535 if (pAssocReq->reassocRequest == 1)
1536 subType = LIM_REASSOC;
1537 else
1538 subType = LIM_ASSOC;
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301539
1540 limLog(pMac, LOG1, FL("Sessionid %d ssid %s subtype %d Associd %d staAddr "
1541 MAC_ADDRESS_STR), psessionEntry->peSessionId, pAssocReq->ssId.ssId,
1542 subType,pStaDs->assocId,MAC_ADDR_ARRAY(pStaDs->staAddr));
1543
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 if (subType == LIM_ASSOC || subType == LIM_REASSOC)
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 {
1546 temp = sizeof(tLimMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001547
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301548 pMlmAssocInd = vos_mem_malloc(temp);
1549 if (NULL == pMlmAssocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001550 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001551 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301552 limLog(pMac, LOGP, FL("AllocateMemory failed for pMlmAssocInd"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001553 return;
1554 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301555 vos_mem_set(pMlmAssocInd, temp ,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001556
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301557 vos_mem_copy((tANI_U8 *)pMlmAssocInd->peerMacAddr,
1558 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001559
1560 pMlmAssocInd->aid = pStaDs->assocId;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301561 vos_mem_copy((tANI_U8 *)&pMlmAssocInd->ssId,
1562 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 pMlmAssocInd->sessionId = psessionEntry->peSessionId;
1564 pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
1565
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
1567
1568 // Fill in RSN IE information
1569 pMlmAssocInd->rsnIE.length = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001570 // if WPS IE is present, ignore RSN IE
1571 if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
1572 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1573 }
1574 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001575 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301576 limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d"),
1577 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001578 pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1579 pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1580 pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301581 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[2],
1582 pAssocReq->rsn.info,
1583 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 }
1585
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 // Fill in 802.11h related info
1587 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1588 {
1589 pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
1590 pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1591 pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1592 limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
1593 }
1594 else
1595 pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
1596
1597
Jeff Johnson295189b2012-06-20 16:38:30 -07001598 /* This check is to avoid extra Sec IEs present incase of WPS */
1599 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 {
1601 if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
1602 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301603 PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d"),
1604 pMlmAssocInd->rsnIE.length);)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301605 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 return;
1607 }
1608 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1609 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301610 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
1611 pAssocReq->wpa.info,
1612 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1614 }
1615
1616
1617 pMlmAssocInd->addIE.length = 0;
1618 if (pAssocReq->addIEPresent)
1619 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301620 vos_mem_copy(&pMlmAssocInd->addIE.addIEdata,
1621 pAssocReq->addIE.addIEdata,
1622 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001623
1624 pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
1625 }
1626
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 if(pAssocReq->wmeInfoPresent)
1628 {
1629
1630 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301631 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"),
1632 WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001633
1634 /* check whether AP is enabled with WMM */
1635 if(tmp)
1636 {
1637 pMlmAssocInd->WmmStaInfoPresent = 1;
1638 }
1639 else
1640 {
1641 pMlmAssocInd->WmmStaInfoPresent= 0;
1642 }
1643 /* Note: we are not rejecting association here because IOT will fail */
1644
1645 }
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301646#ifdef WLAN_FEATURE_AP_HT40_24G
1647 if(pAssocReq->HTCaps.present)
1648 {
1649 limLog(pMac, LOGW, FL("HT40MHzInto: %d"),
1650 pAssocReq->HTCaps.stbcControlFrame);
1651 pMlmAssocInd->HT40MHzIntoPresent =
1652 pAssocReq->HTCaps.stbcControlFrame;
1653 }
1654#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001655
1656 // Required for indicating the frames to upper layer
1657 pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1658 pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
1659
1660 pMlmAssocInd->beaconPtr = psessionEntry->beacon;
1661 pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
1662
Deepthi Gowriae6a1662015-10-12 12:59:37 +05301663 pMlmAssocInd->rate_flags =
1664 limGetMaxRateFlags(pStaDs, psessionEntry);
1665
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301667 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 }
1669 else
1670 {
1671 // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
1672 temp = sizeof(tLimMlmReassocInd);
1673
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301674 pMlmReassocInd = vos_mem_malloc(temp);
1675 if (NULL == pMlmReassocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301677 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1678 "pMlmReassocInd"));
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001679 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 return;
1681 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301682 vos_mem_set(pMlmReassocInd, temp, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001683
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301684 vos_mem_copy((tANI_U8 *) pMlmReassocInd->peerMacAddr,
1685 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
1686 vos_mem_copy((tANI_U8 *) pMlmReassocInd->currentApAddr,
1687 (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001688 pMlmReassocInd->aid = pStaDs->assocId;
1689 pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301690 vos_mem_copy((tANI_U8 *)&pMlmReassocInd->ssId,
1691 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001692
Jeff Johnson295189b2012-06-20 16:38:30 -07001693 if (pAssocReq->propIEinfo.aniIndicator)
1694 pStaDs->aniPeer = 1;
1695
1696 pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
1697 pMlmReassocInd->rsnIE.length = 0;
1698
Jeff Johnson295189b2012-06-20 16:38:30 -07001699 if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
1700 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1701
1702 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301704 limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d"),
1705 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1707 pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1708 pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301709 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[2],
1710 pAssocReq->rsn.info, pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 }
1712
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 // 802.11h support
1714 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1715 {
1716 pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
1717 pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1718 pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1719 pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
1720
1721 limLog(pMac, LOG1,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301722 FL("Sending Reassoc Ind: spectrum ON, minPwr %d, "
1723 "maxPwr %d, numChnl %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 pMlmReassocInd->powerCap.minTxPower,
1725 pMlmReassocInd->powerCap.maxTxPower,
1726 pMlmReassocInd->supportedChannels.numChnl);
1727
1728 for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
1729 {
1730 pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001731 limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 i, pMlmReassocInd->supportedChannels.channelList[i]);
1733 j+=2;
1734 }
1735 }
1736 else
1737 pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
1738
1739
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 /* This check is to avoid extra Sec IEs present incase of WPS */
1741 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301743 limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d"),
1744 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1746 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301747 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
1748 pAssocReq->wpa.info,
1749 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001750 pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1751 }
1752
1753 pMlmReassocInd->addIE.length = 0;
1754 if (pAssocReq->addIEPresent)
1755 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301756 vos_mem_copy(&pMlmReassocInd->addIE.addIEdata,
1757 pAssocReq->addIE.addIEdata,
1758 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001759
1760 pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
1761 }
1762
Jeff Johnson295189b2012-06-20 16:38:30 -07001763 if(pAssocReq->wmeInfoPresent)
1764 {
1765
1766 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301767 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"),
1768 WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001769
1770 /* check whether AP is enabled with WMM */
1771 if(tmp)
1772 {
1773 pMlmReassocInd->WmmStaInfoPresent = 1;
1774 }
1775 else
1776 {
1777 pMlmReassocInd->WmmStaInfoPresent = 0;
1778 }
1779 /* Note: we are not rejecting Re-association here because IOT will fail */
1780
1781 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001782
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301783#ifdef WLAN_FEATURE_AP_HT40_24G
1784 if(pAssocReq->HTCaps.present)
1785 {
1786 limLog(pMac, LOGW, FL("RASSOC HT40MHzInto: %d"),
1787 pAssocReq->HTCaps.stbcControlFrame);
1788 pMlmReassocInd->HT40MHzIntoPresent =
1789 pAssocReq->HTCaps.stbcControlFrame;
1790 }
1791#endif
1792
Jeff Johnson295189b2012-06-20 16:38:30 -07001793 // Required for indicating the frames to upper layer
1794 pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1795 pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
1796
1797 pMlmReassocInd->beaconPtr = psessionEntry->beacon;
1798 pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
1799
1800 limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301801 vos_mem_free(pMlmReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 }
1803
1804 return;
1805
1806} /*** end limSendMlmAssocInd() ***/