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