blob: 184d46f32620e2bb3a2f6794cb9c08a8604d1193 [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)
Mohit Khanna23863762012-09-11 17:40:09 -0700214 limLog(pMac, LOGW, FL("received Assoc frame from a BC/MC address "MAC_ADDRESS_STR),
215 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
840 pHdr->sa,psessionEntry);
841
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 }
1110#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001111 pStaDs->baPolicyFlag = 0xFF;
1112 }
1113
1114
Jeff Johnsone7245742012-09-05 17:12:55 -07001115#ifdef WLAN_FEATURE_11AC
1116if (limPopulateMatchingRateSet(pMac,
1117 pStaDs,
1118 &(pAssocReq->supportedRates),
1119 &(pAssocReq->extendedRates),
1120 pAssocReq->HTCaps.supportedMCSSet,
1121 &(pAssocReq->propIEinfo.propRates),
1122 psessionEntry , &pAssocReq->VHTCaps)
1123 != eSIR_SUCCESS)
1124#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001125
1126 if (limPopulateMatchingRateSet(pMac,
1127 pStaDs,
1128 &(pAssocReq->supportedRates),
1129 &(pAssocReq->extendedRates),
1130 pAssocReq->HTCaps.supportedMCSSet,
1131 &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -07001132#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 {
1134 // Could not update hash table entry at DPH with rateset
1135 limLog(pMac, LOGE,
1136 FL("could not update hash entry at DPH for aid=%d, MacAddr:\n"),
1137 aid);
1138 limPrintMacAddr(pMac, pHdr->sa, LOGE);
1139
1140 // Release AID
1141 limReleaseAID(pMac, aid);
1142
1143
1144 limRejectAssociation(pMac, pHdr->sa,
1145 subType, true, authType, aid, true,
1146 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1147
1148 /*return it from here rather than goto error statement.This is done as the memory is getting free twice*/
1149 return;
1150 //goto error;
1151 }
1152
1153 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pStaDs->mlmStaContext.propRateSet,
1154 (tANI_U8 *) &(pAssocReq->propIEinfo.propRates),
1155 pAssocReq->propIEinfo.propRates.numPropRates + 1);
1156
1157 /// Add STA context at MAC HW (BMU, RHP & TFP)
1158
1159 pStaDs->qosMode = eANI_BOOLEAN_FALSE;
1160 pStaDs->lleEnabled = eANI_BOOLEAN_FALSE;
1161 if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET))
1162 {
1163 pStaDs->lleEnabled = eANI_BOOLEAN_TRUE;
1164 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1165 }
1166
1167 pStaDs->wmeEnabled = eANI_BOOLEAN_FALSE;
1168 pStaDs->wsmEnabled = eANI_BOOLEAN_FALSE;
1169 limGetWmeMode(psessionEntry, &wmeMode);
1170 //if ((! pStaDs->lleEnabled) && assoc.wmeInfoPresent && pMac->dph.gDphWmeEnabled)
1171 if ((! pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent && (wmeMode == eHAL_SET))
1172 {
1173 pStaDs->wmeEnabled = eANI_BOOLEAN_TRUE;
1174 pStaDs->qosMode = eANI_BOOLEAN_TRUE;
1175 limGetWsmMode(psessionEntry, &wsmMode);
1176 /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD
1177 can coexist */
1178#ifdef WLAN_SOFTAP_FEATURE
1179 if( pAssocReq->WMMInfoStation.present)
1180 {
1181 /* check whether AP supports or not */
1182 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)
1183 && (psessionEntry->apUapsdEnable == 0) && (pAssocReq->WMMInfoStation.acbe_uapsd
1184 || pAssocReq->WMMInfoStation.acbk_uapsd
1185 || pAssocReq->WMMInfoStation.acvo_uapsd
1186 || pAssocReq->WMMInfoStation.acvi_uapsd))
1187 {
1188
1189 /**
1190 * Received Re/Association Request from
1191 * STA when UPASD is not supported.
1192 */
1193 limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed\n" ));
1194 limRejectAssociation(pMac, pHdr->sa,
1195 subType, true, authType, aid, true,
1196 (tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1197
1198
1199 /*return it from here rather than goto error statement.This is done as the memory is getting free twice in this uapsd scenario*/
1200 return;
1201 //goto error;
1202 }
1203 else
1204 {
1205 /* update UAPSD and send it to LIM to add STA */
1206 pStaDs->qos.capability.qosInfo.acbe_uapsd = pAssocReq->WMMInfoStation.acbe_uapsd;
1207 pStaDs->qos.capability.qosInfo.acbk_uapsd = pAssocReq->WMMInfoStation.acbk_uapsd;
1208 pStaDs->qos.capability.qosInfo.acvo_uapsd = pAssocReq->WMMInfoStation.acvo_uapsd;
1209 pStaDs->qos.capability.qosInfo.acvi_uapsd = pAssocReq->WMMInfoStation.acvi_uapsd;
1210 pStaDs->qos.capability.qosInfo.maxSpLen = pAssocReq->WMMInfoStation.max_sp_length;
1211 }
1212 }
1213#endif
1214 //if (assoc.wsmCapablePresent && pMac->dph.gDphWsmEnabled)
1215 if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET))
1216 pStaDs->wsmEnabled = eANI_BOOLEAN_TRUE;
1217
1218 }
1219
1220 // Re/Assoc Response frame to requesting STA
1221 pStaDs->mlmStaContext.subType = subType;
1222
1223 if (pAssocReq->propIEinfo.aniIndicator)
1224 pStaDs->aniPeer = 1;
1225
1226 // BTAMP: Storing the parsed assoc request in the psessionEntry array
1227 psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
1228
1229 /* BTAMP: If STA context already exist (ie. updateContext = 1)
1230 * for this STA, then we should delete the old one, and add
1231 * the new STA. This is taken care of in the limDelSta() routine.
1232 *
1233 * Prior to BTAMP, we were setting this flag so that when
1234 * PE receives SME_ASSOC_CNF, and if this flag is set, then
1235 * PE shall delete the old station and then add. But now in
1236 * BTAMP, we're directly adding station before waiting for
1237 * SME_ASSOC_CNF, so we can do this now.
1238 */
1239 if (!updateContext)
1240 {
1241 pStaDs->mlmStaContext.updateContext = 0;
1242
1243 // BTAMP: Add STA context at HW - issue WDA_ADD_STA_REQ to HAL
1244 if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
1245 {
1246 limLog(pMac, LOGE, FL("could not Add STA with assocId=%d\n"), pStaDs->assocId);
1247 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType,
1248 true, pStaDs->mlmStaContext.authType, pStaDs->assocId, true,
1249 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1250
1251 /*return it from here rather than goto error statement.This is done as the memory is getting free twice*/
1252 return;
1253 //goto error;
1254 }
1255 }
1256 else
1257 {
1258 pStaDs->mlmStaContext.updateContext = 1;
1259
1260#ifdef WLAN_SOFTAP_FEATURE
1261 mlmPrevState = pStaDs->mlmStaContext.mlmState;
1262
1263 /* As per the HAL/FW needs the reassoc req need not be calling limDelSta */
1264 if(subType != LIM_REASSOC)
1265 {
1266 //we need to set the mlmState here in order differentiate in limDelSta.
1267 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
1268 if(limDelSta(pMac, pStaDs, true, psessionEntry) != eSIR_SUCCESS)
1269 {
1270 limLog(pMac, LOGE, FL("could not DEL STA with assocId=%d staId %d\n"), pStaDs->assocId, pStaDs->staIndex);
1271 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1272 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
1273
1274 //Restoring the state back.
1275 pStaDs->mlmStaContext.mlmState = mlmPrevState;
1276 goto error;
1277 }
1278 }
1279 else
1280 {
1281 /* mlmState is changed in limAddSta context */
1282 /* use the same AID, already allocated */
1283 if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
1284 {
1285 limLog( pMac, LOGE, FL( "AP do not support UPASD REASSOC Failed\n" ));
1286 limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
1287 pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
1288
1289 //Restoring the state back.
1290 pStaDs->mlmStaContext.mlmState = mlmPrevState;
1291 goto error;
1292 }
1293
1294 }
1295#endif
1296
1297 }
1298
1299 return;
1300
1301error:
1302 if (pAssocReq != NULL)
1303 {
1304 if ( pAssocReq->assocReqFrame )
1305 {
1306 palFreeMemory(pMac->hHdd, pAssocReq->assocReqFrame);
1307 pAssocReq->assocReqFrame = NULL;
1308 }
1309
1310 if (palFreeMemory(pMac->hHdd, pAssocReq) != eHAL_STATUS_SUCCESS)
1311 {
1312 limLog(pMac, LOGP, FL("PalFree Memory failed \n"));
1313 return;
1314 }
1315 }
1316
Jeff Johnsone7245742012-09-05 17:12:55 -07001317 /* If it is not duplicate Assoc request then only make to Null */
1318 if ((pStaDs != NULL) &&
1319 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001320 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001321
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 return;
1323
1324} /*** end limProcessAssocReqFrame() ***/
1325
1326
1327
1328/**---------------------------------------------------------------
1329\fn limSendMlmAssocInd
1330\brief This function sends either LIM_MLM_ASSOC_IND
1331\ or LIM_MLM_REASSOC_IND to SME.
1332\
1333\param pMac
1334\param *pStaDs - Station DPH hash entry
1335\param psessionEntry - PE session entry
1336\return None
1337
1338 * ?????? How do I get
1339 * - subtype =====> psessionEntry->parsedAssocReq.reassocRequest
1340 * - aid =====> pStaDs->assocId
1341 * - pHdr->sa =====> pStaDs->staAddr
1342 * - authType
1343 * - pHdr->seqControl =====> no longer needed
1344 * - pStaDs
1345------------------------------------------------------------------*/
1346void limSendMlmAssocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1347{
1348 tpLimMlmAssocInd pMlmAssocInd = NULL;
1349 tpLimMlmReassocInd pMlmReassocInd;
1350 tpSirAssocReq pAssocReq;
1351 tANI_U16 temp;
1352 tANI_U32 phyMode;
1353 tANI_U8 subType;
1354#ifdef WLAN_SOFTAP_FEATURE
1355 tANI_U8 *wpsIe = NULL;
1356#endif
1357 tANI_U32 tmp;
1358// tANI_U16 statusCode;
1359 tANI_U16 i, j=0;
1360
1361 // Get a copy of the already parsed Assoc Request
1362 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
1363
1364 // Get the phyMode
1365 limGetPhyMode(pMac, &phyMode, psessionEntry);
1366
1367 // Extract pre-auth context for the peer BTAMP-STA, if any.
1368
1369 // Determiine if its Assoc or ReAssoc Request
1370 if (pAssocReq->reassocRequest == 1)
1371 subType = LIM_REASSOC;
1372 else
1373 subType = LIM_ASSOC;
1374#ifdef WLAN_SOFTAP_FEATURE
1375 if (subType == LIM_ASSOC || subType == LIM_REASSOC)
1376#else
1377 if (subType == LIM_ASSOC )
1378#endif
1379 {
1380 temp = sizeof(tLimMlmAssocInd);
1381#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1382 temp += pAssocReq->propIEinfo.numBss * sizeof(tSirNeighborBssInfo);
1383#endif
1384
1385 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAssocInd, temp))
1386 {
1387 limReleaseAID(pMac, pStaDs->assocId);
1388 limLog(pMac, LOGP, FL("palAllocateMemory failed for pMlmAssocInd\n"));
1389 return;
1390 }
1391 palZeroMemory( pMac->hHdd, pMlmAssocInd, temp);
1392
1393 palCopyMemory( pMac->hHdd,(tANI_U8 *)pMlmAssocInd->peerMacAddr,(tANI_U8 *)pStaDs->staAddr,sizeof(tSirMacAddr));
1394
1395 pMlmAssocInd->aid = pStaDs->assocId;
1396 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pMlmAssocInd->ssId,(tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
1397 pMlmAssocInd->sessionId = psessionEntry->peSessionId;
1398 pMlmAssocInd->authType = pStaDs->mlmStaContext.authType;
1399
1400#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1401 // Note for BTAMP: no need to fill in pMlmAssocInd->seqNum
1402 pMlmAssocInd->wniIndicator = (tAniBool) pAssocReq->propIEinfo.aniIndicator;
1403 pMlmAssocInd->bpIndicator = (tAniBool) pAssocReq->propIEinfo.bpIndicator;
1404 pMlmAssocInd->bpType = (tSirBpIndicatorType) pAssocReq->propIEinfo.bpType;
1405 if (pAssocReq->extendedRatesPresent)
1406 {
1407 pMlmAssocInd->nwType = eSIR_11G_NW_TYPE;
1408 limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_SET);
1409 }
1410 else
1411 {
1412 if (phyMode == WNI_CFG_PHY_MODE_11A)
1413 pMlmAssocInd->nwType = eSIR_11A_NW_TYPE;
1414 else
1415 {
1416 pMlmAssocInd->nwType = eSIR_11B_NW_TYPE;
1417 limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_CLEAR);
1418 }
1419 }
1420 pMlmAssocInd->assocType = (tSirAssocType)pAssocReq->propIEinfo.assocType;
1421 pMlmAssocInd->load.numStas = pMac->lim.gLimNumOfCurrentSTAs;
1422 pMlmAssocInd->load.channelUtilization =(pMac->lim.gpLimMeasData) ? pMac->lim.gpLimMeasData->avgChannelUtilization : 0;
1423 pMlmAssocInd->numBss = (tANI_U32) pAssocReq->propIEinfo.numBss;
1424 if (pAssocReq->propIEinfo.numBss)
1425 {
1426 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmAssocInd->neighborList,(tANI_U8 *)pAssocReq->propIEinfo.pBssList,
1427 (sizeof(tSirNeighborBssInfo) * pAssocReq->propIEinfo.numBss));
1428 }
1429#endif
1430 pMlmAssocInd->capabilityInfo = pAssocReq->capabilityInfo;
1431
1432 // Fill in RSN IE information
1433 pMlmAssocInd->rsnIE.length = 0;
1434#ifdef WLAN_SOFTAP_FEATURE
1435 // if WPS IE is present, ignore RSN IE
1436 if (pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
1437 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1438 }
1439 if (pAssocReq->rsnPresent && (NULL == wpsIe))
1440#else
1441 if (pAssocReq->rsnPresent)
1442#endif
1443 {
1444 limLog(pMac, LOG2, FL("Assoc Req RSN IE len = %d\n"), pAssocReq->rsn.length);
1445 pMlmAssocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1446 pMlmAssocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1447 pMlmAssocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
1448 palCopyMemory( pMac->hHdd,
1449 &pMlmAssocInd->rsnIE.rsnIEdata[2],
1450 pAssocReq->rsn.info,
1451 pAssocReq->rsn.length);
1452 }
1453
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 // Fill in 802.11h related info
1455 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1456 {
1457 pMlmAssocInd->spectrumMgtIndicator = eSIR_TRUE;
1458 pMlmAssocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1459 pMlmAssocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1460 limConvertSupportedChannels(pMac, pMlmAssocInd, pAssocReq);
1461 }
1462 else
1463 pMlmAssocInd->spectrumMgtIndicator = eSIR_FALSE;
1464
1465
1466#ifdef WLAN_SOFTAP_FEATURE
1467 /* This check is to avoid extra Sec IEs present incase of WPS */
1468 if (pAssocReq->wpaPresent && (NULL == wpsIe))
1469#else
1470 if ((pAssocReq->wpaPresent) && (pMlmAssocInd->rsnIE.length < SIR_MAC_MAX_IE_LENGTH))
1471#endif
1472 {
1473 if((pMlmAssocInd->rsnIE.length + pAssocReq->wpa.length) >= SIR_MAC_MAX_IE_LENGTH)
1474 {
1475 PELOGE(limLog(pMac, LOGE, FL("rsnIEdata index out of bounds %d\n"), pMlmAssocInd->rsnIE.length);)
1476 return;
1477 }
1478 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1479 pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
1480 palCopyMemory( pMac->hHdd,
1481 &pMlmAssocInd->rsnIE.rsnIEdata[pMlmAssocInd->rsnIE.length + 2],
1482 pAssocReq->wpa.info,
1483 pAssocReq->wpa.length);
1484 pMlmAssocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1485 }
1486
1487
1488 pMlmAssocInd->addIE.length = 0;
1489 if (pAssocReq->addIEPresent)
1490 {
1491 palCopyMemory( pMac->hHdd,
1492 &pMlmAssocInd->addIE.addIEdata,
1493 pAssocReq->addIE.addIEdata,
1494 pAssocReq->addIE.length);
1495
1496 pMlmAssocInd->addIE.length = pAssocReq->addIE.length;
1497 }
1498
1499#ifdef WLAN_SOFTAP_FEATURE
1500 if(pAssocReq->wmeInfoPresent)
1501 {
1502
1503 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
1504 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d\n"), WNI_CFG_WME_ENABLED );
1505
1506 /* check whether AP is enabled with WMM */
1507 if(tmp)
1508 {
1509 pMlmAssocInd->WmmStaInfoPresent = 1;
1510 }
1511 else
1512 {
1513 pMlmAssocInd->WmmStaInfoPresent= 0;
1514 }
1515 /* Note: we are not rejecting association here because IOT will fail */
1516
1517 }
1518#endif
1519
1520 // Required for indicating the frames to upper layer
1521 pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1522 pMlmAssocInd->assocReqPtr = pAssocReq->assocReqFrame;
1523
1524 pMlmAssocInd->beaconPtr = psessionEntry->beacon;
1525 pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
1526
1527 limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
1528 palFreeMemory( pMac->hHdd, pMlmAssocInd);
1529 }
1530 else
1531 {
1532 // If its of Reassociation Request, then post LIM_MLM_REASSOC_IND
1533 temp = sizeof(tLimMlmReassocInd);
1534
1535#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
1536 temp += pAssocReq->propIEinfo.numBss * sizeof(tSirNeighborBssInfo);
1537#endif
1538 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocInd, temp))
1539 {
1540 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pMlmReassocInd\n"));
1541 limReleaseAID(pMac, pStaDs->assocId);
1542 return;
1543 }
1544 palZeroMemory( pMac->hHdd, pMlmReassocInd, temp);
1545
1546 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmReassocInd->peerMacAddr, (tANI_U8 *)pStaDs->staAddr, sizeof(tSirMacAddr));
1547 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMlmReassocInd->currentApAddr, (tANI_U8 *)&(pAssocReq->currentApAddr), sizeof(tSirMacAddr));
1548 pMlmReassocInd->aid = pStaDs->assocId;
1549 pMlmReassocInd->authType = pStaDs->mlmStaContext.authType;
1550 palCopyMemory( pMac->hHdd,(tANI_U8 *)&pMlmReassocInd->ssId, (tANI_U8 *)&(pAssocReq->ssId), pAssocReq->ssId.length + 1);
1551
1552#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1553 // Note for BTAMP: no need to fill in pMlmAssocInd->seqNum
1554 pMlmReassocInd->wniIndicator = (tAniBool) pAssocReq->propIEinfo.aniIndicator;
1555 pMlmReassocInd->bpIndicator = (tAniBool) pAssocReq->propIEinfo.bpIndicator;
1556 pMlmReassocInd->bpType = (tSirBpIndicatorType) pAssocReq->propIEinfo.bpType;
1557 if (pAssocReq->extendedRatesPresent)
1558 {
1559 pMlmReassocInd->nwType = eSIR_11G_NW_TYPE;
1560 limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_SET);
1561 }
1562 else
1563 {
1564 if (phyMode == WNI_CFG_PHY_MODE_11A)
1565 pMlmReassocInd->nwType = eSIR_11A_NW_TYPE;
1566 else
1567 {
1568 pMlmReassocInd->nwType = eSIR_11B_NW_TYPE;
1569 limSetStaHashErpMode(pMac, pStaDs->assocId, eHAL_CLEAR);
1570 }
1571 }
1572
1573 pMlmReassocInd->reassocType = (tSirAssocType)pAssocReq->propIEinfo.assocType;
1574 pMlmReassocInd->load.numStas = pMac->lim.gLimNumOfCurrentSTAs;
1575 pMlmReassocInd->load.channelUtilization = (pMac->lim.gpLimMeasData) ?
1576 pMac->lim.gpLimMeasData->avgChannelUtilization : 0;
1577 pMlmReassocInd->numBss = (tANI_U32) pAssocReq->propIEinfo.numBss;
1578 if (pAssocReq->propIEinfo.numBss)
1579 {
1580 palCopyMemory( pMac->hHdd,
1581 (tANI_U8 *) pMlmReassocInd->neighborList,
1582 (tANI_U8 *) pAssocReq->propIEinfo.pBssList,
1583 (sizeof(tSirNeighborBssInfo) * pAssocReq->propIEinfo.numBss));
1584 }
1585#endif
1586 if (pAssocReq->propIEinfo.aniIndicator)
1587 pStaDs->aniPeer = 1;
1588
1589 pMlmReassocInd->capabilityInfo = pAssocReq->capabilityInfo;
1590 pMlmReassocInd->rsnIE.length = 0;
1591
1592#ifdef WLAN_SOFTAP_FEATURE
1593 if (pAssocReq->addIEPresent && pAssocReq->addIE.length )
1594 wpsIe = limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
1595
1596 if (pAssocReq->rsnPresent && (NULL == wpsIe))
1597#else
1598 if (pAssocReq->rsnPresent)
1599#endif
1600 {
1601 limLog(pMac, LOG2, FL("Assoc Req: RSN IE length = %d\n"), pAssocReq->rsn.length);
1602 pMlmReassocInd->rsnIE.length = 2 + pAssocReq->rsn.length;
1603 pMlmReassocInd->rsnIE.rsnIEdata[0] = SIR_MAC_RSN_EID;
1604 pMlmReassocInd->rsnIE.rsnIEdata[1] = pAssocReq->rsn.length;
1605 palCopyMemory( pMac->hHdd, &pMlmReassocInd->rsnIE.rsnIEdata[2], pAssocReq->rsn.info, pAssocReq->rsn.length);
1606 }
1607
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 // 802.11h support
1609 if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
1610 {
1611 pMlmReassocInd->spectrumMgtIndicator = eSIR_TRUE;
1612 pMlmReassocInd->powerCap.minTxPower = pAssocReq->powerCapability.minTxPower;
1613 pMlmReassocInd->powerCap.maxTxPower = pAssocReq->powerCapability.maxTxPower;
1614 pMlmReassocInd->supportedChannels.numChnl = (tANI_U8)(pAssocReq->supportedChannels.length / 2);
1615
1616 limLog(pMac, LOG1,
1617 FL("Sending Reassoc Ind: spectrum ON, minPwr %d, maxPwr %d, numChnl %d\n"),
1618 pMlmReassocInd->powerCap.minTxPower,
1619 pMlmReassocInd->powerCap.maxTxPower,
1620 pMlmReassocInd->supportedChannels.numChnl);
1621
1622 for(i=0; i < pMlmReassocInd->supportedChannels.numChnl; i++)
1623 {
1624 pMlmReassocInd->supportedChannels.channelList[i] = pAssocReq->supportedChannels.supportedChannels[j];
1625 limLog(pMac, LOG1, FL("Sending ReassocInd: chn[%d] = %d \n"),
1626 i, pMlmReassocInd->supportedChannels.channelList[i]);
1627 j+=2;
1628 }
1629 }
1630 else
1631 pMlmReassocInd->spectrumMgtIndicator = eSIR_FALSE;
1632
1633
1634#ifdef WLAN_SOFTAP_FEATURE
1635 /* This check is to avoid extra Sec IEs present incase of WPS */
1636 if (pAssocReq->wpaPresent && (NULL == wpsIe))
1637#else
1638 if (pAssocReq->wpaPresent)
1639#endif
1640 {
1641 limLog(pMac, LOG2, FL("Received WPA IE length in Assoc Req is %d\n"), pAssocReq->wpa.length);
1642 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length] = SIR_MAC_WPA_EID;
1643 pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 1] = pAssocReq->wpa.length;
1644 palCopyMemory( pMac->hHdd,
1645 &pMlmReassocInd->rsnIE.rsnIEdata[pMlmReassocInd->rsnIE.length + 2],
1646 pAssocReq->wpa.info,
1647 pAssocReq->wpa.length);
1648 pMlmReassocInd->rsnIE.length += 2 + pAssocReq->wpa.length;
1649 }
1650
1651 pMlmReassocInd->addIE.length = 0;
1652 if (pAssocReq->addIEPresent)
1653 {
1654 palCopyMemory( pMac->hHdd,
1655 &pMlmReassocInd->addIE.addIEdata,
1656 pAssocReq->addIE.addIEdata,
1657 pAssocReq->addIE.length);
1658
1659 pMlmReassocInd->addIE.length = pAssocReq->addIE.length;
1660 }
1661
1662#ifdef WLAN_SOFTAP_FEATURE
1663 if(pAssocReq->wmeInfoPresent)
1664 {
1665
1666 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WME_ENABLED, &tmp) != eSIR_SUCCESS)
1667 limLog(pMac, LOGP, FL("wlan_cfgGetInt failed for id %d\n"), WNI_CFG_WME_ENABLED );
1668
1669 /* check whether AP is enabled with WMM */
1670 if(tmp)
1671 {
1672 pMlmReassocInd->WmmStaInfoPresent = 1;
1673 }
1674 else
1675 {
1676 pMlmReassocInd->WmmStaInfoPresent = 0;
1677 }
1678 /* Note: we are not rejecting Re-association here because IOT will fail */
1679
1680 }
1681#endif
1682
1683 // Required for indicating the frames to upper layer
1684 pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
1685 pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
1686
1687 pMlmReassocInd->beaconPtr = psessionEntry->beacon;
1688 pMlmReassocInd->beaconLength = psessionEntry->bcnLen;
1689
1690 limPostSmeMessage(pMac, LIM_MLM_REASSOC_IND, (tANI_U32 *) pMlmReassocInd);
1691 palFreeMemory( pMac->hHdd, pMlmReassocInd);
1692 }
1693
1694 return;
1695
1696} /*** end limSendMlmAssocInd() ***/