blob: 06a4c0fdf6af5e287f2f29a11c77047b56b026c5 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
gaurank kathpalia66414892018-03-21 20:24:39 +05302 * Copyright (c) 2012-2013, 2017-2018 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;
gaurank kathpalia66414892018-03-21 20:24:39 +0530176 tANI_U16 prevAuthSeqno = 0xFFFF;
Jeff Johnson295189b2012-06-20 16:38:30 -0700177 tANI_S32 framelen;
178 tSirRetStatus status;
179 tpSirMacMgmtHdr pHdr;
180 struct tLimPreAuthNode *pStaPreAuthContext;
181 tAniAuthType authType;
182 tSirMacCapabilityInfo localCapabilities;
183 tpDphHashNode pStaDs = NULL;
184 tpSirAssocReq pAssocReq;
Jeff Johnson295189b2012-06-20 16:38:30 -0700185 tLimMlmStates mlmPrevState;
186 tDot11fIERSN Dot11fIERSN;
187 tDot11fIEWPA Dot11fIEWPA;
Jeff Johnson295189b2012-06-20 16:38:30 -0700188 tANI_U32 phyMode;
189 tHalBitVal qosMode;
190 tHalBitVal wsmMode, wmeMode;
191 tANI_U8 *wpsIe = NULL;
192 tSirMacRateSet basicRates;
193 tANI_U8 i = 0, j = 0;
Chet Lanctot055d2a32013-08-31 17:29:03 -0700194 tANI_BOOLEAN pmfConnection = eANI_BOOLEAN_FALSE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800195#ifdef WLAN_FEATURE_11W
196 tPmfSaQueryTimerId timerId;
197 tANI_U32 retryInterval;
198#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700199
200 limGetPhyMode(pMac, &phyMode, psessionEntry);
201
202 limGetQosMode(psessionEntry, &qosMode);
203
204 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
205 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
206
Abhishek Singh744e0582014-11-20 15:32:32 +0530207 limLog(pMac, LOG1, FL("Received %s Req Frame on sessionid: %d systemrole %d"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530208 " limMlmState %d from: "MAC_ADDRESS_STR),
209 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
210 psessionEntry->peSessionId, psessionEntry->limSystemRole,
211 psessionEntry->limMlmState, MAC_ADDR_ARRAY(pHdr->sa));
212
Abhishek Singh744e0582014-11-20 15:32:32 +0530213 if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE )
214 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530215 limLog(pMac, LOGE, FL("received unexpected ASSOC REQ on sessionid: %d "
216 "sys subType=%d for role=%d from: "MAC_ADDRESS_STR),
217 psessionEntry->peSessionId,
218 subType, psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700219 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
220 WDA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen);
221 return;
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 {
gaurank kathpalia66414892018-03-21 20:24:39 +0530236 if (pStaDs->PrevAssocSeqno == ((pHdr->seqControl.seqNumHi << 4) |
237 (pHdr->seqControl.seqNumLo)))
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530238 {
239 /* Ignore the Retry */
240 limLog(pMac, LOGE,
241 FL("STA is initiating Assoc Req after ACK lost. "
242 "So, do not Process sessionid: %d sys subType=%d "
243 "for role=%d from: "MAC_ADDRESS_STR),
244 psessionEntry->peSessionId, subType,
245 psessionEntry->limSystemRole,
246 MAC_ADDR_ARRAY(pHdr->sa));
247 return;
248 }
249 else
250 {
Abhishek Singhbb729a22015-09-21 10:19:25 +0530251#ifdef WLAN_FEATURE_11W
252 /* Do not send Assoc rsp for duplicate assoc req in case of PMF
253 * enabled STA, as driver needs to start SA Querry in this case
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530254 */
Abhishek Singhbb729a22015-09-21 10:19:25 +0530255 if (!pStaDs->rmfEnabled)
256#endif
257 {
258 /* STA might have missed the assoc response,
259 * so it is sending assoc request frame again.
260 */
261 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS,
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530262 pStaDs->assocId, pStaDs->staAddr,
263 pStaDs->mlmStaContext.subType, pStaDs,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530264 psessionEntry, NULL);
Abhishek Singhbb729a22015-09-21 10:19:25 +0530265 limLog(pMac, LOGE,
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530266 FL("DUT already received an assoc request frame "
267 "and STA is sending another assoc req.So, do not "
268 "Process sessionid: %d sys subType=%d for role=%d "
269 "from: "MAC_ADDRESS_STR),
270 psessionEntry->peSessionId, subType,
271 psessionEntry->limSystemRole,
272 MAC_ADDR_ARRAY(pHdr->sa));
Abhishek Singhbb729a22015-09-21 10:19:25 +0530273 return;
274 }
Ganesh Kondabattini8169d392015-07-14 18:51:18 +0530275 }
Abhishek Singh744e0582014-11-20 15:32:32 +0530276 }
277
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 // Get pointer to Re/Association Request frame body
279 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
280
281 if (limIsGroupAddr(pHdr->sa))
282 {
283 // Received Re/Assoc Req frame from a BC/MC address
284 // Log error and ignore it
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530285 limLog(pMac, LOGE, FL("Received %s Req on sessionid: %d frame from a "
286 "BC/MC address"MAC_ADDRESS_STR),
287 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
288 psessionEntry->peSessionId,
289 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 return;
291 }
Mohit Khanna23863762012-09-11 17:40:09 -0700292
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
294
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530295 if (vos_mem_compare((tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da,
Jeff Johnsone7245742012-09-05 17:12:55 -0700296 (tANI_U8) (sizeof(tSirMacAddr))))
297 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530298 limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as"
299 " SAP/GO"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700300 limSendAssocRspMgmtFrame(pMac,
301 eSIR_MAC_UNSPEC_FAILURE_STATUS,
302 1,
303 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530304 subType, 0,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -0700305 return ;
306 }
307
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
309 if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
310 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530311 limLog(pMac, LOGE, FL("TKIP counter measure is active"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 limSendAssocRspMgmtFrame(pMac,
313 eSIR_MAC_MIC_FAILURE_REASON,
314 1,
315 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530316 subType, 0, psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 return;
318 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700319
320 // Allocate memory for the Assoc Request frame
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530321 pAssocReq = vos_mem_malloc(sizeof(*pAssocReq));
322 if (NULL == pAssocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530324 limLog(pMac, LOGP, FL("Allocate Memory failed in AssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 return;
326 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530327 vos_mem_set((void *)pAssocReq , sizeof(*pAssocReq), 0);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800328
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 // Parse Assoc Request frame
330 if (subType == LIM_ASSOC)
331 status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
332 else
333 status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
334
335 if (status != eSIR_SUCCESS)
336 {
Agarwal Ashish3b3f3cb2015-07-02 16:43:47 +0530337 limLog(pMac, LOGW,
338 FL("Parse error AssocRequest, length=%d from "MAC_ADDRESS_STR),
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530339 framelen, MAC_ADDR_ARRAY(pHdr->sa));
Kapil Gupta956c0c42017-06-16 19:24:31 +0530340 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1,
341 pHdr->sa, subType, 0, psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 goto error;
343 }
344
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530345 pAssocReq->assocReqFrame = vos_mem_malloc(framelen);
346 if ( NULL == pAssocReq->assocReqFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530348 limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, "
349 "length=%d from "),framelen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 goto error;
351 }
352
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530353 vos_mem_copy((tANI_U8 *) pAssocReq->assocReqFrame,
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 (tANI_U8 *) pBody, framelen);
355 pAssocReq->assocReqFrameLength = framelen;
356
357 if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS)
358 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700359 limLog(pMac, LOGP, FL("could not retrieve Capabilities"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 goto error;
361 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 limCopyU16((tANI_U8 *) &localCapabilities, temp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700363
364 if (limCompareCapabilities(pMac,
365 pAssocReq,
366 &localCapabilities,psessionEntry) == false)
367 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530368 limLog(pMac, LOGE, FL("local caps mismatch received caps"));
369 limLog(pMac, LOGE, FL("Received %s Req with unsupported "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530370 "capabilities from"MAC_ADDRESS_STR),
371 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
372 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 /**
374 * Capabilities of requesting STA does not match with
375 * local capabilities. Respond with 'unsupported capabilities'
376 * status code.
377 */
378 limSendAssocRspMgmtFrame(
379 pMac,
380 eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
381 1,
382 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530383 subType, 0,psessionEntry ,NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700384
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 goto error;
386 }
387
388 updateContext = false;
389
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
391 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530392 limLog(pMac, LOGE, FL("Received %s Req with unmatched ssid ( Received"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530393 " SSID: %.*s current SSID: %.*s ) from "MAC_ADDRESS_STR),
394 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", pAssocReq->ssId.length,
395 pAssocReq->ssId.ssId, psessionEntry->ssId.length,
396 psessionEntry->ssId.ssId, MAC_ADDR_ARRAY(pHdr->sa));
397
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 /**
399 * Received Re/Association Request with either
400 * Broadcast SSID OR with SSID that does not
401 * match with local one.
402 * Respond with unspecified status code.
403 */
404 limSendAssocRspMgmtFrame(pMac,
405 eSIR_MAC_UNSPEC_FAILURE_STATUS,
406 1,
407 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530408 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700409
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 goto error;
411 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700412
413 /***************************************************************
414 ** Verify if the requested rates are available in supported rate
415 ** set or Extended rate set. Some APs are adding basic rates in
416 ** Extended rateset IE
417 ***************************************************************/
418 basicRates.numRates = 0;
419
Gopichand Nakkala94273ab2013-03-25 14:47:39 +0530420 for(i = 0; i < pAssocReq->supportedRates.numRates && (i < SIR_MAC_RATESET_EID_MAX); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 {
422 basicRates.rate[i] = pAssocReq->supportedRates.rate[i];
423 basicRates.numRates++;
424 }
425
426 for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++)
427 {
428 basicRates.rate[i] = pAssocReq->extendedRates.rate[j];
429 basicRates.numRates++;
430 }
431 if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
432 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530433 limLog(pMac, LOGE, FL("Received %s Req with unsupported "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530434 "rates from"MAC_ADDRESS_STR),
435 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
436 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 /**
438 * Requesting STA does not support ALL BSS basic
439 * rates. Respond with 'basic rates not supported'
440 * status code.
441 */
442 limSendAssocRspMgmtFrame(
443 pMac,
444 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
445 1,
446 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530447 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700448
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 goto error;
450 }
451
Jeff Johnson295189b2012-06-20 16:38:30 -0700452
453 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
454 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) &&
455 ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present)))
456 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530457 limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy "
458 "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530460 1, pHdr->sa, subType, 0, psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 goto error;
462
463 }//end if phyMode == 11G_only
464
465 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
466 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) &&
467 (!pAssocReq->HTCaps.present))
468 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530469 limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy "
470 "STA : "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530472 1, pHdr->sa, subType, 0, psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 goto error;
474 }//end if PhyMode == 11N_only
475
Jeff Johnson295189b2012-06-20 16:38:30 -0700476
477 /* Spectrum Management (11h) specific checks */
478 if (localCapabilities.spectrumMgt)
479 {
480 tSirRetStatus status = eSIR_SUCCESS;
481
482 /* If station is 11h capable, then it SHOULD send all mandatory
483 * IEs in assoc request frame. Let us verify that
484 */
485 if (pAssocReq->capabilityInfo.spectrumMgt)
486 {
487 if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent)))
488 {
489 /* One or more required information elements are missing, log the peers error */
490 if (!pAssocReq->powerCapabilityPresent)
491 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530492 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability "
493 "IE in %s Req from "MAC_ADDRESS_STR),
494 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
495 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 }
497 if (!pAssocReq->supportedChannelsPresent)
498 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530499 limLog(pMac, LOGW, FL("LIM Info: Missing Supported channel "
500 "IE in %s Req from "MAC_ADDRESS_STR),
501 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
502 MAC_ADDR_ARRAY(pHdr->sa));
503
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 }
506 else
507 {
508 /* Assoc request has mandatory fields */
509 status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry);
510 if (eSIR_SUCCESS != status)
511 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530512 limLog(pMac, LOGW, FL("LIM Info: MinTxPower(STA) > "
513 "MaxTxPower(AP) in %s Req 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 status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq);
519 if (eSIR_SUCCESS != status)
520 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530521 limLog(pMac, LOGW, FL("LIM Info: wrong supported "
522 "channels (STA) in %s Req from "MAC_ADDRESS_STR),
523 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
524 MAC_ADDR_ARRAY(pHdr->sa));
525
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 }
527 /* IEs are valid, use them if needed */
528 }
529 } //if(assoc.capabilityInfo.spectrumMgt)
530 else
531 {
532 /* As per the capabiities, the spectrum management is not enabled on the station
533 * The AP may allow the associations to happen even if spectrum management is not
534 * allowed, if the transmit power of station is below the regulatory maximum
535 */
536
537 /* TODO: presently, this is not handled. In the current implemetation, the AP would
538 * allow the station to associate even if it doesn't support spectrum management.
539 */
540 }
541 }// end of spectrum management related processing
542
543 if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
544 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530545 limLog(pMac, LOGE, FL("received %s req with unsupported"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530546 "MCS Rate Set from "MAC_ADDRESS_STR),
547 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
548 MAC_ADDR_ARRAY(pHdr->sa));
549
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 /**
551 * Requesting STA does not support ALL BSS MCS basic Rate set rates.
552 * Spec does not define any status code for this scenario.
553 */
554 limSendAssocRspMgmtFrame(
555 pMac,
556 eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS,
557 1,
558 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530559 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700560
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 goto error;
562 }
563
564 //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G)
565 if (phyMode == WNI_CFG_PHY_MODE_11G)
566 {
567
568 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS)
569 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700570 limLog(pMac, LOGP, FL("could not retrieve 11g-only flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 goto error;
572 }
573
574 if (!pAssocReq->extendedRatesPresent && val)
575 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530576 limLog(pMac, LOGE, FL("Rejecting Re/Assoc req from 11b STA: "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530577 MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 /**
579 * Received Re/Association Request from
580 * 11b STA when 11g only policy option
581 * is set.
582 * Reject with unspecified status code.
583 */
584 limSendAssocRspMgmtFrame(
585 pMac,
586 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
587 1,
588 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530589 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590
Jeff Johnson295189b2012-06-20 16:38:30 -0700591
592#ifdef WLAN_DEBUG
593 pMac->lim.gLim11bStaAssocRejectCount++;
594#endif
595 goto error;
596 }
597 }
598
599#ifdef WMM_APSD
600 // Save the QOS info element in assoc request..
601 limGetWmeMode(pMac, &wmeMode);
602 if (wmeMode == eHAL_SET)
603 {
604 tpQosInfoSta qInfo;
605
606 qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo);
607
608 if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi))
609 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530610 limLog(pMac, LOGW,
611 FL("Rejecting Re/Assoc req from STA: "MAC_ADDRESS_STR),
612 MAC_ADDR_ARRAY(pHdr->sa));
613 limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x"), *qInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700614
615 /**
616 * Received Re/Association Request from
617 * 11b STA when 11g only policy option
618 * is set.
619 * Reject with unspecified status code.
620 */
621 limSendAssocRspMgmtFrame(
622 pMac,
623 eSIR_MAC_WME_REFUSED_STATUS,
624 1,
625 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530626 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700627
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 goto error;
629 }
630 }
631#endif
632
633 // Check for 802.11n HT caps compatibility; are HT Capabilities
634 // turned on in lim?
Jeff Johnsone7245742012-09-05 17:12:55 -0700635 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 {
637 // There are; are they turned on in the STA?
638 if ( pAssocReq->HTCaps.present )
639 {
640 // The station *does* support 802.11n HT capability...
641
642 limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d "
643 "PowerSave:%d greenField:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700644 "shortGI20:%d shortGI40:%d"
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 "txSTBC:%d rxSTBC:%d delayBA:%d"
646 "maxAMSDUsize:%d DSSS/CCK:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700647 "PSMP:%d stbcCntl:%d lsigTXProt:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 pAssocReq->HTCaps.advCodingCap,
649 pAssocReq->HTCaps.supportedChannelWidthSet,
650 pAssocReq->HTCaps.mimoPowerSave,
651 pAssocReq->HTCaps.greenField,
652 pAssocReq->HTCaps.shortGI20MHz,
653 pAssocReq->HTCaps.shortGI40MHz,
654 pAssocReq->HTCaps.txSTBC,
655 pAssocReq->HTCaps.rxSTBC,
656 pAssocReq->HTCaps.delayedBA,
657 pAssocReq->HTCaps.maximalAMSDUsize,
658 pAssocReq->HTCaps.dsssCckMode40MHz,
659 pAssocReq->HTCaps.psmp,
660 pAssocReq->HTCaps.stbcControlFrame,
661 pAssocReq->HTCaps.lsigTXOPProtection );
662
663 // Make sure the STA's caps are compatible with our own:
664 //11.15.2 Support of DSSS/CCK in 40 MHz
665 //the AP shall refuse association requests from an HT STA that has the DSSS/CCK
666 //Mode in 40 MHz subfield set to 1;
667
668 //FIXME_BTAMP_AP : Need to be enabled
669 /*
670 if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz )
671 {
672 statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS;
673 limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700674 "STA rejected." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 // Reject association
676 limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry);
677 goto error;
678 }
679 */
680 }
681 } // End if on HT caps turned on in lim.
682
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 /* 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 +0530684 vos_mem_set((tANI_U8*)&Dot11fIERSN, sizeof( Dot11fIERSN ), 0);
685 vos_mem_set((tANI_U8*)&Dot11fIEWPA, sizeof( Dot11fIEWPA ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700686
687 /* if additional IE is present, check if it has WscIE */
688 if( pAssocReq->addIEPresent && pAssocReq->addIE.length )
689 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
690 /* when wpsIe is present, RSN/WPA IE is ignored */
691 if( wpsIe == NULL )
692 {
693 /** check whether as RSN IE is present */
694 if(psessionEntry->limSystemRole == eLIM_AP_ROLE
695 && psessionEntry->pLimStartBssReq->privacy
696 && psessionEntry->pLimStartBssReq->rsnIE.length)
697 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530698 limLog(pMac, LOG1,
Kiet Lam82004c62013-11-11 13:24:28 +0530699 FL("RSN enabled auth, Re/Assoc req from STA: "MAC_ADDRESS_STR),
700 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 if(pAssocReq->rsnPresent)
702 {
703 if(pAssocReq->rsn.length)
704 {
705 // Unpack the RSN IE
Kapil Gupta083f3912017-06-06 12:05:22 +0530706 if (dot11fUnpackIeRSN(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -0700707 &pAssocReq->rsn.info[0],
708 pAssocReq->rsn.length,
Kapil Gupta083f3912017-06-06 12:05:22 +0530709 &Dot11fIERSN) != DOT11F_PARSE_SUCCESS)
710 {
711 limLog(pMac, LOGE,
712 FL("Invalid RSNIE received"));
713 limSendAssocRspMgmtFrame(pMac,
714 eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530715 1, pHdr->sa, subType, 0,psessionEntry, NULL);
Kapil Gupta083f3912017-06-06 12:05:22 +0530716 goto error;
717 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700718
719 /* Check RSN version is supported or not */
720 if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version)
721 {
722 /* check the groupwise and pairwise cipher suites */
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700723 if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry,
724 pAssocReq->HTCaps.present, &pmfConnection)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530726 limLog(pMac, LOGE, FL("RSN Mismatch. Rejecting Re/Assoc req from "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530727 "STA: "MAC_ADDRESS_STR),
728 MAC_ADDR_ARRAY(pHdr->sa));
729
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 /* some IE is not properly sent */
731 /* received Association req frame with RSN IE but length is 0 */
732 limSendAssocRspMgmtFrame(
733 pMac,
734 status,
735 1,
736 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530737 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700738
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 goto error;
740
741 }
742 }
743 else
744 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530745 limLog(pMac, LOGE, FL("RSN Version mismatch. "
746 "Rejecting Re/Assoc req from "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530747 "STA: "MAC_ADDRESS_STR),
748 MAC_ADDR_ARRAY(pHdr->sa));
749
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 /* received Association req frame with RSN IE version wrong */
751 limSendAssocRspMgmtFrame(
752 pMac,
753 eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS,
754 1,
755 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530756 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 goto error;
758
759 }
760 }
761 else
762 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530763 limLog(pMac, LOGW, FL("RSN length not correct. "
764 "Rejecting Re/Assoc req from STA:"
765 MAC_ADDRESS_STR),
766 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 /* received Association req frame with RSN IE but length is 0 */
768 limSendAssocRspMgmtFrame(
769 pMac,
770 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
771 1,
772 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530773 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700774
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 goto error;
776
777 }
778 } /* end - if(pAssocReq->rsnPresent) */
779 if((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent)
780 {
781 // Unpack the WPA IE
782 if(pAssocReq->wpa.length)
783 {
Kapil Gupta083f3912017-06-06 12:05:22 +0530784 if (dot11fUnpackIeWPA(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 &pAssocReq->wpa.info[4], //OUI is not taken care
Pragaspathi Thilagarajdecc73b2019-03-26 19:48:41 +0530786 (pAssocReq->wpa.length - 4),
Kapil Gupta083f3912017-06-06 12:05:22 +0530787 &Dot11fIEWPA) != DOT11F_PARSE_SUCCESS)
788 {
789 limLog(pMac, LOGE, FL("Invalid WPA IE"));
790 limSendAssocRspMgmtFrame(pMac,
791 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530792 1, pHdr->sa, subType, 0,psessionEntry, NULL);
Kapil Gupta083f3912017-06-06 12:05:22 +0530793 goto error;
794 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 /* check the groupwise and pairwise cipher suites */
796 if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present)))
797 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530798 limLog(pMac, LOGW, FL("WPA IE mismatch. "
799 "Rejecting Re/Assoc req from "
800 "STA: "MAC_ADDRESS_STR),
801 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 /* received Association req frame with WPA IE but mismatch */
803 limSendAssocRspMgmtFrame(
804 pMac,
805 status,
806 1,
807 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530808 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 goto error;
810
811 }
812 }
813 else
814 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530815 limLog(pMac, LOGW, FL("WPA len incorrect. "
816 "Rejecting Re/Assoc req from STA: "
817 MAC_ADDRESS_STR),
818 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 /* received Association req frame with invalid WPA IE */
820 limSendAssocRspMgmtFrame(
821 pMac,
822 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
823 1,
824 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530825 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700826
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 goto error;
828 }/* end - if(pAssocReq->wpa.length) */
829 } /* end - if(pAssocReq->wpaPresent) */
830 } /* end of if(psessionEntry->pLimStartBssReq->privacy
831 && psessionEntry->pLimStartBssReq->rsnIE->length) */
832
833 } /* end of if( ! pAssocReq->wscInfo.present ) */
Jeff Johnson295189b2012-06-20 16:38:30 -0700834
835 /**
836 * Extract 'associated' context for STA, if any.
837 * This is maintained by DPH and created by LIM.
838 */
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800839 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700840
841 /// Extract pre-auth context for the STA, if any.
842 pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa);
843
844 if (pStaDs == NULL)
845 {
846 /// Requesting STA is not currently associated
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800847 if (peGetCurrentSTAsCount(pMac) == pMac->lim.maxStation)
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 {
849 /**
850 * Maximum number of STAs that AP can handle reached.
851 * Send Association response to peer MAC entity
852 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530853 limLog(pMac, LOGE, FL("Max Sta count reached : %d"),
854 pMac->lim.maxStation);
Jeff Johnson295189b2012-06-20 16:38:30 -0700855 limRejectAssociation(pMac, pHdr->sa,
856 subType, false,
857 (tAniAuthType) 0, 0,
858 false,
859 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
860
861 goto error;
862 }
863
864 /// Check if STA is pre-authenticated.
865 if ((pStaPreAuthContext == NULL) ||
866 (pStaPreAuthContext &&
867 (pStaPreAuthContext->mlmState !=
868 eLIM_MLM_AUTHENTICATED_STATE)))
869 {
870 /**
871 * STA is not pre-authenticated yet requesting
872 * Re/Association before Authentication.
873 * OR STA is in the process of getting authenticated
874 * and sent Re/Association request.
875 * Send Deauthentication frame with 'prior
876 * authentication required' reason code.
877 */
878 limSendDeauthMgmtFrame(
879 pMac,
880 eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800881 pHdr->sa, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700882
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530883 limLog(pMac, LOGE, FL("received %s req on sessionid: %d from STA "
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530884 "that does not have pre-auth context"MAC_ADDRESS_STR),
885 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
886 psessionEntry->peSessionId,
887 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 goto error;
889 }
890
891 /// Delete 'pre-auth' context of STA
892 authType = pStaPreAuthContext->authType;
gaurank kathpalia66414892018-03-21 20:24:39 +0530893
894 /// Store the previous auth frame's seq no
895 prevAuthSeqno = pStaPreAuthContext->seqNo;
896
897
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 limDeletePreAuthNode(pMac, pHdr->sa);
899
900 // All is well. Assign AID (after else part)
901
902 } // if (pStaDs == NULL)
903 else
904 {
905 // STA context does exist for this STA
906
907 if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
908 {
909 /**
910 * Requesting STA is in some 'transient' state?
911 * Ignore the Re/Assoc Req frame by incrementing
912 * debug counter & logging error.
913 */
914 if (subType == LIM_ASSOC)
915 {
916
917#ifdef WLAN_DEBUG
918 pMac->lim.gLimNumAssocReqDropInvldState++;
919#endif
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530920 limLog(pMac, LOGE, FL("received Assoc req in state "
Sushant Kaushik1b645382014-10-13 16:39:36 +0530921 "%d from "), pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 }
923 else
924 {
925#ifdef WLAN_DEBUG
926 pMac->lim.gLimNumReassocReqDropInvldState++;
927#endif
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530928 limLog(pMac, LOGE, FL("received ReAssoc req in state %d"
Abhishek Singh5170f9c2013-12-18 16:55:22 +0530929 " from "), pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 }
931 limPrintMacAddr(pMac, pHdr->sa, LOG1);
932 limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -0700933
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 goto error;
935 } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
936
Chet Lanctot8cecea22014-02-11 19:09:36 -0800937 /* STA sent association Request frame while already in
938 * 'associated' state */
939
940#ifdef WLAN_FEATURE_11W
941 limLog(pMac, LOG1, FL("Re/Assoc request from station that is already associated"));
942 limLog(pMac, LOG1, FL("PMF enabled %d, SA Query state %d"), pStaDs->rmfEnabled,
943 pStaDs->pmfSaQueryState);
944 if (pStaDs->rmfEnabled)
945 {
946 switch (pStaDs->pmfSaQueryState)
947 {
948
949 // start SA Query procedure, respond to Association Request
950 // with try again later
951 case DPH_SA_QUERY_NOT_IN_PROGRESS:
Abhishek Singh65d66352014-07-15 23:14:38 +0530952 /*
953 * We should reset the retry counter before we start
954 * the SA query procedure, otherwise in next set of SA query
955 * procedure we will end up using the stale value.
956 */
957 pStaDs->pmfSaQueryRetryCount = 0;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800958 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530959 pHdr->sa, subType, pStaDs,
960 psessionEntry, NULL);
Chet Lanctot8cecea22014-02-11 19:09:36 -0800961 limSendSaQueryRequestFrame(
962 pMac, (tANI_U8 *)&(pStaDs->pmfSaQueryCurrentTransId),
963 pHdr->sa, psessionEntry);
964 pStaDs->pmfSaQueryStartTransId = pStaDs->pmfSaQueryCurrentTransId;
965 pStaDs->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800966
967 // start timer for SA Query retry
968 if (tx_timer_activate(&pStaDs->pmfSaQueryTimer) != TX_SUCCESS)
969 {
970 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
971 goto error;
972 }
973
974 pStaDs->pmfSaQueryState = DPH_SA_QUERY_IN_PROGRESS;
975 goto error;
976
977 // SA Query procedure still going, respond to Association
978 // Request with try again later
979 case DPH_SA_QUERY_IN_PROGRESS:
980 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_TRY_AGAIN_LATER, 1,
Kapil Gupta956c0c42017-06-16 19:24:31 +0530981 pHdr->sa, subType, 0, psessionEntry,
982 NULL);
Chet Lanctot8cecea22014-02-11 19:09:36 -0800983 goto error;
984
985 // SA Query procedure timed out, accept Association Request
986 // normally
987 case DPH_SA_QUERY_TIMED_OUT:
988 pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
989 break;
990 }
991 }
992#endif
993
994 /* no change in the capability so drop the frame */
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +0530995 if ((VOS_TRUE == vos_mem_compare(&pStaDs->mlmStaContext.capabilityInfo,
996 &pAssocReq->capabilityInfo,
997 sizeof(tSirMacCapabilityInfo)))&&
998 (subType == LIM_ASSOC))
999 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05301000 limLog(pMac, LOGE, FL(" Received Assoc req in state %d STAid=%d"),
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +05301001 pStaDs->mlmStaContext.mlmState,peerIdx);
1002 goto error;
1003 }
1004 else
1005 {
1006 /**
1007 * STA sent Re/association Request frame while already in
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 * 'associated' state. Update STA capabilities and
1009 * send Association response frame with same AID
1010 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301011 limLog(pMac, LOG1, FL("Received Assoc req from STA already connected"
1012 " UpdateConext"));
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +05301013 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1014 if (pStaPreAuthContext &&
1015 (pStaPreAuthContext->mlmState ==
1016 eLIM_MLM_AUTHENTICATED_STATE))
1017 {
1018 /// STA has triggered pre-auth again
1019 authType = pStaPreAuthContext->authType;
1020 limDeletePreAuthNode(pMac, pHdr->sa);
1021 }
1022 else
1023 authType = pStaDs->mlmStaContext.authType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001024
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +05301025 updateContext = true;
1026 if (dphInitStaState(pMac, pHdr->sa, peerIdx, true, &psessionEntry->dph.dphHashTable)
1027 == NULL)
1028 {
1029 limLog(pMac, LOGE, FL("could not Init STAid=%d"), peerIdx);
1030 goto error;
1031 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001032 }
Madan Mohan Koyyalamudi99027202013-08-05 22:14:24 +05301033 goto sendIndToSme;
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 } // end if (lookup for STA in perStaDs fails)
1035
1036
1037
1038 // check if sta is allowed per QoS AC rules
1039 //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled)
1040 limGetWmeMode(psessionEntry, &wmeMode);
1041 if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET))
1042 {
1043 // for a qsta, check if the requested Traffic spec
1044 // is admissible
1045 // for a non-qsta check if the sta can be admitted
1046 if (pAssocReq->addtsPresent)
1047 {
1048 tANI_U8 tspecIdx = 0; //index in the sch tspec table.
1049 if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
1050 &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
1051 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301052 limLog(pMac, LOGE, FL("AdmitControl: TSPEC rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001053 limSendAssocRspMgmtFrame(
1054 pMac,
1055 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
1056 1,
1057 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +05301058 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07001059#ifdef WLAN_DEBUG
1060 pMac->lim.gLimNumAssocReqDropACRejectTS++;
1061#endif
1062 goto error;
1063 }
1064 }
1065 else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
1066 != eSIR_SUCCESS)
1067 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301068 limLog(pMac, LOGE, FL("AdmitControl: Sta rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 limSendAssocRspMgmtFrame(
1070 pMac,
1071 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
1072 1,
1073 pHdr->sa,
Kapil Gupta956c0c42017-06-16 19:24:31 +05301074 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07001075#ifdef WLAN_DEBUG
1076 pMac->lim.gLimNumAssocReqDropACRejectSta++;
1077#endif
1078 goto error;
1079 }
1080
1081 // else all ok
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001082 limLog(pMac, LOG1, FL("AdmitControl: Sta OK!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 }
1084
1085 /**
1086 * STA is Associated !
1087 */
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301088 limLog(pMac, LOGE, FL("Received %s Req successful from "MAC_ADDRESS_STR),
1089 (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001090
1091 /**
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001092 * AID for this association will be same as the peer Index used in DPH table.
1093 * Assign unused/least recently used peer Index from perStaDs.
1094 * NOTE: limAssignPeerIdx() assigns AID values ranging
1095 * between 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT)
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 */
1097
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001098 peerIdx = limAssignPeerIdx(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001099
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001100 if (!peerIdx)
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 {
1102 // Could not assign AID
1103 // Reject association
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301104 limLog(pMac, LOGE, FL("PeerIdx not avaialble. Reject associaton"));
1105
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 limRejectAssociation(pMac, pHdr->sa,
1107 subType, true, authType,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001108 peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1110
1111 goto error;
1112 }
1113
1114 /**
1115 * Add an entry to hash table maintained by DPH module
1116 */
1117
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001118 pStaDs = dphAddHashEntry(pMac, pHdr->sa, peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001119
1120 if (pStaDs == NULL)
1121 {
1122 // Could not add hash table entry at DPH
1123 limLog(pMac, LOGE,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301124 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
1125 MAC_ADDRESS_STR),
1126 peerIdx,MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001127
1128 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001129 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001130
1131 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001132 subType, true, authType, peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1134
1135 goto error;
1136 }
1137
gaurank kathpalia66414892018-03-21 20:24:39 +05301138 /// Store the previous auth frame's seq no
1139 if (prevAuthSeqno != 0xFFFF)
1140 {
1141 pStaDs->PrevAuthSeqno = prevAuthSeqno;
1142 }
1143 /// Store the current assoc seq no
1144 pStaDs->PrevAssocSeqno = ((pHdr->seqControl.seqNumHi << 4) |
1145 (pHdr->seqControl.seqNumLo));
1146 limLog(pMac, LOG1, FL("Prev auth seq no %d Prev Assoc seq no. %d"),
1147 pStaDs->PrevAuthSeqno, pStaDs->PrevAssocSeqno);
Jeff Johnson295189b2012-06-20 16:38:30 -07001148
1149sendIndToSme:
1150
1151 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1152
1153 pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
Jeff Johnsone7245742012-09-05 17:12:55 -07001154#ifdef WLAN_FEATURE_11AC
1155 pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
1156#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001157 pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
1158 pStaDs->qos.addts = pAssocReq->addtsReq;
1159 pStaDs->qos.capability = pAssocReq->qosCapability;
1160 pStaDs->versionPresent = 0;
1161 /* short slot and short preamble should be updated before doing limaddsta */
1162 pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble;
1163 pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime;
1164
1165 if (pAssocReq->propIEinfo.versionPresent) //update STA version info
1166 {
1167 pStaDs->versionPresent = 1;
1168 pStaDs->version = pAssocReq->propIEinfo.version;
1169 }
1170 pStaDs->propCapability = 0;
1171 if (pAssocReq->propIEinfo.capabilityPresent)
1172 {
1173 if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability))
1174 pStaDs->propCapability &= pAssocReq->propIEinfo.capability;
1175 }
1176
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 pStaDs->valid = 0;
1178 pStaDs->mlmStaContext.authType = authType;
1179 pStaDs->staType = STA_ENTRY_PEER;
1180
1181 //TODO: If listen interval is more than certain limit, reject the association.
1182 //Need to check customer requirements and then implement.
1183 pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval;
1184 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1185
1186 /* The following count will be used to knock-off the station if it doesn't
1187 * come back to receive the buffered data. The AP will wait for numTimSent number
1188 * of beacons after sending TIM information for the station, before assuming that
1189 * the station is no more associated and disassociates it
1190 */
1191
1192 /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
1193 pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval);
1194
1195 /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */
1196 pStaDs->curTxMpduCnt = 0;
1197
1198 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
1199 (pAssocReq->HTCaps.present))
1200 {
1201 pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField;
1202 pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity;
1203 pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz;
1204 pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection;
1205 pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
1206 pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
1207 pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
Krishna Kumaar Natarajan58ec70d2015-07-28 16:16:29 +05301208
1209 /* pAssocReq will be copied to psessionEntry->parsedAssocReq later */
1210 /* check whether AP is enabled with shortGI */
1211 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val) !=
1212 eSIR_SUCCESS) {
1213 limLog(pMac, LOGE,
1214 FL("could not retrieve shortGI 20Mhz CFG"));
1215 goto error;
1216 }
1217 if (val) {
1218 pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
1219 } else {
1220 /* Unset htShortGI20Mhz in ht_caps*/
1221 pAssocReq->HTCaps.shortGI20MHz = 0;
1222 pStaDs->htShortGI20Mhz = 0;
1223 }
1224
1225 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val) !=
1226 eSIR_SUCCESS) {
1227 limLog(pMac, LOGE,
1228 FL("could not retrieve shortGI 40Mhz CFG"));
1229 goto error;
1230 }
1231 if (val) {
1232 pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
1233 } else {
1234 /* Unset htShortGI40Mhz in ht_caps */
1235 pAssocReq->HTCaps.shortGI40MHz = 0;
1236 pStaDs->htShortGI40Mhz = 0;
1237 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07001239 /* 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
1240 * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
1241 */
1242 pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
1243#ifdef WLAN_FEATURE_11AC
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07001244 if(pAssocReq->operMode.present)
1245 {
1246 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pAssocReq->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
1247 pStaDs->htSupportedChannelWidthSet = (tANI_U8)(pAssocReq->operMode.chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
1248 }
1249 else if (pAssocReq->VHTCaps.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07001250 {
Madan Mohan Koyyalamudi740f7802012-09-24 14:17:14 -07001251 // Check if STA has enabled it's channel bonding mode.
1252 // If channel bonding mode is enabled, we decide based on SAP's current configuration.
1253 // else, we set it to VHT20.
1254 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pStaDs->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ?
1255 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
1256 psessionEntry->vhtTxChannelWidthSet );
Jeff Johnsone7245742012-09-05 17:12:55 -07001257 }
Madan Mohan Koyyalamudicc394402012-10-05 10:48:19 -07001258
1259 // Lesser among the AP and STA bandwidth of operation.
1260 pStaDs->htSupportedChannelWidthSet =
1261 (pStaDs->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1262 pStaDs->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1263
Jeff Johnsone7245742012-09-05 17:12:55 -07001264#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001265 pStaDs->baPolicyFlag = 0xFF;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001266 pStaDs->htLdpcCapable = (tANI_U8)pAssocReq->HTCaps.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -07001267 }
1268
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001269 if(pAssocReq->VHTCaps.present)
1270 {
1271 pStaDs->vhtLdpcCapable = (tANI_U8)pAssocReq->VHTCaps.ldpcCodingCap;
1272 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001273
Jeff Johnsone7245742012-09-05 17:12:55 -07001274#ifdef WLAN_FEATURE_11AC
1275if (limPopulateMatchingRateSet(pMac,
1276 pStaDs,
1277 &(pAssocReq->supportedRates),
1278 &(pAssocReq->extendedRates),
1279 pAssocReq->HTCaps.supportedMCSSet,
1280 &(pAssocReq->propIEinfo.propRates),
1281 psessionEntry , &pAssocReq->VHTCaps)
1282 != eSIR_SUCCESS)
1283#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001284
1285 if (limPopulateMatchingRateSet(pMac,
1286 pStaDs,
1287 &(pAssocReq->supportedRates),
1288 &(pAssocReq->extendedRates),
1289 pAssocReq->HTCaps.supportedMCSSet,
1290 &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -07001291#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 {
1293 // Could not update hash table entry at DPH with rateset
1294 limLog(pMac, LOGE,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301295 FL("could not update hash entry at DPH for aid=%d, MacAddr: "
1296 MAC_ADDRESS_STR),
1297 peerIdx, MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -07001298
1299 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001300 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001301
1302
1303 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001304 subType, true, authType, peerIdx, true,
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1306
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001307 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1308 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 }
1310
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301311 vos_mem_copy((tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
1312 (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 pAssocReq->propIEinfo.propRates.numPropRates + 1);
1314
1315 /// Add STA context at MAC HW (BMU, RHP & TFP)
1316
1317 pStaDs->qosMode = eANI_BOOLEAN_FALSE;
1318 pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
1319 if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
1320 {
1321 pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
1322 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1323 }
1324
1325 pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
1326 pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
1327 limGetWmeMode(psessionEntry, &wmeMode);
1328 //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
1329 if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
1330 {
1331 pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
1332 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1333 limGetWsmMode(psessionEntry, &wsmMode);
1334 /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
1335 can coexist */
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 if( pAssocReq->WMMInfoStation.present)
1337 {
1338 /* check whether AP supports or not */
1339 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
1340 && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
1341 || pAssocReq->WMMInfoStation.acbk_uapsd
1342 || pAssocReq->WMMInfoStation.acvo_uapsd
1343 || pAssocReq->WMMInfoStation.acvi_uapsd))
1344 {
1345
1346 /**
1347 * Received Re/Association Request from
1348 * STA when UPASD is not supported.
1349 */
Deepthi Gowricabd4d12014-11-13 12:51:16 +05301350 limLog( pMac, LOGE, FL( "AP do not support UAPSD so reply "
1351 "to STA accordingly" ));
1352 /* update UAPSD and send it to LIM to add STA */
1353 pStaDs->qos.capability.qosInfo.acbe_uapsd = 0;
1354 pStaDs->qos.capability.qosInfo.acbk_uapsd = 0;
1355 pStaDs->qos.capability.qosInfo.acvo_uapsd = 0;
1356 pStaDs->qos.capability.qosInfo.acvi_uapsd = 0;
1357 pStaDs->qos.capability.qosInfo.maxSpLen = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 }
1360 else
1361 {
1362 /* update UAPSD and send it to LIM to add STA */
1363 pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
1364 pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
1365 pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
1366 pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
1367 pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
1368 }
1369 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
1371 if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
1372 pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
1373
1374 }
1375
1376 // Re/Assoc Response frame to requesting STA
1377 pStaDs->mlmStaContext.subType = subType;
1378
1379 if (pAssocReq->propIEinfo.aniIndicator)
1380 pStaDs->aniPeer = 1;
1381
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001382#ifdef WLAN_FEATURE_11W
1383 pStaDs->rmfEnabled = (pmfConnection) ? 1 : 0;
Chet Lanctot8cecea22014-02-11 19:09:36 -08001384 pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
1385 timerId.fields.sessionId = psessionEntry->peSessionId;
1386 timerId.fields.peerIdx = peerIdx;
1387 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL,
1388 &retryInterval) != eSIR_SUCCESS)
1389 {
1390 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query retry interval value"));
1391 limRejectAssociation(pMac, pHdr->sa,
1392 subType, true, authType,
1393 peerIdx, false,
1394 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1395 goto error;
1396 }
Satyanarayana Dash6f438272015-03-03 18:01:06 +05301397 if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN > retryInterval)
Abhishek Singhbf9f7d82014-09-25 16:24:59 +05301398 {
Satyanarayana Dash6f438272015-03-03 18:01:06 +05301399 retryInterval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF;
Abhishek Singhbf9f7d82014-09-25 16:24:59 +05301400 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08001401 if (tx_timer_create(&pStaDs->pmfSaQueryTimer, "PMF SA Query timer",
1402 limPmfSaQueryTimerHandler, timerId.value,
1403 SYS_MS_TO_TICKS((retryInterval * 1024) / 1000),
1404 0, TX_NO_ACTIVATE) != TX_SUCCESS)
1405 {
1406 limLog(pMac, LOGE, FL("could not create PMF SA Query timer"));
1407 limRejectAssociation(pMac, pHdr->sa,
1408 subType, true, authType,
1409 peerIdx, false,
1410 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1411 goto error;
1412 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001413#endif
1414
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 // BTAMP: Storing the parsed assoc request in the psessionEntry array
1416 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1417
1418 /* BTAMP: If STA context already exist (ie. updateContext = 1)
1419 * for this STA, then we should delete the old one, and add
1420 * the new STA. This is taken care of in the limDelSta() routine.
1421 *
1422 * Prior to BTAMP, we were setting this flag so that when
1423 * PE receives SME_ASSOC_CNF, and if this flag is set, then
1424 * PE shall delete the old station and then add. But now in
1425 * BTAMP, we're directly adding station before waiting for
1426 * SME_ASSOC_CNF, so we can do this now.
1427 */
1428 if (!updateContext)
1429 {
1430 pStaDs->mlmStaContext.updateContext = 0;
1431
1432 // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001433 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301435 limLog(pMac, LOGE, FL("could not Add STA with assocId=%d"),
1436 pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001437 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
1438 true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
1439 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1440
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001441 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1442 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001443 }
1444 }
1445 else
1446 {
1447 pStaDs->mlmStaContext.updateContext = 1;
1448
Jeff Johnson295189b2012-06-20 16:38:30 -07001449 mlmPrevState = pStaDs->mlmStaContext.mlmState;
1450
1451 /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
1452 if(subType != LIM_REASSOC)
1453 {
1454 //we need to set the mlmState here in order differentiate in limDelSta.
1455 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
1456 if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
1457 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301458 limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d"),
1459 pStaDs->assocId, pStaDs->staIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1461 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1462
1463 //Restoring the state back.
1464 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001465 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 goto error;
1467 }
1468 }
1469 else
1470 {
1471 /* mlmState is changed in limAddSta context */
1472 /* use the same AID, already allocated */
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001473 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001474 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301475 limLog(pMac, LOGE, FL( "Could not AddSta with assocId= %d staId %d"),
1476 pStaDs->assocId, pStaDs->staIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001477 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1478 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1479
1480 //Restoring the state back.
1481 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001482 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 goto error;
1484 }
1485
1486 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001487
1488 }
1489
1490 return;
1491
1492error:
1493 if (pAssocReq != NULL)
1494 {
1495 if ( pAssocReq->assocReqFrame )
1496 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301497 vos_mem_free(pAssocReq->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 pAssocReq->assocReqFrame = NULL;
1499 }
1500
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301501 vos_mem_free(pAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 }
1503
Jeff Johnsone7245742012-09-05 17:12:55 -07001504 /* If it is not duplicate Assoc request then only make to Null */
1505 if ((pStaDs != NULL) &&
1506 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001507 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001508
Jeff Johnson295189b2012-06-20 16:38:30 -07001509 return;
1510
1511} /*** end limProcessAssocReqFrame() ***/
1512
1513
1514
1515/**---------------------------------------------------------------
1516\fn limSendMlmAssocInd
1517\brief This function sends either LIM_MLM_ASSOC_IND
1518\ or LIM_MLM_REASSOC_IND to SME.
1519\
1520\param pMac
1521\param *pStaDs - Station DPH hash entry
1522\param psessionEntry - PE session entry
1523\return None
1524
1525 * ?????? How do I get
1526 * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
1527 * - aid =====> pStaDs->assocId
1528 * - pHdr->sa =====> pStaDs->staAddr
1529 * - authType
1530 * - pHdr->seqControl =====> no longer needed
1531 * - pStaDs
1532------------------------------------------------------------------*/
1533void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1534{
1535 tpLimMlmAssocInd pMlmAssocInd = NULL;
1536 tpLimMlmReassocInd pMlmReassocInd;
1537 tpSirAssocReq pAssocReq;
1538 tANI_U16 temp;
1539 tANI_U32 phyMode;
1540 tANI_U8 subType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001541 tANI_U8 *wpsIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001542 tANI_U32 tmp;
1543// tANI_U16 statusCode;
1544 tANI_U16 i, j=0;
1545
1546 // Get a copy of the already parsed Assoc Request
1547 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
1548
1549 // Get the phyMode
1550 limGetPhyMode(pMac, &phyMode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001551 // Extract pre-auth context for the peer BTAMP-STA, if any.
1552
1553 // Determiine if its Assoc or ReAssoc Request
1554 if (pAssocReq->reassocRequest == 1)
1555 subType = LIM_REASSOC;
1556 else
1557 subType = LIM_ASSOC;
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301558
1559 limLog(pMac, LOG1, FL("Sessionid %d ssid %s subtype %d Associd %d staAddr "
1560 MAC_ADDRESS_STR), psessionEntry->peSessionId, pAssocReq->ssId.ssId,
1561 subType,pStaDs->assocId,MAC_ADDR_ARRAY(pStaDs->staAddr));
1562
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 if (subType == LIM_ASSOC || subType == LIM_REASSOC)
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 {
1565 temp = sizeof(tLimMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001566
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301567 pMlmAssocInd = vos_mem_malloc(temp);
1568 if (NULL == pMlmAssocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001570 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301571 limLog(pMac, LOGP, FL("AllocateMemory failed for pMlmAssocInd"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 return;
1573 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301574 vos_mem_set(pMlmAssocInd, temp ,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001575
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301576 vos_mem_copy((tANI_U8 *)pMlmAssocInd->peerMacAddr,
1577 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001578
1579 pMlmAssocInd->aid = pStaDs->assocId;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301580 vos_mem_copy((tANI_U8 *)&pMlmAssocInd->ssId,
1581 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 pMlmAssocInd->sessionId = psessionEntry->peSessionId;
1583 pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
1584
Jeff Johnson295189b2012-06-20 16:38:30 -07001585 pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
1586
1587 // Fill in RSN IE information
1588 pMlmAssocInd->rsnIE.length = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 // if WPS IE is present, ignore RSN IE
1590 if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
1591 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1592 }
1593 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001594 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301595 limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d"),
1596 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001597 pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1598 pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1599 pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301600 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[2],
1601 pAssocReq->rsn.info,
1602 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 }
1604
Jeff Johnson295189b2012-06-20 16:38:30 -07001605 // Fill in 802.11h related info
1606 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1607 {
1608 pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
1609 pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1610 pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1611 limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
1612 }
1613 else
1614 pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
1615
1616
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 /* This check is to avoid extra Sec IEs present incase of WPS */
1618 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 {
1620 if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
1621 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301622 PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d"),
1623 pMlmAssocInd->rsnIE.length);)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301624 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 return;
1626 }
1627 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1628 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301629 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
1630 pAssocReq->wpa.info,
1631 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1633 }
1634
1635
1636 pMlmAssocInd->addIE.length = 0;
1637 if (pAssocReq->addIEPresent)
1638 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301639 vos_mem_copy(&pMlmAssocInd->addIE.addIEdata,
1640 pAssocReq->addIE.addIEdata,
1641 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001642
1643 pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
1644 }
1645
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 if(pAssocReq->wmeInfoPresent)
1647 {
1648
1649 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301650 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"),
1651 WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
1653 /* check whether AP is enabled with WMM */
1654 if(tmp)
1655 {
1656 pMlmAssocInd->WmmStaInfoPresent = 1;
1657 }
1658 else
1659 {
1660 pMlmAssocInd->WmmStaInfoPresent= 0;
1661 }
1662 /* Note: we are not rejecting association here because IOT will fail */
1663
1664 }
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301665#ifdef WLAN_FEATURE_AP_HT40_24G
1666 if(pAssocReq->HTCaps.present)
1667 {
1668 limLog(pMac, LOGW, FL("HT40MHzInto: %d"),
1669 pAssocReq->HTCaps.stbcControlFrame);
1670 pMlmAssocInd->HT40MHzIntoPresent =
1671 pAssocReq->HTCaps.stbcControlFrame;
1672 }
1673#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001674
1675 // Required for indicating the frames to upper layer
1676 pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1677 pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
1678
1679 pMlmAssocInd->beaconPtr = psessionEntry->beacon;
1680 pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
1681
Hanumanth Reddy Pothula57323632017-12-06 17:55:09 +05301682 pMlmAssocInd->chan_info.chan_id = psessionEntry->currentOperChannel;
1683
1684 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ) {
1685 if (psessionEntry->vhtCapability && pAssocReq->VHTCaps.present) {
1686 pMlmAssocInd->chan_info.info = MODE_11AC_VHT20_2G;
1687 pMlmAssocInd->VHTCaps = pAssocReq->VHTCaps;
1688 } else if (psessionEntry->htCapability &&
1689 pAssocReq->HTCaps.present) {
1690 pMlmAssocInd->chan_info.info = MODE_11NG_HT20;
1691 pMlmAssocInd->HTCaps = pAssocReq->HTCaps;
1692 } else if (pStaDs->supportedRates.llaRates[0]) {
1693 pMlmAssocInd->chan_info.info = MODE_11G;
1694 } else {
1695 pMlmAssocInd->chan_info.info = MODE_11B;
1696 }
1697 } else {
1698 if (psessionEntry->vhtCapability && pAssocReq->VHTCaps.present) {
1699 if ((psessionEntry->vhtTxChannelWidthSet ==
1700 eHT_CHANNEL_WIDTH_80MHZ) &&
1701 pAssocReq->HTCaps.supportedChannelWidthSet) {
1702 pMlmAssocInd->chan_info.info = MODE_11AC_VHT80;
1703 } else if ((psessionEntry->vhtTxChannelWidthSet ==
1704 eHT_CHANNEL_WIDTH_40MHZ) &&
1705 pAssocReq->HTCaps.supportedChannelWidthSet) {
1706 pMlmAssocInd->chan_info.info = MODE_11AC_VHT40;
1707 } else
1708 pMlmAssocInd->chan_info.info = MODE_11AC_VHT20;
1709 pMlmAssocInd->VHTCaps = pAssocReq->VHTCaps;
1710 } else if (psessionEntry->htCapability &&
1711 pAssocReq->HTCaps.present) {
1712 if ((psessionEntry->vhtTxChannelWidthSet ==
1713 eHT_CHANNEL_WIDTH_40MHZ) &&
1714 pAssocReq->HTCaps.supportedChannelWidthSet) {
1715 pMlmAssocInd->chan_info.info = MODE_11NA_HT40;
1716 } else
1717 pMlmAssocInd->chan_info.info = MODE_11NA_HT20;
1718 pMlmAssocInd->HTCaps = pAssocReq->HTCaps;
1719 } else
1720 pMlmAssocInd->chan_info.info = MODE_11A;
1721 }
1722
1723 pMlmAssocInd->ch_width = eHT_CHANNEL_WIDTH_20MHZ;
1724 if (pStaDs->mlmStaContext.htCapability)
1725 pMlmAssocInd->ch_width = pStaDs->htSupportedChannelWidthSet ?
1726 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ;
1727
Deepthi Gowriae6a1662015-10-12 12:59:37 +05301728 pMlmAssocInd->rate_flags =
1729 limGetMaxRateFlags(pStaDs, psessionEntry);
1730
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301732 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001733 }
1734 else
1735 {
1736 // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
1737 temp = sizeof(tLimMlmReassocInd);
1738
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301739 pMlmReassocInd = vos_mem_malloc(temp);
1740 if (NULL == pMlmReassocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001741 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301742 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1743 "pMlmReassocInd"));
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001744 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 return;
1746 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301747 vos_mem_set(pMlmReassocInd, temp, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001748
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301749 vos_mem_copy((tANI_U8 *) pMlmReassocInd->peerMacAddr,
1750 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
1751 vos_mem_copy((tANI_U8 *) pMlmReassocInd->currentApAddr,
1752 (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 pMlmReassocInd->aid = pStaDs->assocId;
1754 pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301755 vos_mem_copy((tANI_U8 *)&pMlmReassocInd->ssId,
1756 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001757
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 if (pAssocReq->propIEinfo.aniIndicator)
1759 pStaDs->aniPeer = 1;
1760
1761 pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
1762 pMlmReassocInd->rsnIE.length = 0;
1763
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
1765 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1766
1767 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301769 limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d"),
1770 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001771 pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1772 pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1773 pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301774 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[2],
1775 pAssocReq->rsn.info, pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 }
1777
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 // 802.11h support
1779 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1780 {
1781 pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
1782 pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1783 pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1784 pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
1785
1786 limLog(pMac, LOG1,
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301787 FL("Sending Reassoc Ind: spectrum ON, minPwr %d, "
1788 "maxPwr %d, numChnl %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001789 pMlmReassocInd->powerCap.minTxPower,
1790 pMlmReassocInd->powerCap.maxTxPower,
1791 pMlmReassocInd->supportedChannels.numChnl);
1792
1793 for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
1794 {
1795 pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001796 limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 i, pMlmReassocInd->supportedChannels.channelList[i]);
1798 j+=2;
1799 }
1800 }
1801 else
1802 pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
1803
1804
Jeff Johnson295189b2012-06-20 16:38:30 -07001805 /* This check is to avoid extra Sec IEs present incase of WPS */
1806 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001807 {
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301808 limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d"),
1809 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001810 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1811 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301812 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
1813 pAssocReq->wpa.info,
1814 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001815 pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1816 }
1817
1818 pMlmReassocInd->addIE.length = 0;
1819 if (pAssocReq->addIEPresent)
1820 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301821 vos_mem_copy(&pMlmReassocInd->addIE.addIEdata,
1822 pAssocReq->addIE.addIEdata,
1823 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001824
1825 pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
1826 }
1827
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 if(pAssocReq->wmeInfoPresent)
1829 {
1830
1831 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Abhishek Singh5170f9c2013-12-18 16:55:22 +05301832 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"),
1833 WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001834
1835 /* check whether AP is enabled with WMM */
1836 if(tmp)
1837 {
1838 pMlmReassocInd->WmmStaInfoPresent = 1;
1839 }
1840 else
1841 {
1842 pMlmReassocInd->WmmStaInfoPresent = 0;
1843 }
1844 /* Note: we are not rejecting Re-association here because IOT will fail */
1845
1846 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001847
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301848#ifdef WLAN_FEATURE_AP_HT40_24G
1849 if(pAssocReq->HTCaps.present)
1850 {
1851 limLog(pMac, LOGW, FL("RASSOC HT40MHzInto: %d"),
1852 pAssocReq->HTCaps.stbcControlFrame);
1853 pMlmReassocInd->HT40MHzIntoPresent =
1854 pAssocReq->HTCaps.stbcControlFrame;
1855 }
1856#endif
1857
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 // Required for indicating the frames to upper layer
1859 pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1860 pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
1861
1862 pMlmReassocInd->beaconPtr = psessionEntry->beacon;
1863 pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
1864
1865 limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301866 vos_mem_free(pMlmReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 }
1868
1869 return;
1870
1871} /*** end limSendMlmAssocInd() ***/