blob: e318bad777dc238b785dec38b530abd047d30a6d [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file limProcessAssocReqFrame.cc contains the code
25 * for processing Re/Association Request Frame.
26 * Author: Chandra Modumudi
27 * Date: 03/18/02
28 * History:-
29 * Date Modified by Modification Information
30 * --------------------------------------------------------------------
31 * 05/26/10 js WPA handling in (Re)Assoc frames
32 *
33 */
34#include "palTypes.h"
35#include "aniGlobal.h"
36#include "wniCfgAp.h"
37#include "sirApi.h"
38#include "cfgApi.h"
39
40#include "schApi.h"
41#include "pmmApi.h"
42#include "utilsApi.h"
43#include "limTypes.h"
44#include "limUtils.h"
45#include "limAssocUtils.h"
46#include "limSecurityUtils.h"
47#include "limSerDesUtils.h"
48#include "limStaHashApi.h"
49#include "limAdmitControl.h"
50#include "palApi.h"
51
52
53#include "vos_types.h"
54/**
55 * limConvertSupportedChannels
56 *
57 *FUNCTION:
58 * This function is called by limProcessAssocReqFrame() to
59 * parse the channel support IE in the Assoc/Reassoc Request
60 * frame, and send relevant information in the SME_ASSOC_IND
61 *
62 *NOTE:
63 *
64 * @param pMac - A pointer to Global MAC structure
65 * @param pMlmAssocInd - A pointer to SME ASSOC/REASSOC IND
66 * @param assocReq - A pointer to ASSOC/REASSOC Request frame
67 *
68 * @return None
69 */
70static void
71limConvertSupportedChannels(tpAniSirGlobal pMac,
72 tpLimMlmAssocInd pMlmAssocInd,
73 tSirAssocReq *assocReq)
74{
75
76 tANI_U16 i, j, index=0;
77 tANI_U8 firstChannelNumber;
78 tANI_U8 numberOfChannel;
79 tANI_U8 nextChannelNumber;
80
81 if(assocReq->supportedChannels.length >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
82 {
83 limLog(pMac, LOG1, FL("Number of supported channels:%d is more than MAX\n"),
84 assocReq->supportedChannels.length);
85 pMlmAssocInd->supportedChannels.numChnl = 0;
86 return;
87 }
88
89 for(i=0; i < (assocReq->supportedChannels.length); i++)
90 {
91 // Get First Channel Number
92 firstChannelNumber = assocReq->supportedChannels.supportedChannels[i];
93 pMlmAssocInd->supportedChannels.channelList[index] = firstChannelNumber;
94 i++;
95 index++;
96 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
97 {
98 pMlmAssocInd->supportedChannels.numChnl = 0;
99 return;
100 }
101 // Get Number of Channels in a Subband
102 numberOfChannel = assocReq->supportedChannels.supportedChannels[i];
103 PELOG2(limLog(pMac, LOG2, FL("Rcv AssocReq: chnl=%d, numOfChnl=%d \n"),
104 firstChannelNumber, numberOfChannel);)
105
106 if (numberOfChannel > 1)
107 {
108 nextChannelNumber = firstChannelNumber;
109 if(SIR_BAND_5_GHZ == limGetRFBand(firstChannelNumber))
110 {
111 for (j=1; j < numberOfChannel; j++)
112 {
113 nextChannelNumber += SIR_11A_FREQUENCY_OFFSET;
114 pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
115 index++;
116 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
117 {
118 pMlmAssocInd->supportedChannels.numChnl = 0;
119 return;
120 }
121 }
122 }
123 else if(SIR_BAND_2_4_GHZ == limGetRFBand(firstChannelNumber))
124 {
125 for (j=1; j < numberOfChannel; j++)
126 {
127 nextChannelNumber += SIR_11B_FREQUENCY_OFFSET;
128 pMlmAssocInd->supportedChannels.channelList[index] = nextChannelNumber;
129 index++;
130 if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST)
131 {
132 pMlmAssocInd->supportedChannels.numChnl = 0;
133 return;
134 }
135 }
136 }
137 }
138 }
139
140 pMlmAssocInd->supportedChannels.numChnl = (tANI_U8) index;
141 PELOG2(limLog(pMac, LOG2,
142 FL("Send AssocInd to WSM: spectrum ON, minPwr %d, maxPwr %d, numChnl %d\n"),
143 pMlmAssocInd->powerCap.minTxPower,
144 pMlmAssocInd->powerCap.maxTxPower,
145 pMlmAssocInd->supportedChannels.numChnl);)
146}
147
148
149/**---------------------------------------------------------------
150\fn limProcessAssocReqFrame
151\brief This function is called by limProcessMessageQueue()
152\ upon Re/Association Request frame reception in
153\ BTAMP AP or Soft AP role.
154\
155\param pMac
156\param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs
157\param subType - Indicates whether it is Association Request(=0)
158\ or Reassociation Request(=1) frame
159\return None
160------------------------------------------------------------------*/
161void
162limProcessAssocReqFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,
163 tANI_U8 subType, tpPESession psessionEntry)
164{
165 tANI_U8 updateContext;
166 tANI_U8 *pBody;
167 tANI_U16 aid, temp;
168 tANI_U32 val;
169 tANI_S32 framelen;
170 tSirRetStatus status;
171 tpSirMacMgmtHdr pHdr;
172 struct tLimPreAuthNode *pStaPreAuthContext;
173 tAniAuthType authType;
174 tSirMacCapabilityInfo localCapabilities;
175 tpDphHashNode pStaDs = NULL;
176 tpSirAssocReq pAssocReq;
177#ifdef WLAN_SOFTAP_FEATURE
178 tLimMlmStates mlmPrevState;
179 tDot11fIERSN Dot11fIERSN;
180 tDot11fIEWPA Dot11fIEWPA;
181#endif
182 tANI_U32 phyMode;
183 tHalBitVal qosMode;
184 tHalBitVal wsmMode, wmeMode;
185 tANI_U8 *wpsIe = NULL;
186 tSirMacRateSet basicRates;
187 tANI_U8 i = 0, j = 0;
188
189 limGetPhyMode(pMac, &phyMode, psessionEntry);
190
191 limGetQosMode(psessionEntry, &qosMode);
192
193 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
194 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
195
196 if (psessionEntry->limSystemRole == eLIM_STA_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE )
197 {
198 limLog(pMac, LOGE, FL("received unexpected ASSOC REQ subType=%d for role=%d, radioId=%d from \n"),
199 subType, psessionEntry->limSystemRole, pMac->sys.gSirRadioId);
200 limPrintMacAddr(pMac, pHdr->sa, LOGE);
201 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
202 WDA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen);
203 return;
204 }
205
206 // Get pointer to Re/Association Request frame body
207 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
208
209 if (limIsGroupAddr(pHdr->sa))
210 {
211 // Received Re/Assoc Req frame from a BC/MC address
212 // Log error and ignore it
213 if (subType == LIM_ASSOC)
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700214 limLog(pMac, LOGW, FL("received Assoc frame from a BC/MC address "MAC_ADDRESS_STR),
Mohit Khanna23863762012-09-11 17:40:09 -0700215 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700216 else
Mohit Khanna23863762012-09-11 17:40:09 -0700217 limLog(pMac, LOGW, FL("received ReAssoc frame from a BC/MC address "MAC_ADDRESS_STR),
218 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700219 return;
220 }
Mohit Khanna23863762012-09-11 17:40:09 -0700221 limLog(pMac, LOGW, FL("Received AssocReq Frame: "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));
222
Jeff Johnson295189b2012-06-20 16:38:30 -0700223 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
224
Jeff Johnsone7245742012-09-05 17:12:55 -0700225 if( palEqualMemory( pMac->hHdd, (tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da,
226 (tANI_U8) (sizeof(tSirMacAddr))))
227 {
228 limSendAssocRspMgmtFrame(pMac,
229 eSIR_MAC_UNSPEC_FAILURE_STATUS,
230 1,
231 pHdr->sa,
232 subType, 0,psessionEntry);
233 limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as SAP/GO\n"));
234 return ;
235 }
236
Jeff Johnson295189b2012-06-20 16:38:30 -0700237#ifdef WLAN_SOFTAP_FEATURE
238 // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
239 if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
240 {
241 limSendAssocRspMgmtFrame(pMac,
242 eSIR_MAC_MIC_FAILURE_REASON,
243 1,
244 pHdr->sa,
245 subType, 0, psessionEntry);
246 return;
247 }
248#endif
249
250 // Allocate memory for the Assoc Request frame
251 if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocReq, sizeof(*pAssocReq)) != eHAL_STATUS_SUCCESS)
252 {
253 limLog(pMac, LOGP, FL("PAL Allocate Memory failed in AssocReq\n"));
254 return;
255 }
256 palZeroMemory( pMac->hHdd, (void *)pAssocReq , sizeof(*pAssocReq));
257
258 // Parse Assoc Request frame
259 if (subType == LIM_ASSOC)
260 status = sirConvertAssocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
261 else
262 status = sirConvertReassocReqFrame2Struct(pMac, pBody, framelen, pAssocReq);
263
264 if (status != eSIR_SUCCESS)
265 {
266 limLog(pMac, LOGW, FL("Parse error AssocRequest, length=%d from \n"),framelen);
267 limPrintMacAddr(pMac, pHdr->sa, LOGW);
268 limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry);
269 goto error;
270 }
271
272 if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocReq->assocReqFrame, framelen) != eHAL_STATUS_SUCCESS)
273 {
274 limLog(pMac, LOGE, FL("Unable to allocate memory for the assoc req, length=%d from \n"),framelen);
275 goto error;
276 }
277
278 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAssocReq->assocReqFrame,
279 (tANI_U8 *) pBody, framelen);
280 pAssocReq->assocReqFrameLength = framelen;
281
282 if (cfgGetCapabilityInfo(pMac, &temp,psessionEntry) != eSIR_SUCCESS)
283 {
284 limLog(pMac, LOGP, FL("could not retrieve Capabilities\n"));
285 goto error;
286 }
287#if defined(ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
288 *(tANI_U16*)&localCapabilities=(tANI_U16)(temp);
289#else
290 limCopyU16((tANI_U8 *) &localCapabilities, temp);
291#endif
292
293 if (limCompareCapabilities(pMac,
294 pAssocReq,
295 &localCapabilities,psessionEntry) == false)
296 {
297 /**
298 * Capabilities of requesting STA does not match with
299 * local capabilities. Respond with 'unsupported capabilities'
300 * status code.
301 */
302 limSendAssocRspMgmtFrame(
303 pMac,
304 eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
305 1,
306 pHdr->sa,
307 subType, 0,psessionEntry);
308
Mohit Khanna23863762012-09-11 17:40:09 -0700309 limLog(pMac, LOGW, FL("local caps 0x%x received 0x%x\n"), localCapabilities, pAssocReq->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700310
311 // Log error
312 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700313 limLog(pMac, LOGW,
314 FL("received Assoc req with unsupported capabilities "MAC_ADDRESS_STR),
315 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 else
Mohit Khanna23863762012-09-11 17:40:09 -0700317 limLog(pMac, LOGW,
318 FL("received ReAssoc req with unsupported capabilities "MAC_ADDRESS_STR),
319 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 goto error;
321 }
322
323 updateContext = false;
324
325#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
326 // Check if multiple SSID feature is not enabled
327 if (psessionEntry->pLimStartBssReq->ssId.length)
328 {
329 if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
330 {
331 /*Temp hack for UPF35 - skip SSID check in order to be able to interop
332 with Marvel - they send their own SSID instead of ours*/
333 if ( 0 != vos_get_skip_ssid_check())
334 {
335 limLog(pMac, LOG1, FL("Received unmatched SSID but cfg to suppress - continuing\n"));
336 }
337 else
338 {
339 /**
340 * Received Re/Association Request with either
341 * Broadcast SSID OR with SSID that does not
342 * match with local one.
343 * Respond with unspecified status code.
344 */
345 limSendAssocRspMgmtFrame(pMac,
346 eSIR_MAC_UNSPEC_FAILURE_STATUS,
347 1,
348 pHdr->sa,
349 subType, 0,psessionEntry);
350
351 // Log error
352 if (subType == LIM_ASSOC)
353 limLog(pMac, LOGW, FL("received Assoc req with unmatched SSID from \n"));
354 else
355 limLog(pMac, LOGW, FL("received ReAssoc req with unmatched SSID from \n"));
356 limPrintMacAddr(pMac, pHdr->sa, LOGW);
357 goto error;
358 }
359 }
360 }
361 else
362 limLog(pMac, LOG1, FL("Suppressed SSID, App is going to check SSID\n"));
363#else
364 if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
365 {
366 /**
367 * Received Re/Association Request with either
368 * Broadcast SSID OR with SSID that does not
369 * match with local one.
370 * Respond with unspecified status code.
371 */
372 limSendAssocRspMgmtFrame(pMac,
373 eSIR_MAC_UNSPEC_FAILURE_STATUS,
374 1,
375 pHdr->sa,
376 subType, 0,psessionEntry);
377
378 // Log error
379 if (subType == LIM_ASSOC)
380 limLog(pMac, LOGW,
381 FL("received Assoc req with unmatched SSID from \n"));
382 else
383 limLog(pMac, LOGW,
384 FL("received ReAssoc req with unmatched SSID from \n"));
385 limPrintMacAddr(pMac, pHdr->sa, LOGW);
386 goto error;
387 }
388#endif
389
390 /***************************************************************
391 ** Verify if the requested rates are available in supported rate
392 ** set or Extended rate set. Some APs are adding basic rates in
393 ** Extended rateset IE
394 ***************************************************************/
395 basicRates.numRates = 0;
396
397 for(i = 0; i < pAssocReq->supportedRates.numRates; i++)
398 {
399 basicRates.rate[i] = pAssocReq->supportedRates.rate[i];
400 basicRates.numRates++;
401 }
402
403 for(j = 0; (j < pAssocReq->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++,j++)
404 {
405 basicRates.rate[i] = pAssocReq->extendedRates.rate[j];
406 basicRates.numRates++;
407 }
408 if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
409 {
410 /**
411 * Requesting STA does not support ALL BSS basic
412 * rates. Respond with 'basic rates not supported'
413 * status code.
414 */
415 limSendAssocRspMgmtFrame(
416 pMac,
417 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
418 1,
419 pHdr->sa,
420 subType, 0,psessionEntry);
421
422 // Log error
423 if (subType == LIM_ASSOC)
424 limLog(pMac, LOGW,
425 FL("received Assoc req with unsupported rates from \n"));
426 else
427 limLog(pMac, LOGW,
428 FL("received ReAssoc req with unsupported rates from\n"));
429 limPrintMacAddr(pMac, pHdr->sa, LOGW);
430 goto error;
431 }
432
433#ifdef WLAN_SOFTAP_FEATURE
434
435 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
436 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) &&
437 ((!pAssocReq->extendedRatesPresent ) || (pAssocReq->HTCaps.present)))
438 {
439 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
440 1, pHdr->sa, subType, 0, psessionEntry );
441 limLog(pMac, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy STA's\n"));
442 goto error;
443
444 }//end if phyMode == 11G_only
445
446 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
447 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) &&
448 (!pAssocReq->HTCaps.present))
449 {
450 limSendAssocRspMgmtFrame( pMac, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS,
451 1, pHdr->sa, subType, 0, psessionEntry );
452 limLog(pMac, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy STA's\n"));
453 goto error;
454 }//end if PhyMode == 11N_only
455
456#endif
457
458 /* Spectrum Management (11h) specific checks */
459 if (localCapabilities.spectrumMgt)
460 {
461 tSirRetStatus status = eSIR_SUCCESS;
462
463 /* If station is 11h capable, then it SHOULD send all mandatory
464 * IEs in assoc request frame. Let us verify that
465 */
466 if (pAssocReq->capabilityInfo.spectrumMgt)
467 {
468 if (!((pAssocReq->powerCapabilityPresent) && (pAssocReq->supportedChannelsPresent)))
469 {
470 /* One or more required information elements are missing, log the peers error */
471 if (!pAssocReq->powerCapabilityPresent)
472 {
473 if(subType == LIM_ASSOC)
474 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability IE in assoc request\n"));
475 else
476 limLog(pMac, LOG1, FL("LIM Info: Missing Power capability IE in Reassoc request\n"));
477 }
478 if (!pAssocReq->supportedChannelsPresent)
479 {
480 if(subType == LIM_ASSOC)
481 limLog(pMac, LOG1, FL("LIM Info: Missing Supported channel IE in assoc request\n"));
482 else
483 limLog(pMac, LOG1, FL("LIM Info: Missing Supported channel IE in Reassoc request\n"));
484 }
485 limPrintMacAddr(pMac, pHdr->sa, LOG1);
486 }
487 else
488 {
489 /* Assoc request has mandatory fields */
490 status = limIsDot11hPowerCapabilitiesInRange(pMac, pAssocReq, psessionEntry);
491 if (eSIR_SUCCESS != status)
492 {
493 if (subType == LIM_ASSOC)
494 limLog(pMac, LOGW, FL("LIM Info: Association MinTxPower(STA) > MaxTxPower(AP)\n"));
495 else
496 limLog(pMac, LOGW, FL("LIM Info: Reassociation MinTxPower(STA) > MaxTxPower(AP)\n"));
497 limPrintMacAddr(pMac, pHdr->sa, LOGW);
498 }
499 status = limIsDot11hSupportedChannelsValid(pMac, pAssocReq);
500 if (eSIR_SUCCESS != status)
501 {
502 if (subType == LIM_ASSOC)
503 limLog(pMac, LOGW, FL("LIM Info: Association wrong supported channels (STA)\n"));
504 else
505 limLog(pMac, LOGW, FL("LIM Info: Reassociation wrong supported channels (STA)\n"));
506 limPrintMacAddr(pMac, pHdr->sa, LOGW);
507 }
508 /* IEs are valid, use them if needed */
509 }
510 } //if(assoc.capabilityInfo.spectrumMgt)
511 else
512 {
513 /* As per the capabiities, the spectrum management is not enabled on the station
514 * The AP may allow the associations to happen even if spectrum management is not
515 * allowed, if the transmit power of station is below the regulatory maximum
516 */
517
518 /* TODO: presently, this is not handled. In the current implemetation, the AP would
519 * allow the station to associate even if it doesn't support spectrum management.
520 */
521 }
522 }// end of spectrum management related processing
523
524 if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
525 {
526 /**
527 * Requesting STA does not support ALL BSS MCS basic Rate set rates.
528 * Spec does not define any status code for this scenario.
529 */
530 limSendAssocRspMgmtFrame(
531 pMac,
532 eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS,
533 1,
534 pHdr->sa,
535 subType, 0,psessionEntry);
536
537 // Log error
538 if (subType == LIM_ASSOC)
539 limLog(pMac, LOGW,
540 FL("received Assoc req with unsupported MCS Rate Set from \n"));
541 else
542 limLog(pMac, LOGW,
543 FL("received ReAssoc req with unsupported MCS Rate Set from\n"));
544 limPrintMacAddr(pMac, pHdr->sa, LOGW);
545 goto error;
546 }
547
548 //if (pMac->dph.gDphPhyMode == WNI_CFG_PHY_MODE_11G)
549 if (phyMode == WNI_CFG_PHY_MODE_11G)
550 {
551
552 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS)
553 {
554 limLog(pMac, LOGP, FL("could not retrieve 11g-only flag\n"));
555 goto error;
556 }
557
558 if (!pAssocReq->extendedRatesPresent && val)
559 {
560 /**
561 * Received Re/Association Request from
562 * 11b STA when 11g only policy option
563 * is set.
564 * Reject with unspecified status code.
565 */
566 limSendAssocRspMgmtFrame(
567 pMac,
568 eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS,
569 1,
570 pHdr->sa,
571 subType, 0,psessionEntry);
572
573 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from 11b STA: "));
574 limPrintMacAddr(pMac, pHdr->sa, LOGW);
575
576#ifdef WLAN_DEBUG
577 pMac->lim.gLim11bStaAssocRejectCount++;
578#endif
579 goto error;
580 }
581 }
582
583#ifdef WMM_APSD
584 // Save the QOS info element in assoc request..
585 limGetWmeMode(pMac, &wmeMode);
586 if (wmeMode == eHAL_SET)
587 {
588 tpQosInfoSta qInfo;
589
590 qInfo = (tpQosInfoSta) (pAssocReq->qosCapability.qosInfo);
591
592 if ((pMac->lim.gWmmApsd.apsdEnable == 0) && (qInfo->ac_be || qInfo->ac_bk || qInfo->ac_vo || qInfo->ac_vi))
593 {
594
595 /**
596 * Received Re/Association Request from
597 * 11b STA when 11g only policy option
598 * is set.
599 * Reject with unspecified status code.
600 */
601 limSendAssocRspMgmtFrame(
602 pMac,
603 eSIR_MAC_WME_REFUSED_STATUS,
604 1,
605 pHdr->sa,
606 subType, 0,psessionEntry);
607
608 limLog(pMac, LOGW,
609 FL("Rejecting Re/Assoc req from STA: "));
610 limPrintMacAddr(pMac, pHdr->sa, LOGW);
611 limLog(pMac, LOGE, FL("APSD not enabled, qosInfo - 0x%x\n"), *qInfo);
612 goto error;
613 }
614 }
615#endif
616
617 // Check for 802.11n HT caps compatibility; are HT Capabilities
618 // turned on in lim?
Jeff Johnsone7245742012-09-05 17:12:55 -0700619 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 {
621 // There are; are they turned on in the STA?
622 if ( pAssocReq->HTCaps.present )
623 {
624 // The station *does* support 802.11n HT capability...
625
626 limLog( pMac, LOG1, FL( "AdvCodingCap:%d ChaWidthSet:%d "
627 "PowerSave:%d greenField:%d "
628 "shortGI20:%d shortGI40:%d\n"
629 "txSTBC:%d rxSTBC:%d delayBA:%d"
630 "maxAMSDUsize:%d DSSS/CCK:%d "
631 "PSMP:%d stbcCntl:%d lsigTXProt:%d\n"),
632 pAssocReq->HTCaps.advCodingCap,
633 pAssocReq->HTCaps.supportedChannelWidthSet,
634 pAssocReq->HTCaps.mimoPowerSave,
635 pAssocReq->HTCaps.greenField,
636 pAssocReq->HTCaps.shortGI20MHz,
637 pAssocReq->HTCaps.shortGI40MHz,
638 pAssocReq->HTCaps.txSTBC,
639 pAssocReq->HTCaps.rxSTBC,
640 pAssocReq->HTCaps.delayedBA,
641 pAssocReq->HTCaps.maximalAMSDUsize,
642 pAssocReq->HTCaps.dsssCckMode40MHz,
643 pAssocReq->HTCaps.psmp,
644 pAssocReq->HTCaps.stbcControlFrame,
645 pAssocReq->HTCaps.lsigTXOPProtection );
646
647 // Make sure the STA's caps are compatible with our own:
648 //11.15.2 Support of DSSS/CCK in 40 MHz
649 //the AP shall refuse association requests from an HT STA that has the DSSS/CCK
650 //Mode in 40 MHz subfield set to 1;
651
652 //FIXME_BTAMP_AP : Need to be enabled
653 /*
654 if ( !pMac->lim.gHTDsssCckRate40MHzSupport && pAssocReq->HTCaps.dsssCckMode40MHz )
655 {
656 statusCode = eSIR_MAC_DSSS_CCK_RATE_NOT_SUPPORT_STATUS;
657 limLog( pMac, LOGW, FL( "AP DSSS/CCK is disabled; "
658 "STA rejected.\n" ) );
659 // Reject association
660 limSendAssocRspMgmtFrame( pMac, statusCode, 1, pHdr->sa, subType, 0,psessionEntry);
661 goto error;
662 }
663 */
664 }
665 } // End if on HT caps turned on in lim.
666
667#ifdef WLAN_SOFTAP_FEATURE
668 /* Clear the buffers so that frame parser knows that there isn't a previously decoded IE in these buffers */
669 palZeroMemory( pMac->hHdd, ( tANI_U8* )&Dot11fIERSN, sizeof( Dot11fIERSN ) );
670 palZeroMemory( pMac->hHdd, ( tANI_U8* )&Dot11fIEWPA, sizeof( Dot11fIEWPA ) );
671
672 /* if additional IE is present, check if it has WscIE */
673 if( pAssocReq->addIEPresent && pAssocReq->addIE.length )
674 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
675 /* when wpsIe is present, RSN/WPA IE is ignored */
676 if( wpsIe == NULL )
677 {
678 /** check whether as RSN IE is present */
679 if(psessionEntry->limSystemRole == eLIM_AP_ROLE
680 && psessionEntry->pLimStartBssReq->privacy
681 && psessionEntry->pLimStartBssReq->rsnIE.length)
682 {
683 limLog(pMac, LOGE,
684 FL("AP supports RSN enabled authentication\n"));
685
686 if(pAssocReq->rsnPresent)
687 {
688 if(pAssocReq->rsn.length)
689 {
690 // Unpack the RSN IE
691 dot11fUnpackIeRSN(pMac,
692 &pAssocReq->rsn.info[0],
693 pAssocReq->rsn.length,
694 &Dot11fIERSN);
695
696 /* Check RSN version is supported or not */
697 if(SIR_MAC_OUI_VERSION_1 == Dot11fIERSN.version)
698 {
699 /* check the groupwise and pairwise cipher suites */
700 if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry, pAssocReq->HTCaps.present) ) )
701 {
702 /* some IE is not properly sent */
703 /* received Association req frame with RSN IE but length is 0 */
704 limSendAssocRspMgmtFrame(
705 pMac,
706 status,
707 1,
708 pHdr->sa,
709 subType, 0,psessionEntry);
710
711 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
712 limPrintMacAddr(pMac, pHdr->sa, LOGW);
713 goto error;
714
715 }
716 }
717 else
718 {
719 /* received Association req frame with RSN IE version wrong */
720 limSendAssocRspMgmtFrame(
721 pMac,
722 eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS,
723 1,
724 pHdr->sa,
725 subType, 0,psessionEntry);
726
727 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
728 limPrintMacAddr(pMac, pHdr->sa, LOGW);
729 goto error;
730
731 }
732 }
733 else
734 {
735 /* received Association req frame with RSN IE but length is 0 */
736 limSendAssocRspMgmtFrame(
737 pMac,
738 eSIR_MAC_INVALID_INFORMATION_ELEMENT_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 } /* end - if(pAssocReq->rsnPresent) */
749 if((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent)
750 {
751 // Unpack the WPA IE
752 if(pAssocReq->wpa.length)
753 {
754 dot11fUnpackIeWPA(pMac,
755 &pAssocReq->wpa.info[4], //OUI is not taken care
756 pAssocReq->wpa.length,
757 &Dot11fIEWPA);
758 /* check the groupwise and pairwise cipher suites */
759 if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present)))
760 {
761 /* received Association req frame with WPA IE but mismatch */
762 limSendAssocRspMgmtFrame(
763 pMac,
764 status,
765 1,
766 pHdr->sa,
767 subType, 0,psessionEntry);
768
769 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
770 limPrintMacAddr(pMac, pHdr->sa, LOGW);
771 goto error;
772
773 }
774 }
775 else
776 {
777 /* received Association req frame with invalid WPA IE */
778 limSendAssocRspMgmtFrame(
779 pMac,
780 eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS,
781 1,
782 pHdr->sa,
783 subType, 0,psessionEntry);
784
785 limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "));
786 limPrintMacAddr(pMac, pHdr->sa, LOGW);
787 goto error;
788 }/* end - if(pAssocReq->wpa.length) */
789 } /* end - if(pAssocReq->wpaPresent) */
790 } /* end of if(psessionEntry->pLimStartBssReq->privacy
791 && psessionEntry->pLimStartBssReq->rsnIE->length) */
792
793 } /* end of if( ! pAssocReq->wscInfo.present ) */
794#endif //WLAN_SOFTAP_FEATURE
795
796 /**
797 * Extract 'associated' context for STA, if any.
798 * This is maintained by DPH and created by LIM.
799 */
800 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
801
802 /// Extract pre-auth context for the STA, if any.
803 pStaPreAuthContext = limSearchPreAuthList(pMac, pHdr->sa);
804
805 if (pStaDs == NULL)
806 {
807 /// Requesting STA is not currently associated
808 if (pMac->lim.gLimNumOfCurrentSTAs == pMac->lim.maxStation)
809 {
810 /**
811 * Maximum number of STAs that AP can handle reached.
812 * Send Association response to peer MAC entity
813 */
814 limRejectAssociation(pMac, pHdr->sa,
815 subType, false,
816 (tAniAuthType) 0, 0,
817 false,
818 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
819
820 goto error;
821 }
822
823 /// Check if STA is pre-authenticated.
824 if ((pStaPreAuthContext == NULL) ||
825 (pStaPreAuthContext &&
826 (pStaPreAuthContext->mlmState !=
827 eLIM_MLM_AUTHENTICATED_STATE)))
828 {
829 /**
830 * STA is not pre-authenticated yet requesting
831 * Re/Association before Authentication.
832 * OR STA is in the process of getting authenticated
833 * and sent Re/Association request.
834 * Send Deauthentication frame with 'prior
835 * authentication required' reason code.
836 */
837 limSendDeauthMgmtFrame(
838 pMac,
839 eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800840 pHdr->sa, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700841
842 // Log error
843 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700844 limLog(pMac, LOGW,
845 FL("received Assoc req from STA that does not have pre-auth context "MAC_ADDRESS_STR),
846 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 else
Mohit Khanna23863762012-09-11 17:40:09 -0700848 limLog(pMac, LOGW,
849 FL("received ReAssoc req from STA that does not have pre-auth context "
850 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 goto error;
852 }
853
854 /// Delete 'pre-auth' context of STA
855 authType = pStaPreAuthContext->authType;
856 limDeletePreAuthNode(pMac, pHdr->sa);
857
858 // All is well. Assign AID (after else part)
859
860 } // if (pStaDs == NULL)
861 else
862 {
863 // STA context does exist for this STA
864
865 if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
866 {
867 /**
868 * Requesting STA is in some 'transient' state?
869 * Ignore the Re/Assoc Req frame by incrementing
870 * debug counter & logging error.
871 */
872 if (subType == LIM_ASSOC)
873 {
874
875#ifdef WLAN_DEBUG
876 pMac->lim.gLimNumAssocReqDropInvldState++;
877#endif
878 limLog(pMac, LOG1, FL("received Assoc req in state %X from "), pStaDs->mlmStaContext.mlmState);
879 }
880 else
881 {
882#ifdef WLAN_DEBUG
883 pMac->lim.gLimNumReassocReqDropInvldState++;
884#endif
885 limLog(pMac, LOG1, FL("received ReAssoc req in state %X from "), pStaDs->mlmStaContext.mlmState);
886 }
887 limPrintMacAddr(pMac, pHdr->sa, LOG1);
888 limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -0700889
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 goto error;
891 } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
892
893 /**
894 * STA sent Re/Association Request frame while already in
895 * 'associated' state. Update STA capabilities and
896 * send Association response frame with same AID
897 */
898
899 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
900
901 if (pStaPreAuthContext &&
902 (pStaPreAuthContext->mlmState ==
903 eLIM_MLM_AUTHENTICATED_STATE))
904 {
905 /// STA has triggered pre-auth again
906 authType = pStaPreAuthContext->authType;
907 limDeletePreAuthNode(pMac, pHdr->sa);
908 }
909 else
910 authType = pStaDs->mlmStaContext.authType;
911
912 updateContext = true;
913
914 if (dphInitStaState(pMac, pHdr->sa, aid, true, &psessionEntry->dph.dphHashTable) == NULL)
915 {
916 limLog(pMac, LOGE, FL("could not Init STAid=%d\n"), aid);
917 goto error;
918 }
919
920
921 goto sendIndToSme;
922 } // end if (lookup for STA in perStaDs fails)
923
924
925
926 // check if sta is allowed per QoS AC rules
927 //if (pMac->dph.gDphQosEnabled || pMac->dph.gDphWmeEnabled)
928 limGetWmeMode(psessionEntry, &wmeMode);
929 if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET))
930 {
931 // for a qsta, check if the requested Traffic spec
932 // is admissible
933 // for a non-qsta check if the sta can be admitted
934 if (pAssocReq->addtsPresent)
935 {
936 tANI_U8 tspecIdx = 0; //index in the sch tspec table.
937 if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
938 &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
939 {
940 limLog(pMac, LOGW, FL("AdmitControl: TSPEC rejected\n"));
941 limSendAssocRspMgmtFrame(
942 pMac,
943 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
944 1,
945 pHdr->sa,
946 subType, 0,psessionEntry);
947#ifdef WLAN_DEBUG
948 pMac->lim.gLimNumAssocReqDropACRejectTS++;
949#endif
950 goto error;
951 }
952 }
953 else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
954 != eSIR_SUCCESS)
955 {
956 limLog(pMac, LOGW, FL("AdmitControl: Sta rejected\n"));
957 limSendAssocRspMgmtFrame(
958 pMac,
959 eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
960 1,
961 pHdr->sa,
962 subType, 0,psessionEntry);
963#ifdef WLAN_DEBUG
964 pMac->lim.gLimNumAssocReqDropACRejectSta++;
965#endif
966 goto error;
967 }
968
969 // else all ok
970 limLog(pMac, LOG1, FL("AdmitControl: Sta OK!\n"));
971 }
972
973 /**
974 * STA is Associated !
975 */
976 if (subType == LIM_ASSOC)
Mohit Khanna23863762012-09-11 17:40:09 -0700977 limLog(pMac, LOGW, FL("received Assoc req successful "MAC_ADDRESS_STR),
978 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700979 else
Mohit Khanna23863762012-09-11 17:40:09 -0700980 limLog(pMac, LOGW, FL("received ReAssoc req successful"MAC_ADDRESS_STR),
981 MAC_ADDR_ARRAY(pHdr->sa));
Jeff Johnson295189b2012-06-20 16:38:30 -0700982
983 /**
984 * Assign unused/least recently used AID from perStaDs.
985 * This will 12-bit STAid used by MAC HW.
986 * NOTE: limAssignAID() assigns AID values ranging between 1 - 255
987 */
988
989 aid = limAssignAID(pMac);
990
991 if (!aid)
992 {
993 // Could not assign AID
994 // Reject association
995 limRejectAssociation(pMac, pHdr->sa,
996 subType, true, authType,
997 aid, false,
998 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
999
1000 goto error;
1001 }
1002
1003 /**
1004 * Add an entry to hash table maintained by DPH module
1005 */
1006
1007 pStaDs = dphAddHashEntry(pMac, pHdr->sa, aid, &psessionEntry->dph.dphHashTable);
1008
1009 if (pStaDs == NULL)
1010 {
1011 // Could not add hash table entry at DPH
1012 limLog(pMac, LOGE,
1013 FL("could not add hash entry at DPH for aid=%d, MacAddr:\n"),
1014 aid);
1015 limPrintMacAddr(pMac, pHdr->sa, LOGE);
1016
1017 // Release AID
1018 limReleaseAID(pMac, aid);
1019
1020 limRejectAssociation(pMac, pHdr->sa,
1021 subType, true, authType, aid, false,
1022 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1023
1024 goto error;
1025 }
1026
1027
1028sendIndToSme:
1029
1030 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1031
1032 pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
Jeff Johnsone7245742012-09-05 17:12:55 -07001033#ifdef WLAN_FEATURE_11AC
1034 pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
1035#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
1037 pStaDs->qos.addts = pAssocReq->addtsReq;
1038 pStaDs->qos.capability = pAssocReq->qosCapability;
1039 pStaDs->versionPresent = 0;
1040 /* short slot and short preamble should be updated before doing limaddsta */
1041 pStaDs->shortPreambleEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortPreamble;
1042 pStaDs->shortSlotTimeEnabled = (tANI_U8)pAssocReq->capabilityInfo.shortSlotTime;
1043
1044 if (pAssocReq->propIEinfo.versionPresent) //update STA version info
1045 {
1046 pStaDs->versionPresent = 1;
1047 pStaDs->version = pAssocReq->propIEinfo.version;
1048 }
1049 pStaDs->propCapability = 0;
1050 if (pAssocReq->propIEinfo.capabilityPresent)
1051 {
1052 if (sirGetCfgPropCaps(pMac, &pStaDs->propCapability))
1053 pStaDs->propCapability &= pAssocReq->propIEinfo.capability;
1054 }
1055
1056 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
1057 pStaDs->valid = 0;
1058 pStaDs->mlmStaContext.authType = authType;
1059 pStaDs->staType = STA_ENTRY_PEER;
1060
1061 //TODO: If listen interval is more than certain limit, reject the association.
1062 //Need to check customer requirements and then implement.
1063 pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval;
1064 pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
1065
1066 /* The following count will be used to knock-off the station if it doesn't
1067 * come back to receive the buffered data. The AP will wait for numTimSent number
1068 * of beacons after sending TIM information for the station, before assuming that
1069 * the station is no more associated and disassociates it
1070 */
1071
1072 /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
1073 pStaDs->timWaitCount = (tANI_U8)GET_TIM_WAIT_COUNT(pAssocReq->listenInterval);
1074
1075 /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */
1076 pStaDs->curTxMpduCnt = 0;
1077
1078 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
1079 (pAssocReq->HTCaps.present))
1080 {
1081 pStaDs->htGreenfield = (tANI_U8)pAssocReq->HTCaps.greenField;
1082 pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity;
1083 pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocReq->HTCaps.dsssCckMode40MHz;
1084 pStaDs->htLsigTXOPProtection = (tANI_U8)pAssocReq->HTCaps.lsigTXOPProtection;
1085 pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
1086 pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
1087 pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
1088 pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
1089 pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
1090 pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07001091 /* 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
1092 * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
1093 */
1094 pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
1095#ifdef WLAN_FEATURE_11AC
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07001096 if(pAssocReq->operMode.present)
1097 {
1098 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pAssocReq->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
1099 pStaDs->htSupportedChannelWidthSet = (tANI_U8)(pAssocReq->operMode.chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
1100 }
1101 else if (pAssocReq->VHTCaps.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07001102 {
Madan Mohan Koyyalamudi740f7802012-09-24 14:17:14 -07001103 // Check if STA has enabled it's channel bonding mode.
1104 // If channel bonding mode is enabled, we decide based on SAP's current configuration.
1105 // else, we set it to VHT20.
1106 pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)((pStaDs->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ?
1107 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
1108 psessionEntry->vhtTxChannelWidthSet );
Jeff Johnsone7245742012-09-05 17:12:55 -07001109 }
Madan Mohan Koyyalamudicc394402012-10-05 10:48:19 -07001110
1111 // Lesser among the AP and STA bandwidth of operation.
1112 pStaDs->htSupportedChannelWidthSet =
1113 (pStaDs->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1114 pStaDs->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1115
Jeff Johnsone7245742012-09-05 17:12:55 -07001116#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001117 pStaDs->baPolicyFlag = 0xFF;
1118 }
1119
1120
Jeff Johnsone7245742012-09-05 17:12:55 -07001121#ifdef WLAN_FEATURE_11AC
1122if (limPopulateMatchingRateSet(pMac,
1123 pStaDs,
1124 &(pAssocReq->supportedRates),
1125 &(pAssocReq->extendedRates),
1126 pAssocReq->HTCaps.supportedMCSSet,
1127 &(pAssocReq->propIEinfo.propRates),
1128 psessionEntry , &pAssocReq->VHTCaps)
1129 != eSIR_SUCCESS)
1130#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001131
1132 if (limPopulateMatchingRateSet(pMac,
1133 pStaDs,
1134 &(pAssocReq->supportedRates),
1135 &(pAssocReq->extendedRates),
1136 pAssocReq->HTCaps.supportedMCSSet,
1137 &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -07001138#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001139 {
1140 // Could not update hash table entry at DPH with rateset
1141 limLog(pMac, LOGE,
1142 FL("could not update hash entry at DPH for aid=%d, MacAddr:\n"),
1143 aid);
1144 limPrintMacAddr(pMac, pHdr->sa, LOGE);
1145
1146 // Release AID
1147 limReleaseAID(pMac, aid);
1148
1149
1150 limRejectAssociation(pMac, pHdr->sa,
1151 subType, true, authType, aid, true,
1152 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1153
1154 /*return it from here rather than goto error statement.This is done as the memory is getting free twice*/
1155 return;
1156 //goto error;
1157 }
1158
1159 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
1160 (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
1161 pAssocReq->propIEinfo.propRates.numPropRates + 1);
1162
1163 /// Add STA context at MAC HW (BMU, RHP & TFP)
1164
1165 pStaDs->qosMode = eANI_BOOLEAN_FALSE;
1166 pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
1167 if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
1168 {
1169 pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
1170 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1171 }
1172
1173 pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
1174 pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
1175 limGetWmeMode(psessionEntry, &wmeMode);
1176 //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
1177 if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
1178 {
1179 pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
1180 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1181 limGetWsmMode(psessionEntry, &wsmMode);
1182 /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
1183 can coexist */
1184#ifdef WLAN_SOFTAP_FEATURE
1185 if( pAssocReq->WMMInfoStation.present)
1186 {
1187 /* check whether AP supports or not */
1188 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
1189 && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
1190 || pAssocReq->WMMInfoStation.acbk_uapsd
1191 || pAssocReq->WMMInfoStation.acvo_uapsd
1192 || pAssocReq->WMMInfoStation.acvi_uapsd))
1193 {
1194
1195 /**
1196 * Received Re/Association Request from
1197 * STA when UPASD is not supported.
1198 */
1199 limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed\n" ));
1200 limRejectAssociation(pMac, pHdr->sa,
1201 subType, true, authType, aid, true,
1202 (tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1203
1204
1205 /*return it from here rather than goto error statement.This is done as the memory is getting free twice in this uapsd scenario*/
1206 return;
1207 //goto error;
1208 }
1209 else
1210 {
1211 /* update UAPSD and send it to LIM to add STA */
1212 pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
1213 pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
1214 pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
1215 pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
1216 pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
1217 }
1218 }
1219#endif
1220 //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
1221 if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
1222 pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
1223
1224 }
1225
1226 // Re/Assoc Response frame to requesting STA
1227 pStaDs->mlmStaContext.subType = subType;
1228
1229 if (pAssocReq->propIEinfo.aniIndicator)
1230 pStaDs->aniPeer = 1;
1231
1232 // BTAMP: Storing the parsed assoc request in the psessionEntry array
1233 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1234
1235 /* BTAMP: If STA context already exist (ie. updateContext = 1)
1236 * for this STA, then we should delete the old one, and add
1237 * the new STA. This is taken care of in the limDelSta() routine.
1238 *
1239 * Prior to BTAMP, we were setting this flag so that when
1240 * PE receives SME_ASSOC_CNF, and if this flag is set, then
1241 * PE shall delete the old station and then add. But now in
1242 * BTAMP, we're directly adding station before waiting for
1243 * SME_ASSOC_CNF, so we can do this now.
1244 */
1245 if (!updateContext)
1246 {
1247 pStaDs->mlmStaContext.updateContext = 0;
1248
1249 // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
1250 if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
1251 {
1252 limLog(pMac, LOGE, FL("could not Add STA with assocId=%d\n"), pStaDs->assocId);
1253 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
1254 true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
1255 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1256
1257 /*return it from here rather than goto error statement.This is done as the memory is getting free twice*/
1258 return;
1259 //goto error;
1260 }
1261 }
1262 else
1263 {
1264 pStaDs->mlmStaContext.updateContext = 1;
1265
1266#ifdef WLAN_SOFTAP_FEATURE
1267 mlmPrevState = pStaDs->mlmStaContext.mlmState;
1268
1269 /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
1270 if(subType != LIM_REASSOC)
1271 {
1272 //we need to set the mlmState here in order differentiate in limDelSta.
1273 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
1274 if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
1275 {
1276 limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d\n"), pStaDs->assocId, pStaDs->staIndex);
1277 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1278 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1279
1280 //Restoring the state back.
1281 pStaDs->mlmStaContext.mlmState = mlmPrevState;
1282 goto error;
1283 }
1284 }
1285 else
1286 {
1287 /* mlmState is changed in limAddSta context */
1288 /* use the same AID, already allocated */
1289 if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
1290 {
1291 limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed\n" ));
1292 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1293 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1294
1295 //Restoring the state back.
1296 pStaDs->mlmStaContext.mlmState = mlmPrevState;
1297 goto error;
1298 }
1299
1300 }
1301#endif
1302
1303 }
1304
1305 return;
1306
1307error:
1308 if (pAssocReq != NULL)
1309 {
1310 if ( pAssocReq->assocReqFrame )
1311 {
1312 palFreeMemory(pMac->hHdd, pAssocReq->assocReqFrame);
1313 pAssocReq->assocReqFrame = NULL;
1314 }
1315
1316 if (palFreeMemory(pMac->hHdd, pAssocReq) != eHAL_STATUS_SUCCESS)
1317 {
1318 limLog(pMac, LOGP, FL("PalFree Memory failed \n"));
1319 return;
1320 }
1321 }
1322
Jeff Johnsone7245742012-09-05 17:12:55 -07001323 /* If it is not duplicate Assoc request then only make to Null */
1324 if ((pStaDs != NULL) &&
1325 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001327
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 return;
1329
1330} /*** end limProcessAssocReqFrame() ***/
1331
1332
1333
1334/**---------------------------------------------------------------
1335\fn limSendMlmAssocInd
1336\brief This function sends either LIM_MLM_ASSOC_IND
1337\ or LIM_MLM_REASSOC_IND to SME.
1338\
1339\param pMac
1340\param *pStaDs - Station DPH hash entry
1341\param psessionEntry - PE session entry
1342\return None
1343
1344 * ?????? How do I get
1345 * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
1346 * - aid =====> pStaDs->assocId
1347 * - pHdr->sa =====> pStaDs->staAddr
1348 * - authType
1349 * - pHdr->seqControl =====> no longer needed
1350 * - pStaDs
1351------------------------------------------------------------------*/
1352void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1353{
1354 tpLimMlmAssocInd pMlmAssocInd = NULL;
1355 tpLimMlmReassocInd pMlmReassocInd;
1356 tpSirAssocReq pAssocReq;
1357 tANI_U16 temp;
1358 tANI_U32 phyMode;
1359 tANI_U8 subType;
1360#ifdef WLAN_SOFTAP_FEATURE
1361 tANI_U8 *wpsIe = NULL;
1362#endif
1363 tANI_U32 tmp;
1364// tANI_U16 statusCode;
1365 tANI_U16 i, j=0;
1366
1367 // Get a copy of the already parsed Assoc Request
1368 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
1369
1370 // Get the phyMode
1371 limGetPhyMode(pMac, &phyMode, psessionEntry);
1372
1373 // Extract pre-auth context for the peer BTAMP-STA, if any.
1374
1375 // Determiine if its Assoc or ReAssoc Request
1376 if (pAssocReq->reassocRequest == 1)
1377 subType = LIM_REASSOC;
1378 else
1379 subType = LIM_ASSOC;
1380#ifdef WLAN_SOFTAP_FEATURE
1381 if (subType == LIM_ASSOC || subType == LIM_REASSOC)
1382#else
1383 if (subType == LIM_ASSOC )
1384#endif
1385 {
1386 temp = sizeof(tLimMlmAssocInd);
1387#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1388 temp += pAssocReq->propIEinfo.numBss * sizeof(tSirNeighborBssInfo);
1389#endif
1390
1391 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAssocInd, temp))
1392 {
1393 limReleaseAID(pMac, pStaDs->assocId);
1394 limLog(pMac, LOGP, FL("palAllocateMemory failed for pMlmAssocInd\n"));
1395 return;
1396 }
1397 palZeroMemory( pMac->hHdd, pMlmAssocInd, temp);
1398
1399 palCopyMemory( pMac->hHdd,(tANI_U8 *)pMlmAssocInd->peerMacAddr,(tANI_U8 *)pStaDs->staAddr,sizeof(tSirMacAddr));
1400
1401 pMlmAssocInd->aid = pStaDs->assocId;
1402 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pMlmAssocInd->ssId,(tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
1403 pMlmAssocInd->sessionId = psessionEntry->peSessionId;
1404 pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
1405
1406#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1407 // Note for BTAMP: no need to fill in pMlmAssocInd->seqNum
1408 pMlmAssocInd->wniIndicator = (tAniBool) pAssocReq->propIEinfo.aniIndicator;
1409 pMlmAssocInd->bpIndicator = (tAniBool) pAssocReq->propIEinfo.bpIndicator;
1410 pMlmAssocInd->bpType = (tSirBpIndicatorType) pAssocReq->propIEinfo.bpType;
1411 if (pAssocReq->extendedRatesPresent)
1412 {
1413 pMlmAssocInd->nwType = eSIR_11G_NW_TYPE;
1414 limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_SET);
1415 }
1416 else
1417 {
1418 if (phyMode == WNI_CFG_PHY_MODE_11A)
1419 pMlmAssocInd->nwType = eSIR_11A_NW_TYPE;
1420 else
1421 {
1422 pMlmAssocInd->nwType = eSIR_11B_NW_TYPE;
1423 limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_CLEAR);
1424 }
1425 }
1426 pMlmAssocInd->assocType = (tSirAssocType)pAssocReq->propIEinfo.assocType;
1427 pMlmAssocInd->load.numStas = pMac->lim.gLimNumOfCurrentSTAs;
1428 pMlmAssocInd->load.channelUtilization =(pMac->lim.gpLimMeasData) ? pMac->lim.gpLimMeasData->avgChannelUtilization : 0;
1429 pMlmAssocInd->numBss = (tANI_U32) pAssocReq->propIEinfo.numBss;
1430 if (pAssocReq->propIEinfo.numBss)
1431 {
1432 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmAssocInd->neighborList,(tANI_U8 *)pAssocReq->propIEinfo.pBssList,
1433 (sizeof(tSirNeighborBssInfo) * pAssocReq->propIEinfo.numBss));
1434 }
1435#endif
1436 pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
1437
1438 // Fill in RSN IE information
1439 pMlmAssocInd->rsnIE.length = 0;
1440#ifdef WLAN_SOFTAP_FEATURE
1441 // if WPS IE is present, ignore RSN IE
1442 if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
1443 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1444 }
1445 if (pAssocReq->rsnPresent && (NULL == wpsIe))
1446#else
1447 if (pAssocReq->rsnPresent)
1448#endif
1449 {
1450 limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d\n"), pAssocReq->rsn.length);
1451 pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1452 pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1453 pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
1454 palCopyMemory( pMac->hHdd,
1455 &pMlmAssocInd->rsnIE.rsnIEdata[2],
1456 pAssocReq->rsn.info,
1457 pAssocReq->rsn.length);
1458 }
1459
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 // Fill in 802.11h related info
1461 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1462 {
1463 pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
1464 pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1465 pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1466 limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
1467 }
1468 else
1469 pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
1470
1471
1472#ifdef WLAN_SOFTAP_FEATURE
1473 /* This check is to avoid extra Sec IEs present incase of WPS */
1474 if (pAssocReq->wpaPresent && (NULL == wpsIe))
1475#else
1476 if ((pAssocReq->wpaPresent) && (pMlmAssocInd->rsnIE.length < SIR_MAC_MAX_IE_LENGTH))
1477#endif
1478 {
1479 if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
1480 {
1481 PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d\n"), pMlmAssocInd->rsnIE.length);)
1482 return;
1483 }
1484 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1485 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
1486 palCopyMemory( pMac->hHdd,
1487 &pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
1488 pAssocReq->wpa.info,
1489 pAssocReq->wpa.length);
1490 pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1491 }
1492
1493
1494 pMlmAssocInd->addIE.length = 0;
1495 if (pAssocReq->addIEPresent)
1496 {
1497 palCopyMemory( pMac->hHdd,
1498 &pMlmAssocInd->addIE.addIEdata,
1499 pAssocReq->addIE.addIEdata,
1500 pAssocReq->addIE.length);
1501
1502 pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
1503 }
1504
1505#ifdef WLAN_SOFTAP_FEATURE
1506 if(pAssocReq->wmeInfoPresent)
1507 {
1508
1509 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
1510 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d\n"), WNI_CFG_WME_ENABLED );
1511
1512 /* check whether AP is enabled with WMM */
1513 if(tmp)
1514 {
1515 pMlmAssocInd->WmmStaInfoPresent = 1;
1516 }
1517 else
1518 {
1519 pMlmAssocInd->WmmStaInfoPresent= 0;
1520 }
1521 /* Note: we are not rejecting association here because IOT will fail */
1522
1523 }
1524#endif
1525
1526 // Required for indicating the frames to upper layer
1527 pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1528 pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
1529
1530 pMlmAssocInd->beaconPtr = psessionEntry->beacon;
1531 pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
1532
1533 limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
1534 palFreeMemory( pMac->hHdd, pMlmAssocInd);
1535 }
1536 else
1537 {
1538 // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
1539 temp = sizeof(tLimMlmReassocInd);
1540
1541#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
1542 temp += pAssocReq->propIEinfo.numBss * sizeof(tSirNeighborBssInfo);
1543#endif
1544 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocInd, temp))
1545 {
1546 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pMlmReassocInd\n"));
1547 limReleaseAID(pMac, pStaDs->assocId);
1548 return;
1549 }
1550 palZeroMemory( pMac->hHdd, pMlmReassocInd, temp);
1551
1552 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmReassocInd->peerMacAddr, (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
1553 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmReassocInd->currentApAddr, (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
1554 pMlmReassocInd->aid = pStaDs->assocId;
1555 pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
1556 palCopyMemory( pMac->hHdd,(tANI_U8 *)&pMlmReassocInd->ssId, (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
1557
1558#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1559 // Note for BTAMP: no need to fill in pMlmAssocInd->seqNum
1560 pMlmReassocInd->wniIndicator = (tAniBool) pAssocReq->propIEinfo.aniIndicator;
1561 pMlmReassocInd->bpIndicator = (tAniBool) pAssocReq->propIEinfo.bpIndicator;
1562 pMlmReassocInd->bpType = (tSirBpIndicatorType) pAssocReq->propIEinfo.bpType;
1563 if (pAssocReq->extendedRatesPresent)
1564 {
1565 pMlmReassocInd->nwType = eSIR_11G_NW_TYPE;
1566 limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_SET);
1567 }
1568 else
1569 {
1570 if (phyMode == WNI_CFG_PHY_MODE_11A)
1571 pMlmReassocInd->nwType = eSIR_11A_NW_TYPE;
1572 else
1573 {
1574 pMlmReassocInd->nwType = eSIR_11B_NW_TYPE;
1575 limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_CLEAR);
1576 }
1577 }
1578
1579 pMlmReassocInd->reassocType = (tSirAssocType)pAssocReq->propIEinfo.assocType;
1580 pMlmReassocInd->load.numStas = pMac->lim.gLimNumOfCurrentSTAs;
1581 pMlmReassocInd->load.channelUtilization = (pMac->lim.gpLimMeasData) ?
1582 pMac->lim.gpLimMeasData->avgChannelUtilization : 0;
1583 pMlmReassocInd->numBss = (tANI_U32) pAssocReq->propIEinfo.numBss;
1584 if (pAssocReq->propIEinfo.numBss)
1585 {
1586 palCopyMemory( pMac->hHdd,
1587 (tANI_U8 *) pMlmReassocInd->neighborList,
1588 (tANI_U8 *) pAssocReq->propIEinfo.pBssList,
1589 (sizeof(tSirNeighborBssInfo) * pAssocReq->propIEinfo.numBss));
1590 }
1591#endif
1592 if (pAssocReq->propIEinfo.aniIndicator)
1593 pStaDs->aniPeer = 1;
1594
1595 pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
1596 pMlmReassocInd->rsnIE.length = 0;
1597
1598#ifdef WLAN_SOFTAP_FEATURE
1599 if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
1600 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1601
1602 if (pAssocReq->rsnPresent && (NULL == wpsIe))
1603#else
1604 if (pAssocReq->rsnPresent)
1605#endif
1606 {
1607 limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d\n"), pAssocReq->rsn.length);
1608 pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1609 pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1610 pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
1611 palCopyMemory( pMac->hHdd, &pMlmReassocInd->rsnIE.rsnIEdata[2], pAssocReq->rsn.info, pAssocReq->rsn.length);
1612 }
1613
Jeff Johnson295189b2012-06-20 16:38:30 -07001614 // 802.11h support
1615 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1616 {
1617 pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
1618 pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1619 pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1620 pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
1621
1622 limLog(pMac, LOG1,
1623 FL("Sending Reassoc Ind: spectrum ON, minPwr %d, maxPwr %d, numChnl %d\n"),
1624 pMlmReassocInd->powerCap.minTxPower,
1625 pMlmReassocInd->powerCap.maxTxPower,
1626 pMlmReassocInd->supportedChannels.numChnl);
1627
1628 for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
1629 {
1630 pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
1631 limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d \n"),
1632 i, pMlmReassocInd->supportedChannels.channelList[i]);
1633 j+=2;
1634 }
1635 }
1636 else
1637 pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
1638
1639
1640#ifdef WLAN_SOFTAP_FEATURE
1641 /* This check is to avoid extra Sec IEs present incase of WPS */
1642 if (pAssocReq->wpaPresent && (NULL == wpsIe))
1643#else
1644 if (pAssocReq->wpaPresent)
1645#endif
1646 {
1647 limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d\n"), pAssocReq->wpa.length);
1648 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1649 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
1650 palCopyMemory( pMac->hHdd,
1651 &pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
1652 pAssocReq->wpa.info,
1653 pAssocReq->wpa.length);
1654 pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1655 }
1656
1657 pMlmReassocInd->addIE.length = 0;
1658 if (pAssocReq->addIEPresent)
1659 {
1660 palCopyMemory( pMac->hHdd,
1661 &pMlmReassocInd->addIE.addIEdata,
1662 pAssocReq->addIE.addIEdata,
1663 pAssocReq->addIE.length);
1664
1665 pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
1666 }
1667
1668#ifdef WLAN_SOFTAP_FEATURE
1669 if(pAssocReq->wmeInfoPresent)
1670 {
1671
1672 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
1673 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d\n"), WNI_CFG_WME_ENABLED );
1674
1675 /* check whether AP is enabled with WMM */
1676 if(tmp)
1677 {
1678 pMlmReassocInd->WmmStaInfoPresent = 1;
1679 }
1680 else
1681 {
1682 pMlmReassocInd->WmmStaInfoPresent = 0;
1683 }
1684 /* Note: we are not rejecting Re-association here because IOT will fail */
1685
1686 }
1687#endif
1688
1689 // Required for indicating the frames to upper layer
1690 pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1691 pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
1692
1693 pMlmReassocInd->beaconPtr = psessionEntry->beacon;
1694 pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
1695
1696 limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
1697 palFreeMemory( pMac->hHdd, pMlmReassocInd);
1698 }
1699
1700 return;
1701
1702} /*** end limSendMlmAssocInd() ***/