blob: c8fcf31f58e895cc705380ebd55dc8726020bff9 [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 {
104 limLog(pMac, LOG1, FL("Number of supported channels:%d is more than MAX\n"),
105 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];
124 PELOG2(limLog(pMac, LOG2, FL("Rcv AssocReq: chnl=%d, numOfChnl=%d \n"),
125 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,
163 FL("Send AssocInd to WSM: spectrum ON, minPwr %d, maxPwr %d, numChnl %d\n"),
164 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;
207
208 limGetPhyMode(pMac, &phyMode, psessionEntry);
209
210 limGetQosMode(psessionEntry, &qosMode);
211
212 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
213 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
214
215 if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE )
216 {
217 limLog(pMac, LOGE, FL("received unexpected ASSOC REQ subType=%d for role=%d, radioId=%d from \n"),
218 subType, psessionEntry->limSystemRole, pMac->sys.gSirRadioId);
219 limPrintMacAddr(pMac, pHdr->sa, LOGE);
220 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
221 WDA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen);
222 return;
223 }
224
225 // Get pointer to Re/Association Request frame body
226 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
227
228 if (limIsGroupAddr(pHdr->sa))
229 {
230 // Received Re/Assoc Req frame from a BC/MC address
231 // Log error and ignore it
232 if (subType == LIM_ASSOC)
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700233 limLog(pMac, LOGW, FL("received Assoc frame from a BC/MC address "MAC_ADDRESS_STR),
Mohit Khanna23863762012-09-11 17:40:09 -0700234 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700235 else
Mohit Khanna23863762012-09-11 17:40:09 -0700236 limLog(pMac, LOGW, FL("received ReAssoc frame from a BC/MC address "MAC_ADDRESS_STR),
237 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 return;
239 }
Mohit Khanna23863762012-09-11 17:40:09 -0700240 limLog(pMac, LOGW, FL("Received AssocReq Frame: "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));
241
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
243
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800244 if( palEqualMemory( pMac->hHdd, (tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da,
Jeff Johnsone7245742012-09-05 17:12:55 -0700245 (tANI_U8) (sizeof(tSirMacAddr))))
246 {
247 limSendAssocRspMgmtFrame(pMac,
248 eSIR_MAC_UNSPEC_FAILURE_STATUS,
249 1,
250 pHdr->sa,
251 subType, 0,psessionEntry);
252 limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as SAP/GO\n"));
253 return ;
254 }
255
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
257 if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
258 {
259 limSendAssocRspMgmtFrame(pMac,
260 eSIR_MAC_MIC_FAILURE_REASON,
261 1,
262 pHdr->sa,
263 subType, 0, psessionEntry);
264 return;
265 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700266
267 // Allocate memory for the Assoc Request frame
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800268 if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocReq, sizeof(*pAssocReq)) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 {
270 limLog(pMac, LOGP, FL("PAL Allocate Memory failed in AssocReq\n"));
271 return;
272 }
273 palZeroMemory( pMac->hHdd, (void *)pAssocReq , sizeof(*pAssocReq));
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800274
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 // Parse Assoc Request frame
276 if (subType == LIM_ASSOC)
277 status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
278 else
279 status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
280
281 if (status != eSIR_SUCCESS)
282 {
283 limLog(pMac, LOGW, FL("Parse error AssocRequest, length=%d from \n"),framelen);
284 limPrintMacAddr(pMac, pHdr->sa, LOGW);
285 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry);
286 goto error;
287 }
288
289 if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocReq->assocReqFrame, framelen) != eHAL_STATUS_SUCCESS)
290 {
291 limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, length=%d from \n"),framelen);
292 goto error;
293 }
294
295 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAssocReq->assocReqFrame,
296 (tANI_U8 *) pBody, framelen);
297 pAssocReq->assocReqFrameLength = framelen;
298
299 if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS)
300 {
301 limLog(pMac, LOGP, FL("could not retrieve Capabilities\n"));
302 goto error;
303 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 limCopyU16((tANI_U8 *) &localCapabilities, temp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700305
306 if (limCompareCapabilities(pMac,
307 pAssocReq,
308 &localCapabilities,psessionEntry) == false)
309 {
310 /**
311 * Capabilities of requesting STA does not match with
312 * local capabilities. Respond with 'unsupported capabilities'
313 * status code.
314 */
315 limSendAssocRspMgmtFrame(
316 pMac,
317 eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
318 1,
319 pHdr->sa,
320 subType, 0,psessionEntry);
321
Mohit Khanna23863762012-09-11 17:40:09 -0700322 limLog(pMac, LOGW, FL("local caps 0x%x received 0x%x\n"), localCapabilities, pAssocReq->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700323
324 // Log error
325 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700326 limLog(pMac, LOGW,
327 FL("received Assoc req with unsupported capabilities "MAC_ADDRESS_STR),
328 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 else
Mohit Khanna23863762012-09-11 17:40:09 -0700330 limLog(pMac, LOGW,
331 FL("received ReAssoc req with unsupported capabilities "MAC_ADDRESS_STR),
332 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 goto error;
334 }
335
336 updateContext = false;
337
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
339 {
340 /**
341 * Received Re/Association Request with either
342 * Broadcast SSID OR with SSID that does not
343 * match with local one.
344 * Respond with unspecified status code.
345 */
346 limSendAssocRspMgmtFrame(pMac,
347 eSIR_MAC_UNSPEC_FAILURE_STATUS,
348 1,
349 pHdr->sa,
350 subType, 0,psessionEntry);
351
352 // Log error
353 if (subType == LIM_ASSOC)
354 limLog(pMac, LOGW,
355 FL("received Assoc req with unmatched SSID from \n"));
356 else
357 limLog(pMac, LOGW,
358 FL("received ReAssoc req with unmatched SSID from \n"));
359 limPrintMacAddr(pMac, pHdr->sa, LOGW);
360 goto error;
361 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700362
363 /***************************************************************
364 ** Verify if the requested rates are available in supported rate
365 ** set or Extended rate set. Some APs are adding basic rates in
366 ** Extended rateset IE
367 ***************************************************************/
368 basicRates.numRates = 0;
369
370 for(i = 0; i < pAssocReq->supportedRates.numRates; i++)
371 {
372 basicRates.rate[i] = pAssocReq->supportedRates.rate[i];
373 basicRates.numRates++;
374 }
375
376 for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++)
377 {
378 basicRates.rate[i] = pAssocReq->extendedRates.rate[j];
379 basicRates.numRates++;
380 }
381 if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
382 {
383 /**
384 * Requesting STA does not support ALL BSS basic
385 * rates. Respond with 'basic rates not supported'
386 * status code.
387 */
388 limSendAssocRspMgmtFrame(
389 pMac,
390 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
391 1,
392 pHdr->sa,
393 subType, 0,psessionEntry);
394
395 // Log error
396 if (subType == LIM_ASSOC)
397 limLog(pMac, LOGW,
398 FL("received Assoc req with unsupported rates from \n"));
399 else
400 limLog(pMac, LOGW,
401 FL("received ReAssoc req with unsupported rates from\n"));
402 limPrintMacAddr(pMac, pHdr->sa, LOGW);
403 goto error;
404 }
405
Jeff Johnson295189b2012-06-20 16:38:30 -0700406
407 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
408 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) &&
409 ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present)))
410 {
411 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
412 1, pHdr->sa, subType, 0, psessionEntry );
413 limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy STA's\n"));
414 goto error;
415
416 }//end if phyMode == 11G_only
417
418 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
419 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) &&
420 (!pAssocReq->HTCaps.present))
421 {
422 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
423 1, pHdr->sa, subType, 0, psessionEntry );
424 limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy STA's\n"));
425 goto error;
426 }//end if PhyMode == 11N_only
427
Jeff Johnson295189b2012-06-20 16:38:30 -0700428
429 /* Spectrum Management (11h) specific checks */
430 if (localCapabilities.spectrumMgt)
431 {
432 tSirRetStatus status = eSIR_SUCCESS;
433
434 /* If station is 11h capable, then it SHOULD send all mandatory
435 * IEs in assoc request frame. Let us verify that
436 */
437 if (pAssocReq->capabilityInfo.spectrumMgt)
438 {
439 if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent)))
440 {
441 /* One or more required information elements are missing, log the peers error */
442 if (!pAssocReq->powerCapabilityPresent)
443 {
444 if(subType == LIM_ASSOC)
445 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability IE in assoc request\n"));
446 else
447 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability IE in Reassoc request\n"));
448 }
449 if (!pAssocReq->supportedChannelsPresent)
450 {
451 if(subType == LIM_ASSOC)
452 limLog(pMac, LOG1, FL("LIM Info: Missing Supported channel IE in assoc request\n"));
453 else
454 limLog(pMac, LOG1, FL("LIM Info: Missing Supported channel IE in Reassoc request\n"));
455 }
456 limPrintMacAddr(pMac, pHdr->sa, LOG1);
457 }
458 else
459 {
460 /* Assoc request has mandatory fields */
461 status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry);
462 if (eSIR_SUCCESS != status)
463 {
464 if (subType == LIM_ASSOC)
465 limLog(pMac, LOGW, FL("LIM Info: Association MinTxPower(STA) > MaxTxPower(AP)\n"));
466 else
467 limLog(pMac, LOGW, FL("LIM Info: Reassociation MinTxPower(STA) > MaxTxPower(AP)\n"));
468 limPrintMacAddr(pMac, pHdr->sa, LOGW);
469 }
470 status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq);
471 if (eSIR_SUCCESS != status)
472 {
473 if (subType == LIM_ASSOC)
474 limLog(pMac, LOGW, FL("LIM Info: Association wrong supported channels (STA)\n"));
475 else
476 limLog(pMac, LOGW, FL("LIM Info: Reassociation wrong supported channels (STA)\n"));
477 limPrintMacAddr(pMac, pHdr->sa, LOGW);
478 }
479 /* IEs are valid, use them if needed */
480 }
481 } //if(assoc.capabilityInfo.spectrumMgt)
482 else
483 {
484 /* As per the capabiities, the spectrum management is not enabled on the station
485 * The AP may allow the associations to happen even if spectrum management is not
486 * allowed, if the transmit power of station is below the regulatory maximum
487 */
488
489 /* TODO: presently, this is not handled. In the current implemetation, the AP would
490 * allow the station to associate even if it doesn't support spectrum management.
491 */
492 }
493 }// end of spectrum management related processing
494
495 if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
496 {
497 /**
498 * Requesting STA does not support ALL BSS MCS basic Rate set rates.
499 * Spec does not define any status code for this scenario.
500 */
501 limSendAssocRspMgmtFrame(
502 pMac,
503 eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS,
504 1,
505 pHdr->sa,
506 subType, 0,psessionEntry);
507
508 // Log error
509 if (subType == LIM_ASSOC)
510 limLog(pMac, LOGW,
511 FL("received Assoc req with unsupported MCS Rate Set from \n"));
512 else
513 limLog(pMac, LOGW,
514 FL("received ReAssoc req with unsupported MCS Rate Set from\n"));
515 limPrintMacAddr(pMac, pHdr->sa, LOGW);
516 goto error;
517 }
518
519 //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G)
520 if (phyMode == WNI_CFG_PHY_MODE_11G)
521 {
522
523 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS)
524 {
525 limLog(pMac, LOGP, FL("could not retrieve 11g-only flag\n"));
526 goto error;
527 }
528
529 if (!pAssocReq->extendedRatesPresent && val)
530 {
531 /**
532 * Received Re/Association Request from
533 * 11b STA when 11g only policy option
534 * is set.
535 * Reject with unspecified status code.
536 */
537 limSendAssocRspMgmtFrame(
538 pMac,
539 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
540 1,
541 pHdr->sa,
542 subType, 0,psessionEntry);
543
544 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from 11b STA: "));
545 limPrintMacAddr(pMac, pHdr->sa, LOGW);
546
547#ifdef WLAN_DEBUG
548 pMac->lim.gLim11bStaAssocRejectCount++;
549#endif
550 goto error;
551 }
552 }
553
554#ifdef WMM_APSD
555 // Save the QOS info element in assoc request..
556 limGetWmeMode(pMac, &wmeMode);
557 if (wmeMode == eHAL_SET)
558 {
559 tpQosInfoSta qInfo;
560
561 qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo);
562
563 if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi))
564 {
565
566 /**
567 * Received Re/Association Request from
568 * 11b STA when 11g only policy option
569 * is set.
570 * Reject with unspecified status code.
571 */
572 limSendAssocRspMgmtFrame(
573 pMac,
574 eSIR_MAC_WME_REFUSED_STATUS,
575 1,
576 pHdr->sa,
577 subType, 0,psessionEntry);
578
579 limLog(pMac, LOGW,
580 FL("Rejecting Re/Assoc req from STA: "));
581 limPrintMacAddr(pMac, pHdr->sa, LOGW);
582 limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x\n"), *qInfo);
583 goto error;
584 }
585 }
586#endif
587
588 // Check for 802.11n HT caps compatibility; are HT Capabilities
589 // turned on in lim?
Jeff Johnsone7245742012-09-05 17:12:55 -0700590 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 {
592 // There are; are they turned on in the STA?
593 if ( pAssocReq->HTCaps.present )
594 {
595 // The station *does* support 802.11n HT capability...
596
597 limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d "
598 "PowerSave:%d greenField:%d "
599 "shortGI20:%d shortGI40:%d\n"
600 "txSTBC:%d rxSTBC:%d delayBA:%d"
601 "maxAMSDUsize:%d DSSS/CCK:%d "
602 "PSMP:%d stbcCntl:%d lsigTXProt:%d\n"),
603 pAssocReq->HTCaps.advCodingCap,
604 pAssocReq->HTCaps.supportedChannelWidthSet,
605 pAssocReq->HTCaps.mimoPowerSave,
606 pAssocReq->HTCaps.greenField,
607 pAssocReq->HTCaps.shortGI20MHz,
608 pAssocReq->HTCaps.shortGI40MHz,
609 pAssocReq->HTCaps.txSTBC,
610 pAssocReq->HTCaps.rxSTBC,
611 pAssocReq->HTCaps.delayedBA,
612 pAssocReq->HTCaps.maximalAMSDUsize,
613 pAssocReq->HTCaps.dsssCckMode40MHz,
614 pAssocReq->HTCaps.psmp,
615 pAssocReq->HTCaps.stbcControlFrame,
616 pAssocReq->HTCaps.lsigTXOPProtection );
617
618 // Make sure the STA's caps are compatible with our own:
619 //11.15.2 Support of DSSS/CCK in 40 MHz
620 //the AP shall refuse association requests from an HT STA that has the DSSS/CCK
621 //Mode in 40 MHz subfield set to 1;
622
623 //FIXME_BTAMP_AP : Need to be enabled
624 /*
625 if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz )
626 {
627 statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS;
628 limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; "
629 "STA rejected.\n" ) );
630 // Reject association
631 limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry);
632 goto error;
633 }
634 */
635 }
636 } // End if on HT caps turned on in lim.
637
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 /* Clear the buffers so that frame parser knows that there isn't a previously decoded IE in these buffers */
639 palZeroMemory( pMac->hHdd, ( tANI_U8* )&Dot11fIERSN, sizeof( Dot11fIERSN ) );
640 palZeroMemory( pMac->hHdd, ( tANI_U8* )&Dot11fIEWPA, sizeof( Dot11fIEWPA ) );
641
642 /* if additional IE is present, check if it has WscIE */
643 if( pAssocReq->addIEPresent && pAssocReq->addIE.length )
644 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
645 /* when wpsIe is present, RSN/WPA IE is ignored */
646 if( wpsIe == NULL )
647 {
648 /** check whether as RSN IE is present */
649 if(psessionEntry->limSystemRole == eLIM_AP_ROLE
650 && psessionEntry->pLimStartBssReq->privacy
651 && psessionEntry->pLimStartBssReq->rsnIE.length)
652 {
653 limLog(pMac, LOGE,
654 FL("AP supports RSN enabled authentication\n"));
655
656 if(pAssocReq->rsnPresent)
657 {
658 if(pAssocReq->rsn.length)
659 {
660 // Unpack the RSN IE
661 dot11fUnpackIeRSN(pMac,
662 &pAssocReq->rsn.info[0],
663 pAssocReq->rsn.length,
664 &Dot11fIERSN);
665
666 /* Check RSN version is supported or not */
667 if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version)
668 {
669 /* check the groupwise and pairwise cipher suites */
670 if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry, pAssocReq->HTCaps.present) ) )
671 {
672 /* some IE is not properly sent */
673 /* received Association req frame with RSN IE but length is 0 */
674 limSendAssocRspMgmtFrame(
675 pMac,
676 status,
677 1,
678 pHdr->sa,
679 subType, 0,psessionEntry);
680
681 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
682 limPrintMacAddr(pMac, pHdr->sa, LOGW);
683 goto error;
684
685 }
686 }
687 else
688 {
689 /* received Association req frame with RSN IE version wrong */
690 limSendAssocRspMgmtFrame(
691 pMac,
692 eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS,
693 1,
694 pHdr->sa,
695 subType, 0,psessionEntry);
696
697 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
698 limPrintMacAddr(pMac, pHdr->sa, LOGW);
699 goto error;
700
701 }
702 }
703 else
704 {
705 /* received Association req frame with RSN IE but length is 0 */
706 limSendAssocRspMgmtFrame(
707 pMac,
708 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
709 1,
710 pHdr->sa,
711 subType, 0,psessionEntry);
712
713 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
714 limPrintMacAddr(pMac, pHdr->sa, LOGW);
715 goto error;
716
717 }
718 } /* end - if(pAssocReq->rsnPresent) */
719 if((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent)
720 {
721 // Unpack the WPA IE
722 if(pAssocReq->wpa.length)
723 {
724 dot11fUnpackIeWPA(pMac,
725 &pAssocReq->wpa.info[4], //OUI is not taken care
726 pAssocReq->wpa.length,
727 &Dot11fIEWPA);
728 /* check the groupwise and pairwise cipher suites */
729 if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present)))
730 {
731 /* received Association req frame with WPA IE but mismatch */
732 limSendAssocRspMgmtFrame(
733 pMac,
734 status,
735 1,
736 pHdr->sa,
737 subType, 0,psessionEntry);
738
739 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
740 limPrintMacAddr(pMac, pHdr->sa, LOGW);
741 goto error;
742
743 }
744 }
745 else
746 {
747 /* received Association req frame with invalid WPA IE */
748 limSendAssocRspMgmtFrame(
749 pMac,
750 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
751 1,
752 pHdr->sa,
753 subType, 0,psessionEntry);
754
755 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
756 limPrintMacAddr(pMac, pHdr->sa, LOGW);
757 goto error;
758 }/* end - if(pAssocReq->wpa.length) */
759 } /* end - if(pAssocReq->wpaPresent) */
760 } /* end of if(psessionEntry->pLimStartBssReq->privacy
761 && psessionEntry->pLimStartBssReq->rsnIE->length) */
762
763 } /* end of if( ! pAssocReq->wscInfo.present ) */
Jeff Johnson295189b2012-06-20 16:38:30 -0700764
765 /**
766 * Extract 'associated' context for STA, if any.
767 * This is maintained by DPH and created by LIM.
768 */
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800769 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700770
771 /// Extract pre-auth context for the STA, if any.
772 pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa);
773
774 if (pStaDs == NULL)
775 {
776 /// Requesting STA is not currently associated
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800777 if (peGetCurrentSTAsCount(pMac) == pMac->lim.maxStation)
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 {
779 /**
780 * Maximum number of STAs that AP can handle reached.
781 * Send Association response to peer MAC entity
782 */
783 limRejectAssociation(pMac, pHdr->sa,
784 subType, false,
785 (tAniAuthType) 0, 0,
786 false,
787 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
788
789 goto error;
790 }
791
792 /// Check if STA is pre-authenticated.
793 if ((pStaPreAuthContext == NULL) ||
794 (pStaPreAuthContext &&
795 (pStaPreAuthContext->mlmState !=
796 eLIM_MLM_AUTHENTICATED_STATE)))
797 {
798 /**
799 * STA is not pre-authenticated yet requesting
800 * Re/Association before Authentication.
801 * OR STA is in the process of getting authenticated
802 * and sent Re/Association request.
803 * Send Deauthentication frame with 'prior
804 * authentication required' reason code.
805 */
806 limSendDeauthMgmtFrame(
807 pMac,
808 eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800809 pHdr->sa, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700810
811 // Log error
812 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700813 limLog(pMac, LOGW,
814 FL("received Assoc req from STA that does not have pre-auth context "MAC_ADDRESS_STR),
815 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 else
Mohit Khanna23863762012-09-11 17:40:09 -0700817 limLog(pMac, LOGW,
818 FL("received ReAssoc req from STA that does not have pre-auth context "
819 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 goto error;
821 }
822
823 /// Delete 'pre-auth' context of STA
824 authType = pStaPreAuthContext->authType;
825 limDeletePreAuthNode(pMac, pHdr->sa);
826
827 // All is well. Assign AID (after else part)
828
829 } // if (pStaDs == NULL)
830 else
831 {
832 // STA context does exist for this STA
833
834 if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
835 {
836 /**
837 * Requesting STA is in some 'transient' state?
838 * Ignore the Re/Assoc Req frame by incrementing
839 * debug counter & logging error.
840 */
841 if (subType == LIM_ASSOC)
842 {
843
844#ifdef WLAN_DEBUG
845 pMac->lim.gLimNumAssocReqDropInvldState++;
846#endif
847 limLog(pMac, LOG1, FL("received Assoc req in state %X from "), pStaDs->mlmStaContext.mlmState);
848 }
849 else
850 {
851#ifdef WLAN_DEBUG
852 pMac->lim.gLimNumReassocReqDropInvldState++;
853#endif
854 limLog(pMac, LOG1, FL("received ReAssoc req in state %X from "), pStaDs->mlmStaContext.mlmState);
855 }
856 limPrintMacAddr(pMac, pHdr->sa, LOG1);
857 limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -0700858
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 goto error;
860 } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
861
862 /**
863 * STA sent Re/Association Request frame while already in
864 * 'associated' state. Update STA capabilities and
865 * send Association response frame with same AID
866 */
867
868 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
869
870 if (pStaPreAuthContext &&
871 (pStaPreAuthContext->mlmState ==
872 eLIM_MLM_AUTHENTICATED_STATE))
873 {
874 /// STA has triggered pre-auth again
875 authType = pStaPreAuthContext->authType;
876 limDeletePreAuthNode(pMac, pHdr->sa);
877 }
878 else
879 authType = pStaDs->mlmStaContext.authType;
880
881 updateContext = true;
882
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800883 if (dphInitStaState(pMac, pHdr->sa, peerIdx, true, &psessionEntry->dph.dphHashTable) == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700884 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800885 limLog(pMac, LOGE, FL("could not Init STAid=%d\n"), peerIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 goto error;
887 }
888
889
890 goto sendIndToSme;
891 } // end if (lookup for STA in perStaDs fails)
892
893
894
895 // check if sta is allowed per QoS AC rules
896 //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled)
897 limGetWmeMode(psessionEntry, &wmeMode);
898 if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET))
899 {
900 // for a qsta, check if the requested Traffic spec
901 // is admissible
902 // for a non-qsta check if the sta can be admitted
903 if (pAssocReq->addtsPresent)
904 {
905 tANI_U8 tspecIdx = 0; //index in the sch tspec table.
906 if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
907 &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
908 {
909 limLog(pMac, LOGW, FL("AdmitControl: TSPEC rejected\n"));
910 limSendAssocRspMgmtFrame(
911 pMac,
912 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
913 1,
914 pHdr->sa,
915 subType, 0,psessionEntry);
916#ifdef WLAN_DEBUG
917 pMac->lim.gLimNumAssocReqDropACRejectTS++;
918#endif
919 goto error;
920 }
921 }
922 else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
923 != eSIR_SUCCESS)
924 {
925 limLog(pMac, LOGW, FL("AdmitControl: Sta rejected\n"));
926 limSendAssocRspMgmtFrame(
927 pMac,
928 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
929 1,
930 pHdr->sa,
931 subType, 0,psessionEntry);
932#ifdef WLAN_DEBUG
933 pMac->lim.gLimNumAssocReqDropACRejectSta++;
934#endif
935 goto error;
936 }
937
938 // else all ok
939 limLog(pMac, LOG1, FL("AdmitControl: Sta OK!\n"));
940 }
941
942 /**
943 * STA is Associated !
944 */
945 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700946 limLog(pMac, LOGW, FL("received Assoc req successful "MAC_ADDRESS_STR),
947 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 else
Mohit Khanna23863762012-09-11 17:40:09 -0700949 limLog(pMac, LOGW, FL("received ReAssoc req successful"MAC_ADDRESS_STR),
950 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700951
952 /**
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800953 * AID for this association will be same as the peer Index used in DPH table.
954 * Assign unused/least recently used peer Index from perStaDs.
955 * NOTE: limAssignPeerIdx() assigns AID values ranging
956 * between 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT)
Jeff Johnson295189b2012-06-20 16:38:30 -0700957 */
958
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800959 peerIdx = limAssignPeerIdx(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700960
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800961 if (!peerIdx)
Jeff Johnson295189b2012-06-20 16:38:30 -0700962 {
963 // Could not assign AID
964 // Reject association
965 limRejectAssociation(pMac, pHdr->sa,
966 subType, true, authType,
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800967 peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
969
970 goto error;
971 }
972
973 /**
974 * Add an entry to hash table maintained by DPH module
975 */
976
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800977 pStaDs = dphAddHashEntry(pMac, pHdr->sa, peerIdx, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700978
979 if (pStaDs == NULL)
980 {
981 // Could not add hash table entry at DPH
982 limLog(pMac, LOGE,
983 FL("could not add hash entry at DPH for aid=%d, MacAddr:\n"),
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800984 peerIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700985 limPrintMacAddr(pMac, pHdr->sa, LOGE);
986
987 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800988 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700989
990 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800991 subType, true, authType, peerIdx, false,
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
993
994 goto error;
995 }
996
997
998sendIndToSme:
999
1000 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1001
1002 pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
Jeff Johnsone7245742012-09-05 17:12:55 -07001003#ifdef WLAN_FEATURE_11AC
1004 pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
1005#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
1007 pStaDs->qos.addts = pAssocReq->addtsReq;
1008 pStaDs->qos.capability = pAssocReq->qosCapability;
1009 pStaDs->versionPresent = 0;
1010 /* short slot and short preamble should be updated before doing limaddsta */
1011 pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble;
1012 pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime;
1013
1014 if (pAssocReq->propIEinfo.versionPresent) //update STA version info
1015 {
1016 pStaDs->versionPresent = 1;
1017 pStaDs->version = pAssocReq->propIEinfo.version;
1018 }
1019 pStaDs->propCapability = 0;
1020 if (pAssocReq->propIEinfo.capabilityPresent)
1021 {
1022 if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability))
1023 pStaDs->propCapability &= pAssocReq->propIEinfo.capability;
1024 }
1025
1026 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
1027 pStaDs->valid = 0;
1028 pStaDs->mlmStaContext.authType = authType;
1029 pStaDs->staType = STA_ENTRY_PEER;
1030
1031 //TODO: If listen interval is more than certain limit, reject the association.
1032 //Need to check customer requirements and then implement.
1033 pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval;
1034 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1035
1036 /* The following count will be used to knock-off the station if it doesn't
1037 * come back to receive the buffered data. The AP will wait for numTimSent number
1038 * of beacons after sending TIM information for the station, before assuming that
1039 * the station is no more associated and disassociates it
1040 */
1041
1042 /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
1043 pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval);
1044
1045 /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */
1046 pStaDs->curTxMpduCnt = 0;
1047
1048 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
1049 (pAssocReq->HTCaps.present))
1050 {
1051 pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField;
1052 pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity;
1053 pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz;
1054 pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection;
1055 pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
1056 pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
1057 pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
1058 pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
1059 pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
1060 pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07001061 /* 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
1062 * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
1063 */
1064 pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
1065#ifdef WLAN_FEATURE_11AC
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07001066 if(pAssocReq->operMode.present)
1067 {
1068 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pAssocReq->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
1069 pStaDs->htSupportedChannelWidthSet = (tANI_U8)(pAssocReq->operMode.chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
1070 }
1071 else if (pAssocReq->VHTCaps.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07001072 {
Madan Mohan Koyyalamudi740f7802012-09-24 14:17:14 -07001073 // Check if STA has enabled it's channel bonding mode.
1074 // If channel bonding mode is enabled, we decide based on SAP's current configuration.
1075 // else, we set it to VHT20.
1076 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pStaDs->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ?
1077 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
1078 psessionEntry->vhtTxChannelWidthSet );
Jeff Johnsone7245742012-09-05 17:12:55 -07001079 }
Madan Mohan Koyyalamudicc394402012-10-05 10:48:19 -07001080
1081 // Lesser among the AP and STA bandwidth of operation.
1082 pStaDs->htSupportedChannelWidthSet =
1083 (pStaDs->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1084 pStaDs->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1085
Jeff Johnsone7245742012-09-05 17:12:55 -07001086#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 pStaDs->baPolicyFlag = 0xFF;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001088 pStaDs->htLdpcCapable = (tANI_U8)pAssocReq->HTCaps.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -07001089 }
1090
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001091 if(pAssocReq->VHTCaps.present)
1092 {
1093 pStaDs->vhtLdpcCapable = (tANI_U8)pAssocReq->VHTCaps.ldpcCodingCap;
1094 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001095
Jeff Johnsone7245742012-09-05 17:12:55 -07001096#ifdef WLAN_FEATURE_11AC
1097if (limPopulateMatchingRateSet(pMac,
1098 pStaDs,
1099 &(pAssocReq->supportedRates),
1100 &(pAssocReq->extendedRates),
1101 pAssocReq->HTCaps.supportedMCSSet,
1102 &(pAssocReq->propIEinfo.propRates),
1103 psessionEntry , &pAssocReq->VHTCaps)
1104 != eSIR_SUCCESS)
1105#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001106
1107 if (limPopulateMatchingRateSet(pMac,
1108 pStaDs,
1109 &(pAssocReq->supportedRates),
1110 &(pAssocReq->extendedRates),
1111 pAssocReq->HTCaps.supportedMCSSet,
1112 &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -07001113#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 {
1115 // Could not update hash table entry at DPH with rateset
1116 limLog(pMac, LOGE,
1117 FL("could not update hash entry at DPH for aid=%d, MacAddr:\n"),
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001118 peerIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07001119 limPrintMacAddr(pMac, pHdr->sa, LOGE);
1120
1121 // Release AID
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001122 limReleasePeerIdx(pMac, peerIdx, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001123
1124
1125 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001126 subType, true, authType, peerIdx, true,
Jeff Johnson295189b2012-06-20 16:38:30 -07001127 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1128
1129 /*return it from here rather than goto error statement.This is done as the memory is getting free twice*/
1130 return;
1131 //goto error;
1132 }
1133
1134 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
1135 (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
1136 pAssocReq->propIEinfo.propRates.numPropRates + 1);
1137
1138 /// Add STA context at MAC HW (BMU, RHP & TFP)
1139
1140 pStaDs->qosMode = eANI_BOOLEAN_FALSE;
1141 pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
1142 if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
1143 {
1144 pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
1145 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1146 }
1147
1148 pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
1149 pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
1150 limGetWmeMode(psessionEntry, &wmeMode);
1151 //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
1152 if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
1153 {
1154 pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
1155 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1156 limGetWsmMode(psessionEntry, &wsmMode);
1157 /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
1158 can coexist */
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 if( pAssocReq->WMMInfoStation.present)
1160 {
1161 /* check whether AP supports or not */
1162 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
1163 && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
1164 || pAssocReq->WMMInfoStation.acbk_uapsd
1165 || pAssocReq->WMMInfoStation.acvo_uapsd
1166 || pAssocReq->WMMInfoStation.acvi_uapsd))
1167 {
1168
1169 /**
1170 * Received Re/Association Request from
1171 * STA when UPASD is not supported.
1172 */
1173 limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed\n" ));
1174 limRejectAssociation(pMac, pHdr->sa,
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001175 subType, true, authType, peerIdx, true,
Jeff Johnson295189b2012-06-20 16:38:30 -07001176 (tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1177
1178
1179 /*return it from here rather than goto error statement.This is done as the memory is getting free twice in this uapsd scenario*/
1180 return;
1181 //goto error;
1182 }
1183 else
1184 {
1185 /* update UAPSD and send it to LIM to add STA */
1186 pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
1187 pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
1188 pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
1189 pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
1190 pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
1191 }
1192 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
1194 if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
1195 pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
1196
1197 }
1198
1199 // Re/Assoc Response frame to requesting STA
1200 pStaDs->mlmStaContext.subType = subType;
1201
1202 if (pAssocReq->propIEinfo.aniIndicator)
1203 pStaDs->aniPeer = 1;
1204
1205 // BTAMP: Storing the parsed assoc request in the psessionEntry array
1206 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1207
1208 /* BTAMP: If STA context already exist (ie. updateContext = 1)
1209 * for this STA, then we should delete the old one, and add
1210 * the new STA. This is taken care of in the limDelSta() routine.
1211 *
1212 * Prior to BTAMP, we were setting this flag so that when
1213 * PE receives SME_ASSOC_CNF, and if this flag is set, then
1214 * PE shall delete the old station and then add. But now in
1215 * BTAMP, we're directly adding station before waiting for
1216 * SME_ASSOC_CNF, so we can do this now.
1217 */
1218 if (!updateContext)
1219 {
1220 pStaDs->mlmStaContext.updateContext = 0;
1221
1222 // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001223 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001224 {
1225 limLog(pMac, LOGE, FL("could not Add STA with assocId=%d\n"), pStaDs->assocId);
1226 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
1227 true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
1228 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1229
1230 /*return it from here rather than goto error statement.This is done as the memory is getting free twice*/
1231 return;
1232 //goto error;
1233 }
1234 }
1235 else
1236 {
1237 pStaDs->mlmStaContext.updateContext = 1;
1238
Jeff Johnson295189b2012-06-20 16:38:30 -07001239 mlmPrevState = pStaDs->mlmStaContext.mlmState;
1240
1241 /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
1242 if(subType != LIM_REASSOC)
1243 {
1244 //we need to set the mlmState here in order differentiate in limDelSta.
1245 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
1246 if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
1247 {
1248 limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d\n"), pStaDs->assocId, pStaDs->staIndex);
1249 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1250 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1251
1252 //Restoring the state back.
1253 pStaDs->mlmStaContext.mlmState = mlmPrevState;
1254 goto error;
1255 }
1256 }
1257 else
1258 {
1259 /* mlmState is changed in limAddSta context */
1260 /* use the same AID, already allocated */
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001261 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001262 {
1263 limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed\n" ));
1264 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1265 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1266
1267 //Restoring the state back.
1268 pStaDs->mlmStaContext.mlmState = mlmPrevState;
1269 goto error;
1270 }
1271
1272 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001273
1274 }
1275
1276 return;
1277
1278error:
1279 if (pAssocReq != NULL)
1280 {
1281 if ( pAssocReq->assocReqFrame )
1282 {
1283 palFreeMemory(pMac->hHdd, pAssocReq->assocReqFrame);
1284 pAssocReq->assocReqFrame = NULL;
1285 }
1286
1287 if (palFreeMemory(pMac->hHdd, pAssocReq) != eHAL_STATUS_SUCCESS)
1288 {
1289 limLog(pMac, LOGP, FL("PalFree Memory failed \n"));
1290 return;
1291 }
1292 }
1293
Jeff Johnsone7245742012-09-05 17:12:55 -07001294 /* If it is not duplicate Assoc request then only make to Null */
1295 if ((pStaDs != NULL) &&
1296 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001298
Jeff Johnson295189b2012-06-20 16:38:30 -07001299 return;
1300
1301} /*** end limProcessAssocReqFrame() ***/
1302
1303
1304
1305/**---------------------------------------------------------------
1306\fn limSendMlmAssocInd
1307\brief This function sends either LIM_MLM_ASSOC_IND
1308\ or LIM_MLM_REASSOC_IND to SME.
1309\
1310\param pMac
1311\param *pStaDs - Station DPH hash entry
1312\param psessionEntry - PE session entry
1313\return None
1314
1315 * ?????? How do I get
1316 * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
1317 * - aid =====> pStaDs->assocId
1318 * - pHdr->sa =====> pStaDs->staAddr
1319 * - authType
1320 * - pHdr->seqControl =====> no longer needed
1321 * - pStaDs
1322------------------------------------------------------------------*/
1323void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1324{
1325 tpLimMlmAssocInd pMlmAssocInd = NULL;
1326 tpLimMlmReassocInd pMlmReassocInd;
1327 tpSirAssocReq pAssocReq;
1328 tANI_U16 temp;
1329 tANI_U32 phyMode;
1330 tANI_U8 subType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 tANI_U8 *wpsIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 tANI_U32 tmp;
1333// tANI_U16 statusCode;
1334 tANI_U16 i, j=0;
1335
1336 // Get a copy of the already parsed Assoc Request
1337 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
1338
1339 // Get the phyMode
1340 limGetPhyMode(pMac, &phyMode, psessionEntry);
1341
1342 // Extract pre-auth context for the peer BTAMP-STA, if any.
1343
1344 // Determiine if its Assoc or ReAssoc Request
1345 if (pAssocReq->reassocRequest == 1)
1346 subType = LIM_REASSOC;
1347 else
1348 subType = LIM_ASSOC;
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 if (subType == LIM_ASSOC || subType == LIM_REASSOC)
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 {
1351 temp = sizeof(tLimMlmAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001352
1353 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAssocInd, temp))
1354 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001355 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 limLog(pMac, LOGP, FL("palAllocateMemory failed for pMlmAssocInd\n"));
1357 return;
1358 }
1359 palZeroMemory( pMac->hHdd, pMlmAssocInd, temp);
1360
1361 palCopyMemory( pMac->hHdd,(tANI_U8 *)pMlmAssocInd->peerMacAddr,(tANI_U8 *)pStaDs->staAddr,sizeof(tSirMacAddr));
1362
1363 pMlmAssocInd->aid = pStaDs->assocId;
1364 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pMlmAssocInd->ssId,(tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
1365 pMlmAssocInd->sessionId = psessionEntry->peSessionId;
1366 pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
1367
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
1369
1370 // Fill in RSN IE information
1371 pMlmAssocInd->rsnIE.length = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001372 // if WPS IE is present, ignore RSN IE
1373 if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
1374 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1375 }
1376 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001377 {
1378 limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d\n"), pAssocReq->rsn.length);
1379 pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1380 pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1381 pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
1382 palCopyMemory( pMac->hHdd,
1383 &pMlmAssocInd->rsnIE.rsnIEdata[2],
1384 pAssocReq->rsn.info,
1385 pAssocReq->rsn.length);
1386 }
1387
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 // Fill in 802.11h related info
1389 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1390 {
1391 pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
1392 pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1393 pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1394 limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
1395 }
1396 else
1397 pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
1398
1399
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 /* This check is to avoid extra Sec IEs present incase of WPS */
1401 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 {
1403 if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
1404 {
1405 PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d\n"), pMlmAssocInd->rsnIE.length);)
1406 return;
1407 }
1408 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1409 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
1410 palCopyMemory( pMac->hHdd,
1411 &pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
1412 pAssocReq->wpa.info,
1413 pAssocReq->wpa.length);
1414 pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1415 }
1416
1417
1418 pMlmAssocInd->addIE.length = 0;
1419 if (pAssocReq->addIEPresent)
1420 {
1421 palCopyMemory( pMac->hHdd,
1422 &pMlmAssocInd->addIE.addIEdata,
1423 pAssocReq->addIE.addIEdata,
1424 pAssocReq->addIE.length);
1425
1426 pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
1427 }
1428
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 if(pAssocReq->wmeInfoPresent)
1430 {
1431
1432 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
1433 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d\n"), WNI_CFG_WME_ENABLED );
1434
1435 /* check whether AP is enabled with WMM */
1436 if(tmp)
1437 {
1438 pMlmAssocInd->WmmStaInfoPresent = 1;
1439 }
1440 else
1441 {
1442 pMlmAssocInd->WmmStaInfoPresent= 0;
1443 }
1444 /* Note: we are not rejecting association here because IOT will fail */
1445
1446 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001447
1448 // Required for indicating the frames to upper layer
1449 pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1450 pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
1451
1452 pMlmAssocInd->beaconPtr = psessionEntry->beacon;
1453 pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
1454
1455 limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
1456 palFreeMemory( pMac->hHdd, pMlmAssocInd);
1457 }
1458 else
1459 {
1460 // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
1461 temp = sizeof(tLimMlmReassocInd);
1462
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocInd, temp))
1464 {
1465 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pMlmReassocInd\n"));
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001466 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 return;
1468 }
1469 palZeroMemory( pMac->hHdd, pMlmReassocInd, temp);
1470
1471 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmReassocInd->peerMacAddr, (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
1472 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmReassocInd->currentApAddr, (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
1473 pMlmReassocInd->aid = pStaDs->assocId;
1474 pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
1475 palCopyMemory( pMac->hHdd,(tANI_U8 *)&pMlmReassocInd->ssId, (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
1476
Jeff Johnson295189b2012-06-20 16:38:30 -07001477 if (pAssocReq->propIEinfo.aniIndicator)
1478 pStaDs->aniPeer = 1;
1479
1480 pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
1481 pMlmReassocInd->rsnIE.length = 0;
1482
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
1484 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1485
1486 if (pAssocReq->rsnPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 {
1488 limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d\n"), pAssocReq->rsn.length);
1489 pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1490 pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1491 pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
1492 palCopyMemory( pMac->hHdd, &pMlmReassocInd->rsnIE.rsnIEdata[2], pAssocReq->rsn.info, pAssocReq->rsn.length);
1493 }
1494
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 // 802.11h support
1496 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1497 {
1498 pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
1499 pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1500 pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1501 pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
1502
1503 limLog(pMac, LOG1,
1504 FL("Sending Reassoc Ind: spectrum ON, minPwr %d, maxPwr %d, numChnl %d\n"),
1505 pMlmReassocInd->powerCap.minTxPower,
1506 pMlmReassocInd->powerCap.maxTxPower,
1507 pMlmReassocInd->supportedChannels.numChnl);
1508
1509 for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
1510 {
1511 pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
1512 limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d \n"),
1513 i, pMlmReassocInd->supportedChannels.channelList[i]);
1514 j+=2;
1515 }
1516 }
1517 else
1518 pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
1519
1520
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 /* This check is to avoid extra Sec IEs present incase of WPS */
1522 if (pAssocReq->wpaPresent && (NULL == wpsIe))
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 {
1524 limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d\n"), pAssocReq->wpa.length);
1525 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1526 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
1527 palCopyMemory( pMac->hHdd,
1528 &pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
1529 pAssocReq->wpa.info,
1530 pAssocReq->wpa.length);
1531 pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1532 }
1533
1534 pMlmReassocInd->addIE.length = 0;
1535 if (pAssocReq->addIEPresent)
1536 {
1537 palCopyMemory( pMac->hHdd,
1538 &pMlmReassocInd->addIE.addIEdata,
1539 pAssocReq->addIE.addIEdata,
1540 pAssocReq->addIE.length);
1541
1542 pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
1543 }
1544
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 if(pAssocReq->wmeInfoPresent)
1546 {
1547
1548 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
1549 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d\n"), WNI_CFG_WME_ENABLED );
1550
1551 /* check whether AP is enabled with WMM */
1552 if(tmp)
1553 {
1554 pMlmReassocInd->WmmStaInfoPresent = 1;
1555 }
1556 else
1557 {
1558 pMlmReassocInd->WmmStaInfoPresent = 0;
1559 }
1560 /* Note: we are not rejecting Re-association here because IOT will fail */
1561
1562 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001563
1564 // Required for indicating the frames to upper layer
1565 pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1566 pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
1567
1568 pMlmReassocInd->beaconPtr = psessionEntry->beacon;
1569 pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
1570
1571 limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
1572 palFreeMemory( pMac->hHdd, pMlmReassocInd);
1573 }
1574
1575 return;
1576
1577} /*** end limSendMlmAssocInd() ***/