blob: 33844ec476ad4e5cf097eeda55b624d2455909c4 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +05302 * Copyright (c) 2011-2015, 2018 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 *
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file limSmeReqUtils.cc contains the utility functions
31 * for processing SME request messages.
32 * Author: Chandra Modumudi
33 * Date: 02/11/02
34 * History:-
35 * Date Modified by Modification Information
36 * --------------------------------------------------------------------
37 * 05/26/10 js WPA handling in (Re)Assoc frames
Jeff Johnson3c3e1782013-02-27 10:48:42 -080038 *
Jeff Johnson295189b2012-06-20 16:38:30 -070039 */
40
41#include "wniApi.h"
Satyanarayana Dash6f438272015-03-03 18:01:06 +053042#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070043#include "cfgApi.h"
44#include "sirApi.h"
45#include "schApi.h"
46#include "utilsApi.h"
47#include "limTypes.h"
48#include "limUtils.h"
49#include "limAssocUtils.h"
50#include "limSecurityUtils.h"
51#include "limSerDesUtils.h"
52
53
54
55/**
56 * limIsRSNieValidInSmeReqMessage()
57 *
58 *FUNCTION:
59 * This function is called to verify if the RSN IE
60 * received in various SME_REQ messages is valid or not
61 *
62 *LOGIC:
63 * RSN IE validity checks are performed in this function
64 *
65 *ASSUMPTIONS:
66 *
67 *NOTE:
68 *
69 * @param pMac Pointer to Global MAC structure
70 * @param pRSNie Pointer to received RSN IE
71 * @return true when RSN IE is valid, false otherwise
72 */
73
74static tANI_U8
75limIsRSNieValidInSmeReqMessage(tpAniSirGlobal pMac, tpSirRSNie pRSNie)
76{
77 tANI_U8 startPos = 0;
78 tANI_U32 privacy, val;
79 int len;
80
81 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
82 &privacy) != eSIR_SUCCESS)
83 {
84 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -070085 FL("Unable to retrieve POI from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -070086 }
87
88 if (wlan_cfgGetInt(pMac, WNI_CFG_RSN_ENABLED,
89 &val) != eSIR_SUCCESS)
90 {
91 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -070092 FL("Unable to retrieve RSN_ENABLED from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -070093 }
94
95 if (pRSNie->length && (!privacy || !val))
96 {
97 // Privacy & RSN not enabled in CFG.
98 /**
99 * In order to allow mixed mode for Guest access
100 * allow BSS creation/join with no Privacy capability
101 * yet advertising WPA IE
102 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700103 PELOG1(limLog(pMac, LOG1, FL("RSN ie len %d but PRIVACY %d RSN %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700104 pRSNie->length, privacy, val);)
105 }
106
107 if (pRSNie->length)
108 {
109 if ((pRSNie->rsnIEdata[0] != DOT11F_EID_RSN) &&
110 (pRSNie->rsnIEdata[0] != DOT11F_EID_WPA)
111#ifdef FEATURE_WLAN_WAPI
112 && (pRSNie->rsnIEdata[0] != DOT11F_EID_WAPI)
113#endif
114 )
115 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700116 limLog(pMac, LOGE, FL("RSN/WPA/WAPI EID %d not [%d || %d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700117 pRSNie->rsnIEdata[0], DOT11F_EID_RSN,
118 DOT11F_EID_WPA);
119 return false;
120 }
121
122 len = pRSNie->length;
123 startPos = 0;
124 while(len > 0)
125 {
126 // Check validity of RSN IE
127 if (pRSNie->rsnIEdata[startPos] == DOT11F_EID_RSN)
128 {
129 if((pRSNie->rsnIEdata[startPos+1] > DOT11F_IE_RSN_MAX_LEN) ||
130 (pRSNie->rsnIEdata[startPos+1] < DOT11F_IE_RSN_MIN_LEN))
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700131 {
132 limLog(pMac, LOGE, FL("RSN IE len %d not [%d,%d]"),
133 pRSNie->rsnIEdata[startPos+1], DOT11F_IE_RSN_MIN_LEN,
134 DOT11F_IE_RSN_MAX_LEN);
135 return false;
136 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 }
138 else if(pRSNie->rsnIEdata[startPos] == DOT11F_EID_WPA)
Jeff Johnson295189b2012-06-20 16:38:30 -0700139 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700140 // Check validity of WPA IE
141 if (SIR_MAC_MAX_IE_LENGTH > startPos)
142 {
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -0700143 if (startPos <= (SIR_MAC_MAX_IE_LENGTH - sizeof(tANI_U32)))
144 val = sirReadU32((tANI_U8 *) &pRSNie->rsnIEdata[startPos + 2]);
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700145 if((pRSNie->rsnIEdata[startPos + 1] < DOT11F_IE_WPA_MIN_LEN) ||
146 (pRSNie->rsnIEdata[startPos + 1] > DOT11F_IE_WPA_MAX_LEN) ||
147 (SIR_MAC_WPA_OUI != val))
148 {
149 limLog(pMac, LOGE,
150 FL("WPA IE len %d not [%d,%d] OR data 0x%x not 0x%x"),
151 pRSNie->rsnIEdata[startPos+1], DOT11F_IE_WPA_MIN_LEN,
152 DOT11F_IE_WPA_MAX_LEN, val, SIR_MAC_WPA_OUI);
Jeff Johnson295189b2012-06-20 16:38:30 -0700153
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700154 return false;
155 }
156 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700157 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700158#ifdef FEATURE_WLAN_WAPI
159 else if(pRSNie->rsnIEdata[startPos] == DOT11F_EID_WAPI)
160 {
161 if((pRSNie->rsnIEdata[startPos+1] > DOT11F_IE_WAPI_MAX_LEN) ||
162 (pRSNie->rsnIEdata[startPos+1] < DOT11F_IE_WAPI_MIN_LEN))
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700163 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700165 FL("WAPI IE len %d not [%d,%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700166 pRSNie->rsnIEdata[startPos+1], DOT11F_IE_WAPI_MIN_LEN,
167 DOT11F_IE_WAPI_MAX_LEN);
168
169 return false;
170 }
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700171 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700172#endif
173 else
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700174 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700175 //we will never be here, simply for completeness
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700176 return false;
177 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 startPos += 2 + pRSNie->rsnIEdata[startPos+1]; //EID + length field + length
179 len -= startPos;
180 }//while
181
182 }
183
184 return true;
185} /*** end limIsRSNieValidInSmeReqMessage() ***/
186
187/**
188 * limIsAddieValidInSmeReqMessage()
189 *
190 *FUNCTION:
191 * This function is called to verify if the Add IE
192 * received in various SME_REQ messages is valid or not
193 *
194 *LOGIC:
195 * Add IE validity checks are performed on only length
196 *
197 *ASSUMPTIONS:
198 *
199 *NOTE:
200 *
201 * @param pMac Pointer to Global MAC structure
202 * @param pWSCie Pointer to received WSC IE
203 * @return true when WSC IE is valid, false otherwise
204 */
205
206static tANI_U8
207limIsAddieValidInSmeReqMessage(tpAniSirGlobal pMac, tpSirAddie pAddie)
208{
209 int left = pAddie->length;
210 tANI_U8 *ptr = pAddie->addIEdata;
211 tANI_U8 elem_id, elem_len;
212
213 if (left == 0)
214 return true;
215
216 while(left >= 2)
217 {
218 elem_id = ptr[0];
219 elem_len = ptr[1];
220 left -= 2;
221 if(elem_len > left)
222 {
223 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700224 FL("****Invalid Add IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 elem_id,elem_len,left);
226 return false;
227 }
228
229 left -= elem_len;
230 ptr += (elem_len + 2);
231 }
232 // there shouldn't be any left byte
233
234
235 return true;
236} /*** end limIsAddieValidInSmeReqMessage() ***/
237
Jeff Johnson295189b2012-06-20 16:38:30 -0700238/**
239 * limSetRSNieWPAiefromSmeStartBSSReqMessage()
240 *
241 *FUNCTION:
242 * This function is called to verify if the RSN IE
243 * received in various SME_REQ messages is valid or not
244 *
245 *LOGIC:
246 * RSN IE validity checks are performed in this function
247 *
248 *ASSUMPTIONS:
249 *
250 *NOTE:
251 *
252 * @param pMac Pointer to Global MAC structure
253 * @param pRSNie Pointer to received RSN IE
254 * @return true when RSN IE is valid, false otherwise
255 */
256
257tANI_U8
258limSetRSNieWPAiefromSmeStartBSSReqMessage(tpAniSirGlobal pMac,
259 tpSirRSNie pRSNie,
260 tpPESession pSessionEntry)
261{
262 tANI_U8 wpaIndex = 0;
263 tANI_U32 privacy, val;
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530264 tANI_U32 status;
Jeff Johnson295189b2012-06-20 16:38:30 -0700265
266 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
267 &privacy) != eSIR_SUCCESS)
268 {
269 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 FL("Unable to retrieve POI from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 }
272
273 if (wlan_cfgGetInt(pMac, WNI_CFG_RSN_ENABLED,
274 &val) != eSIR_SUCCESS)
275 {
276 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700277 FL("Unable to retrieve RSN_ENABLED from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 }
279
280 if (pRSNie->length && (!privacy || !val))
281 {
282 // Privacy & RSN not enabled in CFG.
283 /**
284 * In order to allow mixed mode for Guest access
285 * allow BSS creation/join with no Privacy capability
286 * yet advertising WPA IE
287 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 PELOG1(limLog(pMac, LOG1, FL("RSN ie len %d but PRIVACY %d RSN %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 pRSNie->length, privacy, val);)
290 }
291
292 if (pRSNie->length)
293 {
294 if ((pRSNie->rsnIEdata[0] != SIR_MAC_RSN_EID) &&
295 (pRSNie->rsnIEdata[0] != SIR_MAC_WPA_EID))
296 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700297 limLog(pMac, LOGE, FL("RSN/WPA EID %d not [%d || %d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 pRSNie->rsnIEdata[0], SIR_MAC_RSN_EID,
299 SIR_MAC_WPA_EID);
300 return false;
301 }
302
303 // Check validity of RSN IE
304 if ((pRSNie->rsnIEdata[0] == SIR_MAC_RSN_EID) &&
305#if 0 // Comparison always false
306 (pRSNie->rsnIEdata[1] > SIR_MAC_RSN_IE_MAX_LENGTH) ||
307#endif
308 (pRSNie->rsnIEdata[1] < SIR_MAC_RSN_IE_MIN_LENGTH))
309 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 limLog(pMac, LOGE, FL("RSN IE len %d not [%d,%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 pRSNie->rsnIEdata[1], SIR_MAC_RSN_IE_MIN_LENGTH,
312 SIR_MAC_RSN_IE_MAX_LENGTH);
313 return false;
314 }
315
316 if (pRSNie->length > pRSNie->rsnIEdata[1] + 2)
317 {
318 if (pRSNie->rsnIEdata[0] != SIR_MAC_RSN_EID)
319 {
320 limLog(pMac,
321 LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700322 FL("First byte[%d] in rsnIEdata is not RSN_EID"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 pRSNie->rsnIEdata[1]);
324 return false;
325 }
326
327 limLog(pMac,
328 LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700329 FL("WPA IE is present along with WPA2 IE"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 wpaIndex = 2 + pRSNie->rsnIEdata[1];
331 }
332 else if ((pRSNie->length == pRSNie->rsnIEdata[1] + 2) &&
333 (pRSNie->rsnIEdata[0] == SIR_MAC_RSN_EID))
334 {
335 limLog(pMac,
336 LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 FL("Only RSN IE is present"));
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530338 status = dot11fUnpackIeRSN(pMac,&pRSNie->rsnIEdata[2],
Abhinav Kumare58f3bc2018-04-03 12:59:05 +0530339 pRSNie->rsnIEdata[1],
340 &pSessionEntry->gStartBssRSNIe);
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530341 if (DOT11F_FAILED(status))
342 {
343 limLog(pMac,
344 LOGE,FL("unpack failed for RSN IE (0x%08x)"),
345 status);
346 return false;
347 }
348 return true;
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 }
350 else if ((pRSNie->length == pRSNie->rsnIEdata[1] + 2) &&
351 (pRSNie->rsnIEdata[0] == SIR_MAC_WPA_EID))
352 {
353 limLog(pMac,
354 LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 FL("Only WPA IE is present"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530357 status = dot11fUnpackIeWPA(pMac,&pRSNie->rsnIEdata[6],
Abhinav Kumare58f3bc2018-04-03 12:59:05 +0530358 pRSNie->rsnIEdata[1] - 4,
359 &pSessionEntry->gStartBssWPAIe);
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530360 if (DOT11F_FAILED(status))
361 {
362 limLog(pMac,
363 LOGE,FL("unpack failed for WPA IE (0x%08x)"),
364 status);
365 return false;
366 }
367 return true;
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 }
369
370 // Check validity of WPA IE
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530371 if(wpaIndex +4 < SIR_MAC_MAX_IE_LENGTH )
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 {
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530373 val = sirReadU32((tANI_U8 *) &pRSNie->rsnIEdata[wpaIndex + 2]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700374
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530375 if ((pRSNie->rsnIEdata[wpaIndex] == SIR_MAC_WPA_EID) &&
376#if 0 // Comparison always false
377 (pRSNie->rsnIEdata[wpaIndex + 1] > SIR_MAC_WPA_IE_MAX_LENGTH) ||
378#endif
379 ((pRSNie->rsnIEdata[wpaIndex + 1] < SIR_MAC_WPA_IE_MIN_LENGTH) ||
380 (SIR_MAC_WPA_OUI != val)))
381 {
382 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700383 FL("WPA IE len %d not [%d,%d] OR data 0x%x not 0x%x"),
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530384 pRSNie->rsnIEdata[1], SIR_MAC_RSN_IE_MIN_LENGTH,
385 SIR_MAC_RSN_IE_MAX_LENGTH, val, SIR_MAC_WPA_OUI);
386
387 return false;
388 }
389 else
390 {
391 /* Both RSN and WPA IEs are present */
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530392 status = dot11fUnpackIeRSN(pMac,&pRSNie->rsnIEdata[2],
393 pRSNie->rsnIEdata[1], &pSessionEntry->gStartBssRSNIe);
394 if (DOT11F_FAILED(status))
395 {
396 limLog(pMac,LOGE,FL("unpack failed for RSN IE status:(0x%08x)"),
397 status);
398 return false;
399 }
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530400
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530401 status = dot11fUnpackIeWPA(pMac,&pRSNie->rsnIEdata[wpaIndex + 6],
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530402 pRSNie->rsnIEdata[wpaIndex + 1]-4,
403 &pSessionEntry->gStartBssWPAIe);
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530404 if (DOT11F_FAILED(status))
405 {
406 limLog(pMac, LOGE,FL("unpack failed for WPA IE status:(0x%08x)"),
407 status);
408 return false;
409 }
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530410
411 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 }
413 else
414 {
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530415 return false;
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 }
417 }
418
419 return true;
420} /*** end limSetRSNieWPAiefromSmeStartBSSReqMessage() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700421
Jeff Johnson295189b2012-06-20 16:38:30 -0700422
423
424
425/**
426 * limIsBssDescrValidInSmeReqMessage()
427 *
428 *FUNCTION:
429 * This function is called to verify if the BSS Descr
430 * received in various SME_REQ messages is valid or not
431 *
432 *LOGIC:
433 * BSS Descritipion validity checks are performed in this function
434 *
435 *ASSUMPTIONS:
436 *
437 *NOTE:
438 *
439 * @param pMac Pointer to Global MAC structure
440 * @param pBssDescr Pointer to received Bss Descritipion
441 * @return true when BSS description is valid, false otherwise
442 */
443
444static tANI_U8
445limIsBssDescrValidInSmeReqMessage(tpAniSirGlobal pMac,
446 tpSirBssDescription pBssDescr)
447{
448 tANI_U8 valid = true;
449
450 if (limIsAddrBC(pBssDescr->bssId) ||
451 !pBssDescr->channelId)
452 {
453 valid = false;
454 goto end;
455 }
456
457end:
458 return valid;
459} /*** end limIsBssDescrValidInSmeReqMessage() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700460
461
462
463/**
464 * limIsSmeStartReqValid()
465 *
466 *FUNCTION:
467 * This function is called by limProcessSmeReqMessages() upon
468 * receiving SME_START_REQ message from application.
469 *
470 *LOGIC:
471 * Message validity checks are performed in this function
472 *
473 *ASSUMPTIONS:
474 *
475 *NOTE:
476 *
477 * @param pMsg - Pointer to received SME_START_BSS_REQ message
478 * @return true when received SME_START_REQ is formatted correctly
479 * false otherwise
480 */
481
482tANI_U8
483limIsSmeStartReqValid(tpAniSirGlobal pMac, tANI_U32 *pMsg)
484{
485 tANI_U8 valid = true;
486
487 if (((tpSirSmeStartReq) pMsg)->length != sizeof(tSirSmeStartReq))
488 {
489 /**
490 * Invalid length in START_REQ message
491 * Log error.
492 */
493 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 FL("Invalid length %d in eWNI_SME_START_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 ((tpSirSmeStartReq) pMsg)->length);
496
497 valid = false;
498 goto end;
499 }
500
501end:
502 return valid;
503} /*** end limIsSmeStartReqValid() ***/
504
505
506
507/**
508 * limIsSmeStartBssReqValid()
509 *
510 *FUNCTION:
511 * This function is called by limProcessSmeReqMessages() upon
512 * receiving SME_START_BSS_REQ message from application.
513 *
514 *LOGIC:
515 * Message validity checks are performed in this function
516 *
517 *ASSUMPTIONS:
518 *
519 *NOTE:
520 *
521 * @param pMac Pointer to Global MAC structure
522 * @param pStartBssReq Pointer to received SME_START_BSS_REQ message
523 * @return true when received SME_START_BSS_REQ is formatted correctly
524 * false otherwise
525 */
526
527tANI_U8
528limIsSmeStartBssReqValid(tpAniSirGlobal pMac,
529 tpSirSmeStartBssReq pStartBssReq)
530{
531 tANI_U8 i = 0;
532 tANI_U8 valid = true;
533
534 PELOG1(limLog(pMac, LOG1,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +0530535 FL("Parsed START_BSS_REQ fields are bssType=%s (%d), channelId=%d,"
536 " SSID len=%d, rsnIE len=%d, nwType=%d, rateset len=%d"),
537 lim_BssTypetoString(pStartBssReq->bssType),
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 pStartBssReq->bssType,
539 pStartBssReq->channelId,
540 pStartBssReq->ssId.length,
541 pStartBssReq->rsnIE.length,
542 pStartBssReq->nwType,
543 pStartBssReq->operationalRateSet.numRates);)
544
545 switch (pStartBssReq->bssType)
546 {
547 case eSIR_INFRASTRUCTURE_MODE:
Jeff Johnson62c27982013-02-27 17:53:55 -0800548 /**
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 * Should not have received start BSS req with bssType
550 * Infrastructure on STA.
551 * Log error.
552 */
Jeff Johnson62c27982013-02-27 17:53:55 -0800553 limLog(pMac, LOGE,
554 FL("Invalid bssType %d in eWNI_SME_START_BSS_REQ"),
555 pStartBssReq->bssType);
556 valid = false;
557 goto end;
558 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700559
560 case eSIR_IBSS_MODE:
561 break;
562
563 /* Added for BT AMP support */
564 case eSIR_BTAMP_STA_MODE:
565 break;
566
567 /* Added for BT AMP support */
568 case eSIR_BTAMP_AP_MODE:
569 break;
570
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 /* Added for SoftAP support */
572 case eSIR_INFRA_AP_MODE:
573 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700574
575 default:
576 /**
577 * Should not have received start BSS req with bssType
578 * other than Infrastructure/IBSS.
579 * Log error
580 */
581 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 FL("Invalid bssType %d in eWNI_SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 pStartBssReq->bssType);
584
585 valid = false;
586 goto end;
587 }
588
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 /* This below code is client specific code. TODO */
590 if (pStartBssReq->bssType == eSIR_IBSS_MODE)
591 {
592 if (!pStartBssReq->ssId.length ||
593 (pStartBssReq->ssId.length > SIR_MAC_MAX_SSID_LENGTH))
594 {
595 // Invalid length for SSID.
596 // Reject START_BSS_REQ
597 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700598 FL("Invalid SSID length in eWNI_SME_START_BSS_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700599
600 valid = false;
601 goto end;
602 }
603 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700604
Jeff Johnson295189b2012-06-20 16:38:30 -0700605
606 if (!limIsRSNieValidInSmeReqMessage(pMac, &pStartBssReq->rsnIE))
607 {
608 valid = false;
609 goto end;
610 }
611
612 if (pStartBssReq->nwType != eSIR_11A_NW_TYPE &&
613 pStartBssReq->nwType != eSIR_11B_NW_TYPE &&
614 pStartBssReq->nwType != eSIR_11G_NW_TYPE)
615 {
616 valid = false;
617 goto end;
618 }
619
620 if (pStartBssReq->nwType == eSIR_11A_NW_TYPE)
621 {
622 for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
623 if (!sirIsArate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
624 {
625 // Invalid Operational rates
626 // Reject START_BSS_REQ
627 limLog(pMac, LOGW,
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700628 FL("Invalid operational rates in eWNI_SME_START_BSS_REQ"));
Mohit Khanna23863762012-09-11 17:40:09 -0700629 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 pStartBssReq->operationalRateSet.rate,
631 pStartBssReq->operationalRateSet.numRates);
632
633 valid = false;
634 goto end;
635 }
636 }
637 // check if all the rates in the operatioal rate set are legal 11G rates
638 else if (pStartBssReq->nwType == eSIR_11G_NW_TYPE)
639 {
640 for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
641 if (!sirIsGrate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
642 {
643 // Invalid Operational rates
644 // Reject START_BSS_REQ
645 limLog(pMac, LOGW,
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700646 FL("Invalid operational rates in eWNI_SME_START_BSS_REQ"));
Mohit Khanna23863762012-09-11 17:40:09 -0700647 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 pStartBssReq->operationalRateSet.rate,
649 pStartBssReq->operationalRateSet.numRates);
650
651 valid = false;
652 goto end;
653 }
654 }
Jeff Johnson62c27982013-02-27 17:53:55 -0800655 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 {
657 for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
658 if (!sirIsBrate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
659 {
660 // Invalid Operational rates
661 // Reject START_BSS_REQ
662 limLog(pMac, LOGW,
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700663 FL("Invalid operational rates in eWNI_SME_START_BSS_REQ"));
Mohit Khanna23863762012-09-11 17:40:09 -0700664 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 pStartBssReq->operationalRateSet.rate,
666 pStartBssReq->operationalRateSet.numRates);
667
668 valid = false;
669 goto end;
670 }
671 }
672
673end:
674 return valid;
675} /*** end limIsSmeStartBssReqValid() ***/
676
677
678
679/**
680 * limIsSmeJoinReqValid()
681 *
682 *FUNCTION:
683 * This function is called by limProcessSmeReqMessages() upon
684 * receiving SME_JOIN_REQ message from application.
685 *
686 *LOGIC:
687 * Message validity checks are performed in this function
688 *
689 *ASSUMPTIONS:
690 *
691 *NOTE:
692 *
693 * @param pMac Pointer to Global MAC structure
694 * @param pJoinReq Pointer to received SME_JOIN_REQ message
695 * @return true when received SME_JOIN_REQ is formatted correctly
696 * false otherwise
697 */
698
699tANI_U8
700limIsSmeJoinReqValid(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq)
701{
702 tANI_U8 valid = true;
703
Jeff Johnson295189b2012-06-20 16:38:30 -0700704
705 if (!limIsRSNieValidInSmeReqMessage(pMac, &pJoinReq->rsnIE))
706 {
707 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700708 FL("received SME_JOIN_REQ with invalid RSNIE"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 valid = false;
710 goto end;
711 }
712
713 if (!limIsAddieValidInSmeReqMessage(pMac, &pJoinReq->addIEScan))
714 {
715 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700716 FL("received SME_JOIN_REQ with invalid additional IE for scan"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 valid = false;
718 goto end;
719 }
720
721 if (!limIsAddieValidInSmeReqMessage(pMac, &pJoinReq->addIEAssoc))
722 {
723 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700724 FL("received SME_JOIN_REQ with invalid additional IE for assoc"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 valid = false;
726 goto end;
727 }
728
729
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 if (!limIsBssDescrValidInSmeReqMessage(pMac,
731 &pJoinReq->bssDescription))
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 {
733 /// Received eWNI_SME_JOIN_REQ with invalid BSS Info
734 // Log the event
735 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 FL("received SME_JOIN_REQ with invalid bssInfo"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700737
738 valid = false;
739 goto end;
740 }
741
Jeff Johnsone7245742012-09-05 17:12:55 -0700742 /*
743 Reject Join Req if the Self Mac Address and
744 the Ap's Mac Address is same
745 */
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530746 if ( vos_mem_compare( (tANI_U8* ) pJoinReq->selfMacAddr,
Jeff Johnsone7245742012-09-05 17:12:55 -0700747 (tANI_U8 *) pJoinReq->bssDescription.bssId,
748 (tANI_U8) (sizeof(tSirMacAddr))))
749 {
750 // Log the event
751 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 FL("received SME_JOIN_REQ with Self Mac and BSSID Same"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700753
754 valid = false;
755 goto end;
756 }
757
Jeff Johnson295189b2012-06-20 16:38:30 -0700758end:
759 return valid;
760} /*** end limIsSmeJoinReqValid() ***/
761
762
763
764/**
765 * limIsSmeDisassocReqValid()
766 *
767 *FUNCTION:
768 * This function is called by limProcessSmeReqMessages() upon
769 * receiving SME_DISASSOC_REQ message from application.
770 *
771 *LOGIC:
772 * Message validity checks are performed in this function
773 *
774 *ASSUMPTIONS:
775 *
776 *NOTE:
777 *
778 * @param pMac Pointer to Global MAC structure
779 * @param pDisassocReq Pointer to received SME_DISASSOC_REQ message
780 * @return true When received SME_DISASSOC_REQ is formatted
781 * correctly
782 * false otherwise
783 */
784
785tANI_U8
786limIsSmeDisassocReqValid(tpAniSirGlobal pMac,
787 tpSirSmeDisassocReq pDisassocReq, tpPESession psessionEntry)
788{
789 if (limIsGroupAddr(pDisassocReq->peerMacAddr) &&
790 !limIsAddrBC(pDisassocReq->peerMacAddr))
791 return false;
792
Jeff Johnson295189b2012-06-20 16:38:30 -0700793
794 return true;
795} /*** end limIsSmeDisassocReqValid() ***/
796
797
798
799/**
800 * limIsSmeDisassocCnfValid()
801 *
802 *FUNCTION:
803 * This function is called by limProcessSmeReqMessages() upon
804 * receiving SME_DISASSOC_CNF message from application.
805 *
806 *LOGIC:
807 * Message validity checks are performed in this function
808 *
809 *ASSUMPTIONS:
810 *
811 *NOTE:
812 *
813 * @param pMac Pointer to Global MAC structure
814 * @param pDisassocCnf Pointer to received SME_DISASSOC_REQ message
815 * @return true When received SME_DISASSOC_CNF is formatted
816 * correctly
817 * false otherwise
818 */
819
820tANI_U8
821limIsSmeDisassocCnfValid(tpAniSirGlobal pMac,
822 tpSirSmeDisassocCnf pDisassocCnf, tpPESession psessionEntry)
823{
824 if (limIsGroupAddr(pDisassocCnf->peerMacAddr))
825 return false;
826
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 return true;
828} /*** end limIsSmeDisassocCnfValid() ***/
829
830
831
832/**
833 * limIsSmeDeauthReqValid()
834 *
835 *FUNCTION:
836 * This function is called by limProcessSmeReqMessages() upon
837 * receiving SME_DEAUTH_REQ message from application.
838 *
839 *LOGIC:
840 * Message validity checks are performed in this function
841 *
842 *ASSUMPTIONS:
843 *
844 *NOTE:
845 *
846 * @param pMac Pointer to Global MAC structure
847 * @param pDeauthReq Pointer to received SME_DEAUTH_REQ message
848 * @return true When received SME_DEAUTH_REQ is formatted correctly
849 * false otherwise
850 */
851
852tANI_U8
853limIsSmeDeauthReqValid(tpAniSirGlobal pMac, tpSirSmeDeauthReq pDeauthReq, tpPESession psessionEntry)
854{
855 if (limIsGroupAddr(pDeauthReq->peerMacAddr) &&
856 !limIsAddrBC(pDeauthReq->peerMacAddr))
857 return false;
858
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 return true;
860} /*** end limIsSmeDeauthReqValid() ***/
861
862
863
864/**
865 * limIsSmeScanReqValid()
866 *
867 *FUNCTION:
868 * This function is called by limProcessSmeReqMessages() upon
869 * receiving SME_SCAN_REQ message from application.
870 *
871 *LOGIC:
872 * Message validity checks are performed in this function
873 *
874 *ASSUMPTIONS:
875 *
876 *NOTE:
877 *
878 * @param pScanReq Pointer to received SME_SCAN_REQ message
879 * @return true when received SME_SCAN_REQ is formatted correctly
880 * false otherwise
881 */
882
883tANI_U8
884limIsSmeScanReqValid(tpAniSirGlobal pMac, tpSirSmeScanReq pScanReq)
885{
886 tANI_U8 valid = true;
887 tANI_U8 i = 0;
888
Abhishek Singhd9205942015-04-29 14:45:36 +0530889 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
890 {
891 valid = false;
892 limLog(pMac, LOGE, FL("Number of SSIDs > SIR_SCAN_MAX_NUM_SSID"));
893 goto end;
894 }
895
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 for (i = 0; i < pScanReq->numSsid; i++)
897 {
898 if (pScanReq->ssId[i].length > SIR_MAC_MAX_SSID_LENGTH)
899 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530900 limLog(pMac, LOGE,
901 FL("Requested SSID length > SIR_MAC_MAX_SSID_LENGTH"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700902 valid = false;
903 goto end;
904 }
905 }
Abhishek Singhd9205942015-04-29 14:45:36 +0530906 if ((pScanReq->bssType < 0) || (pScanReq->bssType > eSIR_AUTO_MODE))
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530907 {
908 limLog(pMac, LOGE, FL("Invalid BSS Type"));
909 valid = false;
910 }
911 if (limIsGroupAddr(pScanReq->bssId) && !limIsAddrBC(pScanReq->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -0700912 {
913 valid = false;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530914 limLog(pMac, LOGE, FL("BSSID is group addr and is not Broadcast Addr"));
915 }
916 if (!(pScanReq->scanType == eSIR_PASSIVE_SCAN || pScanReq->scanType == eSIR_ACTIVE_SCAN))
917 {
918 valid = false;
919 limLog(pMac, LOGE, FL("Invalid Scan Type"));
920 }
921 if (pScanReq->channelList.numChannels > SIR_MAX_NUM_CHANNELS)
922 {
923 valid = false;
924 limLog(pMac, LOGE, FL("Number of Channels > SIR_MAX_NUM_CHANNELS"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 }
926
927 /*
928 ** check min/max channelTime range
929 **/
930
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530931 if (valid)
Jeff Johnson295189b2012-06-20 16:38:30 -0700932 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530933 if ((pScanReq->scanType == eSIR_ACTIVE_SCAN) &&
934 (pScanReq->maxChannelTime < pScanReq->minChannelTime))
935 {
936 limLog(pMac, LOGE, FL("Max Channel Time < Min Channel Time"));
937 valid = false;
938 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 }
940
941end:
942 return valid;
943} /*** end limIsSmeScanReqValid() ***/
944
945
946
947/**
948 * limIsSmeAuthReqValid()
949 *
950 *FUNCTION:
951 * This function is called by limProcessSmeReqMessages() upon
952 * receiving SME_AUTH_REQ message from application.
953 *
954 *LOGIC:
955 * Message validity checks are performed in this function
956 *
957 *ASSUMPTIONS:
958 *
959 *NOTE:
960 *
961 * @param pAuthReq Pointer to received SME_AUTH_REQ message
962 * @return true when received SME_AUTH_REQ is formatted correctly
963 * false otherwise
964 */
965
966tANI_U8
967limIsSmeAuthReqValid(tpSirSmeAuthReq pAuthReq)
968{
969 tANI_U8 valid = true;
970
971 if (limIsGroupAddr(pAuthReq->peerMacAddr) ||
972 (pAuthReq->authType > eSIR_AUTO_SWITCH) ||
973 !pAuthReq->channelNumber)
974 {
975 valid = false;
976 goto end;
977 }
978
979end:
980 return valid;
981} /*** end limIsSmeAuthReqValid() ***/
982
983
984
985/**
986 * limIsSmeSetContextReqValid()
987 *
988 *FUNCTION:
989 * This function is called by limProcessSmeReqMessages() upon
990 * receiving SME_SET_CONTEXT_REQ message from application.
991 *
992 *LOGIC:
993 * Message validity checks are performed in this function
994 *
995 *ASSUMPTIONS:
996 *
997 *NOTE:
998 *
999 * @param pMsg - Pointer to received SME_SET_CONTEXT_REQ message
1000 * @return true when received SME_SET_CONTEXT_REQ is formatted correctly
1001 * false otherwise
1002 */
1003
1004tANI_U8
1005limIsSmeSetContextReqValid(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq)
1006{
1007 tANI_U8 i = 0;
1008 tANI_U8 valid = true;
1009 tpSirKeys pKey = pSetContextReq->keyMaterial.key;
1010
1011 if ((pSetContextReq->keyMaterial.edType != eSIR_ED_WEP40) &&
1012 (pSetContextReq->keyMaterial.edType != eSIR_ED_WEP104) &&
1013 (pSetContextReq->keyMaterial.edType != eSIR_ED_NONE) &&
1014#ifdef FEATURE_WLAN_WAPI
1015 (pSetContextReq->keyMaterial.edType != eSIR_ED_WPI) &&
1016#endif
1017 !pSetContextReq->keyMaterial.numKeys)
1018 {
1019 /**
1020 * No keys present in case of TKIP or CCMP
1021 * Log error.
1022 */
1023 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001024 FL("No keys present in SME_SETCONTEXT_REQ for edType=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 pSetContextReq->keyMaterial.edType);
1026
1027 valid = false;
1028 goto end;
1029 }
1030
1031 if (pSetContextReq->keyMaterial.numKeys &&
1032 (pSetContextReq->keyMaterial.edType == eSIR_ED_NONE))
1033 {
1034 /**
1035 * Keys present in case of no ED policy
1036 * Log error.
1037 */
1038 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001039 FL("Keys present in SME_SETCONTEXT_REQ for edType=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001040 pSetContextReq->keyMaterial.edType);
1041
1042 valid = false;
1043 goto end;
1044 }
1045
1046 if (pSetContextReq->keyMaterial.edType >= eSIR_ED_NOT_IMPLEMENTED)
1047 {
1048 /**
1049 * Invalid edType in the message
1050 * Log error.
1051 */
1052 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001053 FL("Invalid edType=%d in SME_SETCONTEXT_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001054 pSetContextReq->keyMaterial.edType);
1055
1056 valid = false;
1057 goto end;
1058 }
1059 else if (pSetContextReq->keyMaterial.edType > eSIR_ED_NONE)
1060 {
1061 tANI_U32 poi;
1062
1063 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
1064 &poi) != eSIR_SUCCESS)
1065 {
1066 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001067 FL("Unable to retrieve POI from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001068 }
1069
1070 if (!poi)
1071 {
1072 /**
1073 * Privacy is not enabled
1074 * In order to allow mixed mode for Guest access
1075 * allow BSS creation/join with no Privacy capability
1076 * yet advertising WPA IE
1077 */
1078 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001079 FL("Privacy is not enabled, yet non-None EDtype=%d in SME_SETCONTEXT_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 pSetContextReq->keyMaterial.edType);)
1081 }
1082 }
1083
1084 for (i = 0; i < pSetContextReq->keyMaterial.numKeys; i++)
1085 {
1086 if (((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) &&
1087 (pKey->keyLength != 5)) ||
1088 ((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104) &&
1089 (pKey->keyLength != 13)) ||
1090 ((pSetContextReq->keyMaterial.edType == eSIR_ED_TKIP) &&
1091 (pKey->keyLength != 32)) ||
1092#ifdef FEATURE_WLAN_WAPI
1093 ((pSetContextReq->keyMaterial.edType == eSIR_ED_WPI) &&
1094 (pKey->keyLength != 32)) ||
1095#endif
1096 ((pSetContextReq->keyMaterial.edType == eSIR_ED_CCMP) &&
1097 (pKey->keyLength != 16)))
1098 {
1099 /**
1100 * Invalid key length for a given ED type
1101 * Log error.
1102 */
1103 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001104 FL("Invalid keyLength =%d for edType=%d in SME_SETCONTEXT_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 pKey->keyLength, pSetContextReq->keyMaterial.edType);
1106
1107 valid = false;
1108 goto end;
1109 }
1110 pKey++;
1111 }
1112
1113end:
1114 return valid;
1115} /*** end limIsSmeSetContextReqValid() ***/
1116
1117
1118
1119/**
1120 * limIsSmeStopBssReqValid()
1121 *
1122 *FUNCTION:
1123 * This function is called by limProcessSmeReqMessages() upon
1124 * receiving SME_STOP_BSS_REQ message from application.
1125 *
1126 *LOGIC:
1127 * Message validity checks are performed in this function
1128 *
1129 *ASSUMPTIONS:
1130 *
1131 *NOTE:
1132 *
1133 * @param pMsg - Pointer to received SME_STOP_BSS_REQ message
1134 * @return true when received SME_STOP_BSS_REQ is formatted correctly
1135 * false otherwise
1136 */
1137
1138tANI_U8
1139limIsSmeStopBssReqValid(tANI_U32 *pMsg)
1140{
1141 tANI_U8 valid = true;
1142
1143 return valid;
1144} /*** end limIsSmeStopBssReqValid() ***/
1145
1146
1147/**
1148 * limGetBssIdFromSmeJoinReqMsg()
1149 *
1150 *FUNCTION:
1151 * This function is called in various places to get BSSID
1152 * from BSS description/Neighbor BSS Info in the SME_JOIN_REQ/
1153 * SME_REASSOC_REQ message.
1154 *
1155 *PARAMS:
1156 *
1157 *LOGIC:
1158 *
1159 *ASSUMPTIONS:
1160 * NA
1161 *
1162 *NOTE:
1163 * NA
1164 *
1165 * @param pBuf - Pointer to received SME_JOIN/SME_REASSOC_REQ
1166 * message
1167 * @return pBssId - Pointer to BSSID
1168 */
1169
1170tANI_U8*
1171limGetBssIdFromSmeJoinReqMsg(tANI_U8 *pBuf)
1172{
1173 if (!pBuf)
1174 return NULL;
1175
1176 pBuf += sizeof(tANI_U32); // skip message header
1177
Jeff Johnson295189b2012-06-20 16:38:30 -07001178
1179 pBuf += limGetU16(pBuf) + sizeof(tANI_U16); // skip RSN IE
1180
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 pBuf += sizeof(tANI_U16); // skip length of BSS description
Jeff Johnson295189b2012-06-20 16:38:30 -07001182
1183 return (pBuf);
1184} /*** end limGetBssIdFromSmeJoinReqMsg() ***/
1185
1186