blob: ca93f18d1039a27159edf9b8b6dfe5f2d2b42e43 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limProcessAssocReqFrame.cc contains the code
45 * for processing Re/Association Request Frame.
46 * Author: Chandra Modumudi
47 * Date: 03/18/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 * 05/26/10 js WPA handling in (Re)Assoc frames
52 *
53 */
54#include "palTypes.h"
55#include "aniGlobal.h"
Jeff Johnson62c27982013-02-27 17:53:55 -080056#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057#include "sirApi.h"
58#include "cfgApi.h"
59
60#include "schApi.h"
61#include "pmmApi.h"
62#include "utilsApi.h"
63#include "limTypes.h"
64#include "limUtils.h"
65#include "limAssocUtils.h"
66#include "limSecurityUtils.h"
67#include "limSerDesUtils.h"
68#include "limStaHashApi.h"
69#include "limAdmitControl.h"
70#include "palApi.h"
Gopichand Nakkala777e6032012-12-31 16:39:21 -080071#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070072
73
74#include "vos_types.h"
75/**
76 * limConvertSupportedChannels
77 *
78 *FUNCTION:
79 * This function is called by limProcessAssocReqFrame() to
80 * parse the channel support IE in the Assoc/Reassoc Request
81 * frame, and send relevant information in the SME_ASSOC_IND
82 *
83 *NOTE:
84 *
85 * @param pMac - A pointer to Global MAC structure
86 * @param pMlmAssocInd - A pointer to SME ASSOC/REASSOC IND
87 * @param assocReq - A pointer to ASSOC/REASSOC Request frame
88 *
89 * @return None
90 */
91static void
92limConvertSupportedChannels(tpAniSirGlobal pMac,
93 tpLimMlmAssocInd pMlmAssocInd,
94 tSirAssocReq *assocReq)
95{
96
97 tANI_U16 i, j, index=0;
98 tANI_U8 firstChannelNumber;
99 tANI_U8 numberOfChannel;
100 tANI_U8 nextChannelNumber;
101
102 if(assocReq->supportedChannels.length >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
103 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700104 limLog(pMac, LOG1, FL("Number of supported channels:%d is more than MAX"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 assocReq->supportedChannels.length);
106 pMlmAssocInd->supportedChannels.numChnl = 0;
107 return;
108 }
109
110 for(i=0; i < (assocReq->supportedChannels.length); i++)
111 {
112 // Get First Channel Number
113 firstChannelNumber = assocReq->supportedChannels.supportedChannels[i];
114 pMlmAssocInd->supportedChannels.channelList[index] = firstChannelNumber;
115 i++;
116 index++;
117 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
118 {
119 pMlmAssocInd->supportedChannels.numChnl = 0;
120 return;
121 }
122 // Get Number of Channels in a Subband
123 numberOfChannel = assocReq->supportedChannels.supportedChannels[i];
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700124 PELOG2(limLog(pMac, LOG2, FL("Rcv AssocReq: chnl=%d, numOfChnl=%d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 firstChannelNumber, numberOfChannel);)
126
127 if (numberOfChannel > 1)
128 {
129 nextChannelNumber = firstChannelNumber;
130 if(SIR_BAND_5_GHZ == limGetRFBand(firstChannelNumber))
131 {
132 for (j=1; j < numberOfChannel; j++)
133 {
134 nextChannelNumber += SIR_11A_FREQUENCY_OFFSET;
135 pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
136 index++;
137 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
138 {
139 pMlmAssocInd->supportedChannels.numChnl = 0;
140 return;
141 }
142 }
143 }
144 else if(SIR_BAND_2_4_GHZ == limGetRFBand(firstChannelNumber))
145 {
146 for (j=1; j < numberOfChannel; j++)
147 {
148 nextChannelNumber += SIR_11B_FREQUENCY_OFFSET;
149 pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
150 index++;
151 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
152 {
153 pMlmAssocInd->supportedChannels.numChnl = 0;
154 return;
155 }
156 }
157 }
158 }
159 }
160
161 pMlmAssocInd->supportedChannels.numChnl = (tANI_U8) index;
162 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700163 FL("Send AssocInd to WSM: spectrum ON, minPwr %d, maxPwr %d, numChnl %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 pMlmAssocInd->powerCap.minTxPower,
165 pMlmAssocInd->powerCap.maxTxPower,
166 pMlmAssocInd->supportedChannels.numChnl);)
167}
168
169
170/**---------------------------------------------------------------
171\fn limProcessAssocReqFrame
172\brief This function is called by limProcessMessageQueue()
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800173\ upon Re/Association Request frame reception in
Jeff Johnson295189b2012-06-20 16:38:30 -0700174\ BTAMP AP or Soft AP role.
175\
176\param pMac
177\param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800178\param subType - Indicates whether it is Association Request(=0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700179\ or Reassociation Request(=1) frame
180\return None
181------------------------------------------------------------------*/
182void
183limProcessAssocReqFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,
184 tANI_U8 subType, tpPESession psessionEntry)
185{
186 tANI_U8 updateContext;
187 tANI_U8 *pBody;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800188 tANI_U16 peerIdx, temp;
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 tANI_U32 val;
190 tANI_S32 framelen;
191 tSirRetStatus status;
192 tpSirMacMgmtHdr pHdr;
193 struct tLimPreAuthNode *pStaPreAuthContext;
194 tAniAuthType authType;
195 tSirMacCapabilityInfo localCapabilities;
196 tpDphHashNode pStaDs = NULL;
197 tpSirAssocReq pAssocReq;
Jeff Johnson295189b2012-06-20 16:38:30 -0700198 tLimMlmStates mlmPrevState;
199 tDot11fIERSN Dot11fIERSN;
200 tDot11fIEWPA Dot11fIEWPA;
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 tANI_U32 phyMode;
202 tHalBitVal qosMode;
203 tHalBitVal wsmMode, wmeMode;
204 tANI_U8 *wpsIe = NULL;
205 tSirMacRateSet basicRates;
206 tANI_U8 i = 0, j = 0;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700207 tANI_BOOLEAN pmfConnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700208
209 limGetPhyMode(pMac, &phyMode, psessionEntry);
210
211 limGetQosMode(psessionEntry, &qosMode);
212
213 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
214 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
215
216 if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE )
217 {
Jeff Johnson9acb7a32013-03-07 10:40:56 -0800218 limLog(pMac, LOGE, FL("received unexpected ASSOC REQ subType=%d for role=%d"),
219 subType, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -0700220 limPrintMacAddr(pMac, pHdr->sa, LOGE);
221 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
222 WDA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen);
223 return;
224 }
225
226 // Get pointer to Re/Association Request frame body
227 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
228
229 if (limIsGroupAddr(pHdr->sa))
230 {
231 // Received Re/Assoc Req frame from a BC/MC address
232 // Log error and ignore it
233 if (subType == LIM_ASSOC)
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700234 limLog(pMac, LOGW, FL("received Assoc frame from a BC/MC address "MAC_ADDRESS_STR),
Mohit Khanna23863762012-09-11 17:40:09 -0700235 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700236 else
Mohit Khanna23863762012-09-11 17:40:09 -0700237 limLog(pMac, LOGW, FL("received ReAssoc frame from a BC/MC address "MAC_ADDRESS_STR),
238 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 return;
240 }
Mohit Khanna23863762012-09-11 17:40:09 -0700241 limLog(pMac, LOGW, FL("Received AssocReq Frame: "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));
242
Jeff Johnson295189b2012-06-20 16:38:30 -0700243 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
244
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530245 if (vos_mem_compare((tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da,
Jeff Johnsone7245742012-09-05 17:12:55 -0700246 (tANI_U8) (sizeof(tSirMacAddr))))
247 {
248 limSendAssocRspMgmtFrame(pMac,
249 eSIR_MAC_UNSPEC_FAILURE_STATUS,
250 1,
251 pHdr->sa,
252 subType, 0,psessionEntry);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700253 limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as SAP/GO"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700254 return ;
255 }
256
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
258 if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
259 {
260 limSendAssocRspMgmtFrame(pMac,
261 eSIR_MAC_MIC_FAILURE_REASON,
262 1,
263 pHdr->sa,
264 subType, 0, psessionEntry);
265 return;
266 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700267
268 // Allocate memory for the Assoc Request frame
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530269 pAssocReq = vos_mem_malloc(sizeof(*pAssocReq));
270 if (NULL == pAssocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530272 limLog(pMac, LOGP, FL("Allocate Memory failed in AssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 return;
274 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530275 vos_mem_set((void *)pAssocReq , sizeof(*pAssocReq), 0);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800276
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 // Parse Assoc Request frame
278 if (subType == LIM_ASSOC)
279 status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
280 else
281 status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
282
283 if (status != eSIR_SUCCESS)
284 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700285 limLog(pMac, LOGW, FL("Parse error AssocRequest, length=%d from "),framelen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 limPrintMacAddr(pMac, pHdr->sa, LOGW);
287 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry);
288 goto error;
289 }
290
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530291 pAssocReq->assocReqFrame = vos_mem_malloc(framelen);
292 if ( NULL == pAssocReq->assocReqFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700294 limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, length=%d from "),framelen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 goto error;
296 }
297
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530298 vos_mem_copy((tANI_U8 *) pAssocReq->assocReqFrame,
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 (tANI_U8 *) pBody, framelen);
300 pAssocReq->assocReqFrameLength = framelen;
301
302 if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS)
303 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700304 limLog(pMac, LOGP, FL("could not retrieve Capabilities"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 goto error;
306 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 limCopyU16((tANI_U8 *) &localCapabilities, temp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700308
309 if (limCompareCapabilities(pMac,
310 pAssocReq,
311 &localCapabilities,psessionEntry) == false)
312 {
313 /**
314 * Capabilities of requesting STA does not match with
315 * local capabilities. Respond with 'unsupported capabilities'
316 * status code.
317 */
318 limSendAssocRspMgmtFrame(
319 pMac,
320 eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
321 1,
322 pHdr->sa,
323 subType, 0,psessionEntry);
324
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700325 limLog(pMac, LOGW, FL("local caps 0x%x received 0x%x"), localCapabilities, pAssocReq->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700326
327 // Log error
328 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700329 limLog(pMac, LOGW,
330 FL("received Assoc req with unsupported capabilities "MAC_ADDRESS_STR),
331 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 else
Mohit Khanna23863762012-09-11 17:40:09 -0700333 limLog(pMac, LOGW,
334 FL("received ReAssoc req with unsupported capabilities "MAC_ADDRESS_STR),
335 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 goto error;
337 }
338
339 updateContext = false;
340
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
342 {
343 /**
344 * Received Re/Association Request with either
345 * Broadcast SSID OR with SSID that does not
346 * match with local one.
347 * Respond with unspecified status code.
348 */
349 limSendAssocRspMgmtFrame(pMac,
350 eSIR_MAC_UNSPEC_FAILURE_STATUS,
351 1,
352 pHdr->sa,
353 subType, 0,psessionEntry);
354
355 // Log error
356 if (subType == LIM_ASSOC)
357 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700358 FL("received Assoc req with unmatched SSID from "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 else
360 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700361 FL("received ReAssoc req with unmatched SSID from "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 limPrintMacAddr(pMac, pHdr->sa, LOGW);
363 goto error;
364 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700365
366 /***************************************************************
367 ** Verify if the requested rates are available in supported rate
368 ** set or Extended rate set. Some APs are adding basic rates in
369 ** Extended rateset IE
370 ***************************************************************/
371 basicRates.numRates = 0;
372
Gopichand Nakkala94273ab2013-03-25 14:47:39 +0530373 for(i = 0; i < pAssocReq->supportedRates.numRates && (i < SIR_MAC_RATESET_EID_MAX); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 {
375 basicRates.rate[i] = pAssocReq->supportedRates.rate[i];
376 basicRates.numRates++;
377 }
378
379 for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++)
380 {
381 basicRates.rate[i] = pAssocReq->extendedRates.rate[j];
382 basicRates.numRates++;
383 }
384 if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
385 {
386 /**
387 * Requesting STA does not support ALL BSS basic
388 * rates. Respond with 'basic rates not supported'
389 * status code.
390 */
391 limSendAssocRspMgmtFrame(
392 pMac,
393 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
394 1,
395 pHdr->sa,
396 subType, 0,psessionEntry);
397
398 // Log error
399 if (subType == LIM_ASSOC)
400 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700401 FL("received Assoc req with unsupported rates from "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 else
403 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700404 FL("received ReAssoc req with unsupported rates from"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 limPrintMacAddr(pMac, pHdr->sa, LOGW);
406 goto error;
407 }
408
Jeff Johnson295189b2012-06-20 16:38:30 -0700409
410 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
411 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) &&
412 ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present)))
413 {
414 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
415 1, pHdr->sa, subType, 0, psessionEntry );
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700416 limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy STA's"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 goto error;
418
419 }//end if phyMode == 11G_only
420
421 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
422 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) &&
423 (!pAssocReq->HTCaps.present))
424 {
425 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
426 1, pHdr->sa, subType, 0, psessionEntry );
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700427 limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy STA's"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 goto error;
429 }//end if PhyMode == 11N_only
430
Jeff Johnson295189b2012-06-20 16:38:30 -0700431
432 /* Spectrum Management (11h) specific checks */
433 if (localCapabilities.spectrumMgt)
434 {
435 tSirRetStatus status = eSIR_SUCCESS;
436
437 /* If station is 11h capable, then it SHOULD send all mandatory
438 * IEs in assoc request frame. Let us verify that
439 */
440 if (pAssocReq->capabilityInfo.spectrumMgt)
441 {
442 if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent)))
443 {
444 /* One or more required information elements are missing, log the peers error */
445 if (!pAssocReq->powerCapabilityPresent)
446 {
447 if(subType == LIM_ASSOC)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700448 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability IE in assoc request"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700450 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability IE in Reassoc request"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 }
452 if (!pAssocReq->supportedChannelsPresent)
453 {
454 if(subType == LIM_ASSOC)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700455 limLog(pMac, LOG1, FL("LIM Info: Missing Supported channel IE in assoc request"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700457 limLog(pMac, LOG1, FL("LIM Info: Missing Supported channel IE in Reassoc request"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 }
459 limPrintMacAddr(pMac, pHdr->sa, LOG1);
460 }
461 else
462 {
463 /* Assoc request has mandatory fields */
464 status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry);
465 if (eSIR_SUCCESS != status)
466 {
467 if (subType == LIM_ASSOC)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700468 limLog(pMac, LOGW, FL("LIM Info: Association MinTxPower(STA) > MaxTxPower(AP)"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700470 limLog(pMac, LOGW, FL("LIM Info: Reassociation MinTxPower(STA) > MaxTxPower(AP)"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 limPrintMacAddr(pMac, pHdr->sa, LOGW);
472 }
473 status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq);
474 if (eSIR_SUCCESS != status)
475 {
476 if (subType == LIM_ASSOC)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700477 limLog(pMac, LOGW, FL("LIM Info: Association wrong supported channels (STA)"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700479 limLog(pMac, LOGW, FL("LIM Info: Reassociation wrong supported channels (STA)"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 limPrintMacAddr(pMac, pHdr->sa, LOGW);
481 }
482 /* IEs are valid, use them if needed */
483 }
484 } //if(assoc.capabilityInfo.spectrumMgt)
485 else
486 {
487 /* As per the capabiities, the spectrum management is not enabled on the station
488 * The AP may allow the associations to happen even if spectrum management is not
489 * allowed, if the transmit power of station is below the regulatory maximum
490 */
491
492 /* TODO: presently, this is not handled. In the current implemetation, the AP would
493 * allow the station to associate even if it doesn't support spectrum management.
494 */
495 }
496 }// end of spectrum management related processing
497
498 if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
499 {
500 /**
501 * Requesting STA does not support ALL BSS MCS basic Rate set rates.
502 * Spec does not define any status code for this scenario.
503 */
504 limSendAssocRspMgmtFrame(
505 pMac,
506 eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS,
507 1,
508 pHdr->sa,
509 subType, 0,psessionEntry);
510
511 // Log error
512 if (subType == LIM_ASSOC)
513 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700514 FL("received Assoc req with unsupported MCS Rate Set from "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 else
516 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700517 FL("received ReAssoc req with unsupported MCS Rate Set from"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 limPrintMacAddr(pMac, pHdr->sa, LOGW);
519 goto error;
520 }
521
522 //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G)
523 if (phyMode == WNI_CFG_PHY_MODE_11G)
524 {
525
526 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS)
527 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700528 limLog(pMac, LOGP, FL("could not retrieve 11g-only flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 goto error;
530 }
531
532 if (!pAssocReq->extendedRatesPresent && val)
533 {
534 /**
535 * Received Re/Association Request from
536 * 11b STA when 11g only policy option
537 * is set.
538 * Reject with unspecified status code.
539 */
540 limSendAssocRspMgmtFrame(
541 pMac,
542 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
543 1,
544 pHdr->sa,
545 subType, 0,psessionEntry);
546
547 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from 11b STA: "));
548 limPrintMacAddr(pMac, pHdr->sa, LOGW);
549
550#ifdef WLAN_DEBUG
551 pMac->lim.gLim11bStaAssocRejectCount++;
552#endif
553 goto error;
554 }
555 }
556
557#ifdef WMM_APSD
558 // Save the QOS info element in assoc request..
559 limGetWmeMode(pMac, &wmeMode);
560 if (wmeMode == eHAL_SET)
561 {
562 tpQosInfoSta qInfo;
563
564 qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo);
565
566 if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi))
567 {
568
569 /**
570 * Received Re/Association Request from
571 * 11b STA when 11g only policy option
572 * is set.
573 * Reject with unspecified status code.
574 */
575 limSendAssocRspMgmtFrame(
576 pMac,
577 eSIR_MAC_WME_REFUSED_STATUS,
578 1,
579 pHdr->sa,
580 subType, 0,psessionEntry);
581
582 limLog(pMac, LOGW,
583 FL("Rejecting Re/Assoc req from STA: "));
584 limPrintMacAddr(pMac, pHdr->sa, LOGW);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700585 limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x"), *qInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 goto error;
587 }
588 }
589#endif
590
591 // Check for 802.11n HT caps compatibility; are HT Capabilities
592 // turned on in lim?
Jeff Johnsone7245742012-09-05 17:12:55 -0700593 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 {
595 // There are; are they turned on in the STA?
596 if ( pAssocReq->HTCaps.present )
597 {
598 // The station *does* support 802.11n HT capability...
599
600 limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d "
601 "PowerSave:%d greenField:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700602 "shortGI20:%d shortGI40:%d"
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 "txSTBC:%d rxSTBC:%d delayBA:%d"
604 "maxAMSDUsize:%d DSSS/CCK:%d "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700605 "PSMP:%d stbcCntl:%d lsigTXProt:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 pAssocReq->HTCaps.advCodingCap,
607 pAssocReq->HTCaps.supportedChannelWidthSet,
608 pAssocReq->HTCaps.mimoPowerSave,
609 pAssocReq->HTCaps.greenField,
610 pAssocReq->HTCaps.shortGI20MHz,
611 pAssocReq->HTCaps.shortGI40MHz,
612 pAssocReq->HTCaps.txSTBC,
613 pAssocReq->HTCaps.rxSTBC,
614 pAssocReq->HTCaps.delayedBA,
615 pAssocReq->HTCaps.maximalAMSDUsize,
616 pAssocReq->HTCaps.dsssCckMode40MHz,
617 pAssocReq->HTCaps.psmp,
618 pAssocReq->HTCaps.stbcControlFrame,
619 pAssocReq->HTCaps.lsigTXOPProtection );
620
621 // Make sure the STA's caps are compatible with our own:
622 //11.15.2 Support of DSSS/CCK in 40 MHz
623 //the AP shall refuse association requests from an HT STA that has the DSSS/CCK
624 //Mode in 40 MHz subfield set to 1;
625
626 //FIXME_BTAMP_AP : Need to be enabled
627 /*
628 if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz )
629 {
630 statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS;
631 limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700632 "STA rejected." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 // Reject association
634 limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry);
635 goto error;
636 }
637 */
638 }
639 } // End if on HT caps turned on in lim.
640
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 /* 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 +0530642 vos_mem_set((tANI_U8*)&Dot11fIERSN, sizeof( Dot11fIERSN ), 0);
643 vos_mem_set((tANI_U8*)&Dot11fIEWPA, sizeof( Dot11fIEWPA ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700644
645 /* if additional IE is present, check if it has WscIE */
646 if( pAssocReq->addIEPresent && pAssocReq->addIE.length )
647 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
648 /* when wpsIe is present, RSN/WPA IE is ignored */
649 if( wpsIe == NULL )
650 {
651 /** check whether as RSN IE is present */
652 if(psessionEntry->limSystemRole == eLIM_AP_ROLE
653 && psessionEntry->pLimStartBssReq->privacy
654 && psessionEntry->pLimStartBssReq->rsnIE.length)
655 {
656 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700657 FL("AP supports RSN enabled authentication"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700658
659 if(pAssocReq->rsnPresent)
660 {
661 if(pAssocReq->rsn.length)
662 {
663 // Unpack the RSN IE
664 dot11fUnpackIeRSN(pMac,
665 &pAssocReq->rsn.info[0],
666 pAssocReq->rsn.length,
667 &Dot11fIERSN);
668
669 /* Check RSN version is supported or not */
670 if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version)
671 {
672 /* check the groupwise and pairwise cipher suites */
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700673 if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry,
674 pAssocReq->HTCaps.present, &pmfConnection)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 {
676 /* some IE is not properly sent */
677 /* received Association req frame with RSN IE but length is 0 */
678 limSendAssocRspMgmtFrame(
679 pMac,
680 status,
681 1,
682 pHdr->sa,
683 subType, 0,psessionEntry);
684
685 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
686 limPrintMacAddr(pMac, pHdr->sa, LOGW);
687 goto error;
688
689 }
690 }
691 else
692 {
693 /* received Association req frame with RSN IE version wrong */
694 limSendAssocRspMgmtFrame(
695 pMac,
696 eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS,
697 1,
698 pHdr->sa,
699 subType, 0,psessionEntry);
700
701 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
702 limPrintMacAddr(pMac, pHdr->sa, LOGW);
703 goto error;
704
705 }
706 }
707 else
708 {
709 /* received Association req frame with RSN IE but length is 0 */
710 limSendAssocRspMgmtFrame(
711 pMac,
712 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
713 1,
714 pHdr->sa,
715 subType, 0,psessionEntry);
716
717 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
718 limPrintMacAddr(pMac, pHdr->sa, LOGW);
719 goto error;
720
721 }
722 } /* end - if(pAssocReq->rsnPresent) */
723 if((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent)
724 {
725 // Unpack the WPA IE
726 if(pAssocReq->wpa.length)
727 {
728 dot11fUnpackIeWPA(pMac,
729 &pAssocReq->wpa.info[4], //OUI is not taken care
730 pAssocReq->wpa.length,
731 &Dot11fIEWPA);
732 /* check the groupwise and pairwise cipher suites */
733 if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present)))
734 {
735 /* received Association req frame with WPA IE but mismatch */
736 limSendAssocRspMgmtFrame(
737 pMac,
738 status,
739 1,
740 pHdr->sa,
741 subType, 0,psessionEntry);
742
743 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
744 limPrintMacAddr(pMac, pHdr->sa, LOGW);
745 goto error;
746
747 }
748 }
749 else
750 {
751 /* received Association req frame with invalid WPA IE */
752 limSendAssocRspMgmtFrame(
753 pMac,
754 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
755 1,
756 pHdr->sa,
757 subType, 0,psessionEntry);
758
759 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
760 limPrintMacAddr(pMac, pHdr->sa, LOGW);
761 goto error;
762 }/* end - if(pAssocReq->wpa.length) */
763 } /* end - if(pAssocReq->wpaPresent) */
764 } /* end of if(psessionEntry->pLimStartBssReq->privacy
765 && psessionEntry->pLimStartBssReq->rsnIE->length) */
766
767 } /* end of if( ! pAssocReq->wscInfo.present ) */
Jeff Johnson295189b2012-06-20 16:38:30 -0700768
769 /**
770 * Extract 'associated' context for STA, if any.
771 * This is maintained by DPH and created by LIM.
772 */
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800773 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700774
775 /// Extract pre-auth context for the STA, if any.
776 pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa);
777
778 if (pStaDs == NULL)
779 {
780 /// Requesting STA is not currently associated
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800781 if (peGetCurrentSTAsCount(pMac) == pMac->lim.maxStation)
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 {
783 /**
784 * Maximum number of STAs that AP can handle reached.
785 * Send Association response to peer MAC entity
786 */
787 limRejectAssociation(pMac, pHdr->sa,
788 subType, false,
789 (tAniAuthType) 0, 0,
790 false,
791 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
792
793 goto error;
794 }
795
796 /// Check if STA is pre-authenticated.
797 if ((pStaPreAuthContext == NULL) ||
798 (pStaPreAuthContext &&
799 (pStaPreAuthContext->mlmState !=
800 eLIM_MLM_AUTHENTICATED_STATE)))
801 {
802 /**
803 * STA is not pre-authenticated yet requesting
804 * Re/Association before Authentication.
805 * OR STA is in the process of getting authenticated
806 * and sent Re/Association request.
807 * Send Deauthentication frame with 'prior
808 * authentication required' reason code.
809 */
810 limSendDeauthMgmtFrame(
811 pMac,
812 eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800813 pHdr->sa, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700814
815 // Log error
816 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700817 limLog(pMac, LOGW,
818 FL("received Assoc req from STA that does not have pre-auth context "MAC_ADDRESS_STR),
819 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 else
Mohit Khanna23863762012-09-11 17:40:09 -0700821 limLog(pMac, LOGW,
822 FL("received ReAssoc req from STA that does not have pre-auth context "
823 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 goto error;
825 }
826
827 /// Delete 'pre-auth' context of STA
828 authType = pStaPreAuthContext->authType;
829 limDeletePreAuthNode(pMac, pHdr->sa);
830
831 // All is well. Assign AID (after else part)
832
833 } // if (pStaDs == NULL)
834 else
835 {
836 // STA context does exist for this STA
837
838 if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
839 {
840 /**
841 * Requesting STA is in some 'transient' state?
842 * Ignore the Re/Assoc Req frame by incrementing
843 * debug counter & logging error.
844 */
845 if (subType == LIM_ASSOC)
846 {
847
848#ifdef WLAN_DEBUG
849 pMac->lim.gLimNumAssocReqDropInvldState++;
850#endif
851 limLog(pMac, LOG1, FL("received Assoc req in state %X from "), pStaDs->mlmStaContext.mlmState);
852 }
853 else
854 {
855#ifdef WLAN_DEBUG
856 pMac->lim.gLimNumReassocReqDropInvldState++;
857#endif
858 limLog(pMac, LOG1, FL("received ReAssoc req in state %X from "), pStaDs->mlmStaContext.mlmState);
859 }
860 limPrintMacAddr(pMac, pHdr->sa, LOG1);
861 limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -0700862
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 goto error;
864 } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
865
866 /**
867 * STA sent Re/Association Request frame while already in
868 * 'associated' state. Update STA capabilities and
869 * send Association response frame with same AID
870 */
871
872 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
873
874 if (pStaPreAuthContext &&
875 (pStaPreAuthContext->mlmState ==
876 eLIM_MLM_AUTHENTICATED_STATE))
877 {
878 /// STA has triggered pre-auth again
879 authType = pStaPreAuthContext->authType;
880 limDeletePreAuthNode(pMac, pHdr->sa);
881 }
882 else
883 authType = pStaDs->mlmStaContext.authType;
884
885 updateContext = true;
886
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800887 if (dphInitStaState(pMac, pHdr->sa, peerIdx, true, &psessionEntry->dph.dphHashTable) == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700889 limLog(pMac, LOGE, FL("could not Init STAid=%d"), peerIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 goto error;
891 }
892
893
894 goto sendIndToSme;
895 } // end if (lookup for STA in perStaDs fails)
896
897
898
899 // check if sta is allowed per QoS AC rules
900 //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled)
901 limGetWmeMode(psessionEntry, &wmeMode);
902 if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET))
903 {
904 // for a qsta, check if the requested Traffic spec
905 // is admissible
906 // for a non-qsta check if the sta can be admitted
907 if (pAssocReq->addtsPresent)
908 {
909 tANI_U8 tspecIdx = 0; //index in the sch tspec table.
910 if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
911 &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
912 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700913 limLog(pMac, LOGW, FL("AdmitControl: TSPEC rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700914 limSendAssocRspMgmtFrame(
915 pMac,
916 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
917 1,
918 pHdr->sa,
919 subType, 0,psessionEntry);
920#ifdef WLAN_DEBUG
921 pMac->lim.gLimNumAssocReqDropACRejectTS++;
922#endif
923 goto error;
924 }
925 }
926 else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
927 != eSIR_SUCCESS)
928 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700929 limLog(pMac, LOGW, FL("AdmitControl: Sta rejected"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 limSendAssocRspMgmtFrame(
931 pMac,
932 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
933 1,
934 pHdr->sa,
935 subType, 0,psessionEntry);
936#ifdef WLAN_DEBUG
937 pMac->lim.gLimNumAssocReqDropACRejectSta++;
938#endif
939 goto error;
940 }
941
942 // else all ok
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700943 limLog(pMac, LOG1, FL("AdmitControl: Sta OK!"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 }
945
946 /**
947 * STA is Associated !
948 */
949 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700950 limLog(pMac, LOGW, FL("received Assoc req successful "MAC_ADDRESS_STR),
951 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700952 else
Mohit Khanna23863762012-09-11 17:40:09 -0700953 limLog(pMac, LOGW, FL("received ReAssoc req successful"MAC_ADDRESS_STR),
954 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700955
956 /**
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800957 * AID for this association will be same as the peer Index used in DPH table.
958 * Assign unused/least recently used peer Index from perStaDs.
959 * NOTE: limAssignPeerIdx() assigns AID values ranging
960 * between 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT)
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 */
962
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800963 peerIdx = limAssignPeerIdx(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700964
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800965 if (!peerIdx)
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 {
967 // Could not assign AID
968 // Reject association
969 limRejectAssociation(pMac, pHdr->sa,
970 subType, true, authType,
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800971 peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
973
974 goto error;
975 }
976
977 /**
978 * Add an entry to hash table maintained by DPH module
979 */
980
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800981 pStaDs = dphAddHashEntry(pMac, pHdr->sa, peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700982
983 if (pStaDs == NULL)
984 {
985 // Could not add hash table entry at DPH
986 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700987 FL("could not add hash entry at DPH for aid=%d, MacAddr:"),
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800988 peerIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 limPrintMacAddr(pMac, pHdr->sa, LOGE);
990
991 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800992 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700993
994 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800995 subType, true, authType, peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
997
998 goto error;
999 }
1000
1001
1002sendIndToSme:
1003
1004 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1005
1006 pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
Jeff Johnsone7245742012-09-05 17:12:55 -07001007#ifdef WLAN_FEATURE_11AC
1008 pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
1009#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
1011 pStaDs->qos.addts = pAssocReq->addtsReq;
1012 pStaDs->qos.capability = pAssocReq->qosCapability;
1013 pStaDs->versionPresent = 0;
1014 /* short slot and short preamble should be updated before doing limaddsta */
1015 pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble;
1016 pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime;
1017
1018 if (pAssocReq->propIEinfo.versionPresent) //update STA version info
1019 {
1020 pStaDs->versionPresent = 1;
1021 pStaDs->version = pAssocReq->propIEinfo.version;
1022 }
1023 pStaDs->propCapability = 0;
1024 if (pAssocReq->propIEinfo.capabilityPresent)
1025 {
1026 if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability))
1027 pStaDs->propCapability &= pAssocReq->propIEinfo.capability;
1028 }
1029
1030 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
1031 pStaDs->valid = 0;
1032 pStaDs->mlmStaContext.authType = authType;
1033 pStaDs->staType = STA_ENTRY_PEER;
1034
1035 //TODO: If listen interval is more than certain limit, reject the association.
1036 //Need to check customer requirements and then implement.
1037 pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval;
1038 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1039
1040 /* The following count will be used to knock-off the station if it doesn't
1041 * come back to receive the buffered data. The AP will wait for numTimSent number
1042 * of beacons after sending TIM information for the station, before assuming that
1043 * the station is no more associated and disassociates it
1044 */
1045
1046 /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
1047 pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval);
1048
1049 /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */
1050 pStaDs->curTxMpduCnt = 0;
1051
1052 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
1053 (pAssocReq->HTCaps.present))
1054 {
1055 pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField;
1056 pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity;
1057 pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz;
1058 pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection;
1059 pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
1060 pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
1061 pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
1062 pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
1063 pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
1064 pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07001065 /* 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
1066 * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
1067 */
1068 pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
1069#ifdef WLAN_FEATURE_11AC
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07001070 if(pAssocReq->operMode.present)
1071 {
1072 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pAssocReq->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
1073 pStaDs->htSupportedChannelWidthSet = (tANI_U8)(pAssocReq->operMode.chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
1074 }
1075 else if (pAssocReq->VHTCaps.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07001076 {
Madan Mohan Koyyalamudi740f7802012-09-24 14:17:14 -07001077 // Check if STA has enabled it's channel bonding mode.
1078 // If channel bonding mode is enabled, we decide based on SAP's current configuration.
1079 // else, we set it to VHT20.
1080 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pStaDs->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ?
1081 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
1082 psessionEntry->vhtTxChannelWidthSet );
Jeff Johnsone7245742012-09-05 17:12:55 -07001083 }
Madan Mohan Koyyalamudicc394402012-10-05 10:48:19 -07001084
1085 // Lesser among the AP and STA bandwidth of operation.
1086 pStaDs->htSupportedChannelWidthSet =
1087 (pStaDs->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1088 pStaDs->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1089
Jeff Johnsone7245742012-09-05 17:12:55 -07001090#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 pStaDs->baPolicyFlag = 0xFF;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001092 pStaDs->htLdpcCapable = (tANI_U8)pAssocReq->HTCaps.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 }
1094
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001095 if(pAssocReq->VHTCaps.present)
1096 {
1097 pStaDs->vhtLdpcCapable = (tANI_U8)pAssocReq->VHTCaps.ldpcCodingCap;
1098 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001099
Jeff Johnsone7245742012-09-05 17:12:55 -07001100#ifdef WLAN_FEATURE_11AC
1101if (limPopulateMatchingRateSet(pMac,
1102 pStaDs,
1103 &(pAssocReq->supportedRates),
1104 &(pAssocReq->extendedRates),
1105 pAssocReq->HTCaps.supportedMCSSet,
1106 &(pAssocReq->propIEinfo.propRates),
1107 psessionEntry , &pAssocReq->VHTCaps)
1108 != eSIR_SUCCESS)
1109#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001110
1111 if (limPopulateMatchingRateSet(pMac,
1112 pStaDs,
1113 &(pAssocReq->supportedRates),
1114 &(pAssocReq->extendedRates),
1115 pAssocReq->HTCaps.supportedMCSSet,
1116 &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -07001117#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 {
1119 // Could not update hash table entry at DPH with rateset
1120 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001121 FL("could not update hash entry at DPH for aid=%d, MacAddr:"),
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001122 peerIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07001123 limPrintMacAddr(pMac, pHdr->sa, LOGE);
1124
1125 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001126 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001127
1128
1129 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001130 subType, true, authType, peerIdx, true,
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1132
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001133 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1134 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001135 }
1136
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301137 vos_mem_copy((tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
1138 (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
Jeff Johnson295189b2012-06-20 16:38:30 -07001139 pAssocReq->propIEinfo.propRates.numPropRates + 1);
1140
1141 /// Add STA context at MAC HW (BMU, RHP & TFP)
1142
1143 pStaDs->qosMode = eANI_BOOLEAN_FALSE;
1144 pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
1145 if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
1146 {
1147 pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
1148 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1149 }
1150
1151 pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
1152 pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
1153 limGetWmeMode(psessionEntry, &wmeMode);
1154 //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
1155 if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
1156 {
1157 pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
1158 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1159 limGetWsmMode(psessionEntry, &wsmMode);
1160 /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
1161 can coexist */
Jeff Johnson295189b2012-06-20 16:38:30 -07001162 if( pAssocReq->WMMInfoStation.present)
1163 {
1164 /* check whether AP supports or not */
1165 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
1166 && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
1167 || pAssocReq->WMMInfoStation.acbk_uapsd
1168 || pAssocReq->WMMInfoStation.acvo_uapsd
1169 || pAssocReq->WMMInfoStation.acvi_uapsd))
1170 {
1171
1172 /**
1173 * Received Re/Association Request from
1174 * STA when UPASD is not supported.
1175 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001176 limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001178 subType, true, authType, peerIdx, true,
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 (tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1180
1181
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001182 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1183 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 }
1185 else
1186 {
1187 /* update UAPSD and send it to LIM to add STA */
1188 pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
1189 pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
1190 pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
1191 pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
1192 pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
1193 }
1194 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
1196 if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
1197 pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
1198
1199 }
1200
1201 // Re/Assoc Response frame to requesting STA
1202 pStaDs->mlmStaContext.subType = subType;
1203
1204 if (pAssocReq->propIEinfo.aniIndicator)
1205 pStaDs->aniPeer = 1;
1206
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001207#ifdef WLAN_FEATURE_11W
1208 pStaDs->rmfEnabled = (pmfConnection) ? 1 : 0;
1209#endif
1210
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 // BTAMP: Storing the parsed assoc request in the psessionEntry array
1212 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1213
1214 /* BTAMP: If STA context already exist (ie. updateContext = 1)
1215 * for this STA, then we should delete the old one, and add
1216 * the new STA. This is taken care of in the limDelSta() routine.
1217 *
1218 * Prior to BTAMP, we were setting this flag so that when
1219 * PE receives SME_ASSOC_CNF, and if this flag is set, then
1220 * PE shall delete the old station and then add. But now in
1221 * BTAMP, we're directly adding station before waiting for
1222 * SME_ASSOC_CNF, so we can do this now.
1223 */
1224 if (!updateContext)
1225 {
1226 pStaDs->mlmStaContext.updateContext = 0;
1227
1228 // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001229 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001231 limLog(pMac, LOGE, FL("could not Add STA with assocId=%d"), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001232 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
1233 true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
1234 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1235
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001236 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
1237 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 }
1239 }
1240 else
1241 {
1242 pStaDs->mlmStaContext.updateContext = 1;
1243
Jeff Johnson295189b2012-06-20 16:38:30 -07001244 mlmPrevState = pStaDs->mlmStaContext.mlmState;
1245
1246 /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
1247 if(subType != LIM_REASSOC)
1248 {
1249 //we need to set the mlmState here in order differentiate in limDelSta.
1250 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
1251 if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
1252 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001253 limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d"), pStaDs->assocId, pStaDs->staIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001254 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1255 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1256
1257 //Restoring the state back.
1258 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001259 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 goto error;
1261 }
1262 }
1263 else
1264 {
1265 /* mlmState is changed in limAddSta context */
1266 /* use the same AID, already allocated */
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001267 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001269 limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001270 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1271 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1272
1273 //Restoring the state back.
1274 pStaDs->mlmStaContext.mlmState = mlmPrevState;
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001275 pAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 goto error;
1277 }
1278
1279 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001280
1281 }
1282
1283 return;
1284
1285error:
1286 if (pAssocReq != NULL)
1287 {
1288 if ( pAssocReq->assocReqFrame )
1289 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301290 vos_mem_free(pAssocReq->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 pAssocReq->assocReqFrame = NULL;
1292 }
1293
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301294 vos_mem_free(pAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 }
1296
Jeff Johnsone7245742012-09-05 17:12:55 -07001297 /* If it is not duplicate Assoc request then only make to Null */
1298 if ((pStaDs != NULL) &&
1299 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001301
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 return;
1303
1304} /*** end limProcessAssocReqFrame() ***/
1305
1306
1307
1308/**---------------------------------------------------------------
1309\fn limSendMlmAssocInd
1310\brief This function sends either LIM_MLM_ASSOC_IND
1311\ or LIM_MLM_REASSOC_IND to SME.
1312\
1313\param pMac
1314\param *pStaDs - Station DPH hash entry
1315\param psessionEntry - PE session entry
1316\return None
1317
1318 * ?????? How do I get
1319 * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
1320 * - aid =====> pStaDs->assocId
1321 * - pHdr->sa =====> pStaDs->staAddr
1322 * - authType
1323 * - pHdr->seqControl =====> no longer needed
1324 * - pStaDs
1325------------------------------------------------------------------*/
1326void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1327{
1328 tpLimMlmAssocInd pMlmAssocInd = NULL;
1329 tpLimMlmReassocInd pMlmReassocInd;
1330 tpSirAssocReq pAssocReq;
1331 tANI_U16 temp;
1332 tANI_U32 phyMode;
1333 tANI_U8 subType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 tANI_U8 *wpsIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 tANI_U32 tmp;
1336// tANI_U16 statusCode;
1337 tANI_U16 i, j=0;
1338
1339 // Get a copy of the already parsed Assoc Request
1340 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
1341
1342 // Get the phyMode
1343 limGetPhyMode(pMac, &phyMode, psessionEntry);
1344
1345 // Extract pre-auth context for the peer BTAMP-STA, if any.
1346
1347 // Determiine if its Assoc or ReAssoc Request
1348 if (pAssocReq->reassocRequest == 1)
1349 subType = LIM_REASSOC;
1350 else
1351 subType = LIM_ASSOC;
Jeff Johnson295189b2012-06-20 16:38:30 -07001352 if (subType == LIM_ASSOC || subType == LIM_REASSOC)
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 {
1354 temp = sizeof(tLimMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001355
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301356 pMlmAssocInd = vos_mem_malloc(temp);
1357 if (NULL == pMlmAssocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001359 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301360 limLog(pMac, LOGP, FL("AllocateMemory failed for pMlmAssocInd"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001361 return;
1362 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301363 vos_mem_set(pMlmAssocInd, temp ,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001364
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301365 vos_mem_copy((tANI_U8 *)pMlmAssocInd->peerMacAddr,
1366 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001367
1368 pMlmAssocInd->aid = pStaDs->assocId;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301369 vos_mem_copy((tANI_U8 *)&pMlmAssocInd->ssId,
1370 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001371 pMlmAssocInd->sessionId = psessionEntry->peSessionId;
1372 pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
1373
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
1375
1376 // Fill in RSN IE information
1377 pMlmAssocInd->rsnIE.length = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001378 // if WPS IE is present, ignore RSN IE
1379 if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
1380 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1381 }
1382 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001384 limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d"), pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1386 pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1387 pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301388 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[2],
1389 pAssocReq->rsn.info,
1390 pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 }
1392
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 // Fill in 802.11h related info
1394 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1395 {
1396 pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
1397 pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1398 pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1399 limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
1400 }
1401 else
1402 pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
1403
1404
Jeff Johnson295189b2012-06-20 16:38:30 -07001405 /* This check is to avoid extra Sec IEs present incase of WPS */
1406 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001407 {
1408 if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
1409 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001410 PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d"), pMlmAssocInd->rsnIE.length);)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301411 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 return;
1413 }
1414 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1415 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301416 vos_mem_copy(&pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
1417 pAssocReq->wpa.info,
1418 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1420 }
1421
1422
1423 pMlmAssocInd->addIE.length = 0;
1424 if (pAssocReq->addIEPresent)
1425 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301426 vos_mem_copy(&pMlmAssocInd->addIE.addIEdata,
1427 pAssocReq->addIE.addIEdata,
1428 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001429
1430 pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
1431 }
1432
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 if(pAssocReq->wmeInfoPresent)
1434 {
1435
1436 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001437 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"), WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001438
1439 /* check whether AP is enabled with WMM */
1440 if(tmp)
1441 {
1442 pMlmAssocInd->WmmStaInfoPresent = 1;
1443 }
1444 else
1445 {
1446 pMlmAssocInd->WmmStaInfoPresent= 0;
1447 }
1448 /* Note: we are not rejecting association here because IOT will fail */
1449
1450 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001451
1452 // Required for indicating the frames to upper layer
1453 pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1454 pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
1455
1456 pMlmAssocInd->beaconPtr = psessionEntry->beacon;
1457 pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
1458
1459 limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301460 vos_mem_free(pMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 }
1462 else
1463 {
1464 // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
1465 temp = sizeof(tLimMlmReassocInd);
1466
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301467 pMlmReassocInd = vos_mem_malloc(temp);
1468 if (NULL == pMlmReassocInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07001469 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301470 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pMlmReassocInd"));
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001471 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001472 return;
1473 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301474 vos_mem_set(pMlmReassocInd, temp, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001475
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301476 vos_mem_copy((tANI_U8 *) pMlmReassocInd->peerMacAddr,
1477 (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
1478 vos_mem_copy((tANI_U8 *) pMlmReassocInd->currentApAddr,
1479 (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 pMlmReassocInd->aid = pStaDs->assocId;
1481 pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301482 vos_mem_copy((tANI_U8 *)&pMlmReassocInd->ssId,
1483 (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001484
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 if (pAssocReq->propIEinfo.aniIndicator)
1486 pStaDs->aniPeer = 1;
1487
1488 pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
1489 pMlmReassocInd->rsnIE.length = 0;
1490
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
1492 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1493
1494 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001496 limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d"), pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1498 pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1499 pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301500 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[2],
1501 pAssocReq->rsn.info, pAssocReq->rsn.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 }
1503
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 // 802.11h support
1505 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1506 {
1507 pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
1508 pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1509 pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1510 pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
1511
1512 limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001513 FL("Sending Reassoc Ind: spectrum ON, minPwr %d, maxPwr %d, numChnl %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 pMlmReassocInd->powerCap.minTxPower,
1515 pMlmReassocInd->powerCap.maxTxPower,
1516 pMlmReassocInd->supportedChannels.numChnl);
1517
1518 for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
1519 {
1520 pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001521 limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 i, pMlmReassocInd->supportedChannels.channelList[i]);
1523 j+=2;
1524 }
1525 }
1526 else
1527 pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
1528
1529
Jeff Johnson295189b2012-06-20 16:38:30 -07001530 /* This check is to avoid extra Sec IEs present incase of WPS */
1531 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001532 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001533 limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d"), pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1535 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301536 vos_mem_copy(&pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
1537 pAssocReq->wpa.info,
1538 pAssocReq->wpa.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1540 }
1541
1542 pMlmReassocInd->addIE.length = 0;
1543 if (pAssocReq->addIEPresent)
1544 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301545 vos_mem_copy(&pMlmReassocInd->addIE.addIEdata,
1546 pAssocReq->addIE.addIEdata,
1547 pAssocReq->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001548
1549 pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
1550 }
1551
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 if(pAssocReq->wmeInfoPresent)
1553 {
1554
1555 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001556 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d"), WNI_CFG_WME_ENABLED );
Jeff Johnson295189b2012-06-20 16:38:30 -07001557
1558 /* check whether AP is enabled with WMM */
1559 if(tmp)
1560 {
1561 pMlmReassocInd->WmmStaInfoPresent = 1;
1562 }
1563 else
1564 {
1565 pMlmReassocInd->WmmStaInfoPresent = 0;
1566 }
1567 /* Note: we are not rejecting Re-association here because IOT will fail */
1568
1569 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001570
1571 // Required for indicating the frames to upper layer
1572 pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1573 pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
1574
1575 pMlmReassocInd->beaconPtr = psessionEntry->beacon;
1576 pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
1577
1578 limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301579 vos_mem_free(pMlmReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 }
1581
1582 return;
1583
1584} /*** end limSendMlmAssocInd() ***/