1 /* 2 * smeSelect.c 3 * 4 * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /** \file smeSelect.c 35 * \brief SME select function implementation 36 * 37 * \see smeSm.h, smeSm.c, sme.c, sme.h, smePrivate.h 38 */ 39 40 41 #define __FILE_ID__ FILE_ID_42 42 #include "smePrivate.h" 43 #include "scanResultTable.h" 44 #include "rsnApi.h" 45 #include "siteMgrApi.h" 46 #include "EvHandler.h" 47 #include "GenSM.h" 48 #include "smeSm.h" 49 #include "tidef.h" 50 51 static TI_BOOL sme_SelectSsidMatch (TI_HANDLE hSme, TSsid *pSiteSsid, TSsid *pDesiredSsid, 52 ESsidType eDesiredSsidType); 53 static TI_BOOL sme_SelectBssidMatch (TMacAddr *pSiteBssid, TMacAddr *pDesiredBssid); 54 static TI_BOOL sme_SelectBssTypeMatch (ScanBssType_e eSiteBssType, ScanBssType_e eDesiredBssType); 55 static TI_BOOL sme_SelectWscMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite, 56 TI_BOOL *pbWscPbAbort, TI_BOOL *pbWscPbApFound); 57 static TI_BOOL sme_SelectRsnMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite); 58 59 /** 60 * \fn sme_Select 61 * \brief Select a connection candidate from the scan result table 62 * 63 * Select a connection candidate from the scan result table. 64 * 65 * Connection candidate must match SSID, BSSID, BSS type, RSN and WSC settings, has the best 66 * RSSI level from all matching sites, and connection was not attempted to it in this SME cycle 67 * (since last scan was completed) 68 * 69 * \param hSme - handle to the SME object 70 * \return A pointer to the selected site, NULL if no site macthes the selection criteria 71 */ 72 TSiteEntry *sme_Select (TI_HANDLE hSme) 73 { 74 TSme *pSme = (TSme*)hSme; 75 TSiteEntry *pCurrentSite, *pSelectedSite = NULL; 76 TI_INT8 iSelectedSiteRssi = -127; /* minimum RSSI */ 77 TI_BOOL bWscPbAbort, pWscPbApFound = TI_FALSE; 78 int apFoundCtr =0; 79 TIWLN_SIMPLE_CONFIG_MODE eWscMode; 80 81 TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select called\n"); 82 83 /* on SG avalanche, select is not needed, send connect event automatically */ 84 if (TI_TRUE == pSme->bReselect) 85 { 86 paramInfo_t *pParam; 87 88 TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: reselect flag is on, reselecting the current site\n"); 89 90 pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); 91 if (!pParam) 92 { 93 return NULL; 94 } 95 96 pSme->bReselect = TI_FALSE; 97 98 /* Get Primary Site */ 99 pParam->paramType = SITE_MGR_GET_PRIMARY_SITE; 100 siteMgr_getParam(pSme->hSiteMgr, pParam); 101 pCurrentSite = pParam->content.pPrimarySite; 102 os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); 103 return pCurrentSite; 104 } 105 106 /* get the first site from the scan result table */ 107 pCurrentSite = scanResultTable_GetFirst (pSme->hScanResultTable); 108 109 /* check all sites */ 110 while (NULL != pCurrentSite) 111 { 112 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: considering BSSID: %02x:%02x:%02x:%02x:%02x:%02x for selection\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 113 114 /* if this site was previously selected in the current SME connection attempt, and conn mode is auto */ 115 if (TI_TRUE == pCurrentSite->bConsideredForSelect) 116 { 117 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x was selected previously\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 118 /* get the next site and continue the loop */ 119 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 120 continue; 121 } 122 123 /* check if site matches */ 124 /* first check SSID match */ 125 if (TI_FALSE == sme_SelectSsidMatch (hSme, &(pCurrentSite->ssid), &(pSme->tSsid), pSme->eSsidType)) 126 /* site doesn't match */ 127 { 128 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match SSID\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 129 pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 130 /* get the next site and continue the loop */ 131 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 132 continue; 133 } 134 135 /* Now check BSSID match */ 136 if (TI_FALSE == sme_SelectBssidMatch (&(pCurrentSite->bssid), &(pSme->tBssid))) 137 /* site doesn't match */ 138 { 139 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match SSID\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 140 pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 141 /* get the next site and continue the loop */ 142 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 143 continue; 144 } 145 146 /* and BSS type match */ 147 if (TI_FALSE == sme_SelectBssTypeMatch (pCurrentSite->bssType, pSme->eBssType)) 148 /* site doesn't match */ 149 { 150 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match BSS type\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 151 pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 152 /* get the next site and continue the loop */ 153 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 154 continue; 155 } 156 157 if (pCurrentSite->WSCSiteMode == TIWLN_SIMPLE_CONFIG_PBC_METHOD) 158 { 159 apFoundCtr++; 160 } 161 if (apFoundCtr > 1) 162 { 163 pWscPbApFound = TI_TRUE; 164 } 165 166 /* and simple config match */ 167 if (TI_FALSE == sme_SelectWscMatch (hSme, pCurrentSite, &bWscPbAbort, &pWscPbApFound)) 168 /* site doesn't match */ 169 { 170 /* also check if abort was indicated */ 171 if (TI_TRUE == bWscPbAbort) 172 { 173 /* send event to user mode to indicate this */ 174 EvHandlerSendEvent (pSme->hEvHandler, IPC_EVENT_WPS_SESSION_OVERLAP, NULL, 0); 175 /* select failed - will rescan in time */ 176 return NULL; 177 } 178 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match WSC\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 179 pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 180 /* get the next site and continue the loop */ 181 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 182 continue; 183 } 184 185 /* and security match */ 186 siteMgr_getParamWSC(pSme->hSiteMgr, &eWscMode); 187 188 /* we don't need to check RSN match while WSC is active */ 189 if ((pCurrentSite->WSCSiteMode == TIWLN_SIMPLE_CONFIG_OFF) || (pCurrentSite->WSCSiteMode != eWscMode)) 190 { 191 if (TI_FALSE == sme_SelectRsnMatch (hSme, pCurrentSite)) 192 /* site doesn't match */ 193 { 194 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match RSN\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 195 pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 196 /* get the next site and continue the loop */ 197 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 198 continue; 199 } 200 } 201 202 /* and rate match */ 203 if (TI_FALSE == siteMgr_SelectRateMatch (pSme->hSiteMgr, pCurrentSite)) 204 /* site doesn't match */ 205 { 206 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match rates\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 207 pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 208 /* get the next site and continue the loop */ 209 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 210 continue; 211 } 212 213 if (TI_TRUE == pCurrentSite->bChannelSwitchAnnoncIEFound) 214 { 215 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x has channel switch IE so ignore it \n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 216 pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 217 /* get the next site and continue the loop */ 218 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 219 continue; 220 } 221 222 /* if this site RSSI is higher than current maximum, select it */ 223 if (pCurrentSite->rssi > iSelectedSiteRssi) 224 { 225 TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x match and has highest RSSI so far!\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 226 pSelectedSite = pCurrentSite; 227 iSelectedSiteRssi = pCurrentSite->rssi; 228 } 229 230 /* and continue to the next site */ 231 pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 232 } 233 234 /* if a matching site was found */ 235 if (NULL != pSelectedSite) 236 { 237 /* mark that a connection to this site was (actually is) attempted */ 238 pSelectedSite->bConsideredForSelect = TI_TRUE; 239 240 /* hope this is the correct place for siteMgr_changeBandParams */ 241 siteMgr_changeBandParams (pSme->hSiteMgr, pSelectedSite->eBand); 242 243 /* 244 * Coordinate between SME module site table and Site module site Table 245 * copy candidate AP to Site module site Table. 246 */ 247 siteMgr_CopyToPrimarySite(pSme->hSiteMgr, pSelectedSite); 248 249 /* copy the result, rather than returning a pointer to the entry in the scan result table. 250 * This is done since the table might change durring the connection process, and the pointer 251 * will point to the wrong entry in the table, causing connection/disconnection problems */ 252 os_memoryCopy(pSme->hOS, &(pSme->tCandidate), pSelectedSite, sizeof(TSiteEntry)); 253 254 return &(pSme->tCandidate); 255 } 256 257 /* return NULL if no site was selected */ 258 return NULL; 259 } 260 261 /** 262 * \fn sme_SelectSsidMatch 263 * \brief Check if a site SSID matches the desired SSID for selection 264 * 265 * Check if a site SSID matches the desired SSID for selection 266 * 267 * \param hSme - handle to the SME object 268 * \param pSiteSsid - the site SSID 269 * \param pDesiredSsid - the desired SSID 270 * \param edesiredSsidType - the desired SSID type 271 * \return TI_TRUE if SSIDs match, TI_FALSE if they don't 272 * \sa sme_Select 273 */ 274 TI_BOOL sme_SelectSsidMatch (TI_HANDLE hSme, TSsid *pSiteSsid, TSsid *pDesiredSsid, 275 ESsidType eDesiredSsidType) 276 { 277 TSme *pSme = (TSme*)hSme; 278 279 /*If SSID length is 0 (hidden SSID)- Discard*/ 280 if (pSiteSsid->len == 0) 281 { 282 return TI_FALSE; 283 } 284 285 /* if the desired SSID type is any, return TRUE (site matches) */ 286 if (SSID_TYPE_ANY == eDesiredSsidType) 287 { 288 return TI_TRUE; 289 } 290 /* It looks like it never happens. Anyway decided to check */ 291 if (( pSiteSsid->len > MAX_SSID_LEN ) || 292 ( pDesiredSsid->len > MAX_SSID_LEN )) 293 { 294 TRACE3( pSme->hReport, REPORT_SEVERITY_ERROR, 295 "sme_SelectSsidMatch. pSme->tSsid.len=%d or pDesiredSsid->len =%d exceed the limit %d\n", 296 pSiteSsid->len, pDesiredSsid->len, MAX_SSID_LEN); 297 handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); 298 return TI_FALSE; 299 } 300 /* otherwise, check if the SSIDs match */ 301 if ((pSiteSsid->len == pDesiredSsid->len) && /* lngth match */ 302 (0 == os_memoryCompare (pSme->hOS, (TI_UINT8 *)&(pSiteSsid->str[ 0 ]), (TI_UINT8 *)&(pDesiredSsid->str[ 0 ]), pSiteSsid->len))) /* content match */ 303 { 304 return TI_TRUE; 305 } 306 else 307 { 308 return TI_FALSE; 309 } 310 } 311 312 /** 313 * \fn sme_SelectBssidMatch 314 * \brief Check if a site BSSID matches the desired BSSID for selection 315 * 316 * Check if a site BSSID matches the desired BSSID for selection 317 * 318 * \param pSiteBssid - the site BSSID 319 * \param pDesiredBssid - the desired BSSID 320 * \return TI_TRUE if BSSIDs match, TI_FALSE if they don't 321 * \sa sme_Select 322 */ 323 TI_BOOL sme_SelectBssidMatch (TMacAddr *pSiteBssid, TMacAddr *pDesiredBssid) 324 { 325 /* check if the desired BSSID is broadcast (no need to match) */ 326 if (TI_TRUE == MAC_BROADCAST (*pDesiredBssid)) 327 { 328 return TI_TRUE; 329 } 330 331 /* if the desired BSSID is not any BSSID, check if the site BSSID equals the desired BSSID */ 332 if (TI_TRUE == MAC_EQUAL (*pDesiredBssid, *pSiteBssid)) 333 { 334 return TI_TRUE; 335 } 336 337 /* no match */ 338 return TI_FALSE; 339 } 340 341 /** 342 * \fn sme_SelectBssTypeMatch 343 * \brief Checks if the desired BSS type match the BSS type of a site 344 * 345 * Checks if the desired BSS type match the BSS type of a site 346 * 347 * \param eSiteBssType - the site BSS type 348 * \param edesiredBssType - the desired BSS type 349 * \return TI_TRUE if the BSS types matches, TI_FALSE if they don't 350 * \sa sme_Select 351 */ 352 TI_BOOL sme_SelectBssTypeMatch (ScanBssType_e eSiteBssType, ScanBssType_e eDesiredBssType) 353 { 354 /* if the desired type is any, there is a match */ 355 if (BSS_ANY == eDesiredBssType) 356 { 357 return TI_TRUE; 358 } 359 360 /* if the BSS types equal, there is a match */ 361 if (eDesiredBssType == eSiteBssType) 362 { 363 return TI_TRUE; 364 } 365 366 /* no match */ 367 return TI_FALSE; 368 } 369 370 /** 371 * \fn sme_SelectWscMatch 372 * \brief checks if the configred WSC mode equals the WSC mode of a site 373 * 374 * checks if the configred WSC mode equals the WSC mode of a site 375 * 376 * \param hSme - handle to the SME object 377 * \param pCurrentSite - site to check 378 * \return TI_TRUE if site macthes current WSC mode, TI_FALSE if it doesn't match 379 * \sa sme_Select 380 */ 381 TI_BOOL sme_SelectWscMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite, 382 TI_BOOL *pbWscPbAbort, TI_BOOL *pbWscPbApFound) 383 { 384 TSme *pSme = (TSme*)hSme; 385 TIWLN_SIMPLE_CONFIG_MODE wscMode; 386 387 /* get the WSC mode from site mgr */ 388 siteMgr_getParamWSC(pSme->hSiteMgr, &wscMode); /* SITE_MGR_SIMPLE_CONFIG_MODE - get the WSC mode from site mgr */ 389 390 /* if simple config is off, site match */ 391 if (TIWLN_SIMPLE_CONFIG_OFF == wscMode) 392 { 393 return TI_TRUE; 394 } 395 396 /* if WSC is supported, and more than one AP with PB configuration is found - indicate to abort */ 397 if ((TI_TRUE == *pbWscPbApFound) && (TIWLN_SIMPLE_CONFIG_PBC_METHOD == pCurrentSite->WSCSiteMode)) 398 { 399 TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_SelectWscMatch: WSC mode is %d, and more than one AP with WSC PB found - aborting\n", wscMode); 400 *pbWscPbAbort = TI_TRUE; 401 return TI_FALSE; 402 } 403 else 404 { 405 /* indicate NOT to abort the select process */ 406 *pbWscPbAbort = TI_FALSE; 407 } 408 409 /* if configured simple config mode equals site simple config mode, site match */ 410 if (pCurrentSite->WSCSiteMode == wscMode) 411 { 412 return TI_TRUE; 413 } 414 415 /* site doesn't match */ 416 return TI_FALSE; 417 } 418 419 /** 420 * \fn sme_SelectRsnMatch 421 * \brief Checks if the configured scurity settings match those of a site 422 * 423 * Checks if the configured scurity settings match those of a site 424 * 425 * \param hSme - handle to the SME object 426 * \param pCurrentSite - the site to check 427 * \return TI_TRUE if site matches RSN settings, TI FALSE if it doesn't 428 * \sa sme_Select 429 */ 430 TI_BOOL sme_SelectRsnMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite) 431 { 432 TSme *pSme = (TSme*)hSme; 433 TRsnData tRsnData; 434 dot11_RSN_t *pRsnIe; 435 TI_UINT8 uRsnIECount=0; 436 TI_UINT8 uCurRsnData[255]; 437 TI_UINT32 uLength = 0; 438 TI_UINT32 uMetric; 439 TRsnSiteParams tRsnSiteParams; 440 441 tRsnSiteParams.bssType = pCurrentSite->bssType; 442 MAC_COPY(tRsnSiteParams.bssid, pCurrentSite->bssid); 443 tRsnSiteParams.pHTCapabilities = &pCurrentSite->tHtCapabilities; 444 tRsnSiteParams.pHTInfo = &pCurrentSite->tHtInformation; 445 446 /* copy all RSN IE's */ 447 pRsnIe = pCurrentSite->pRsnIe; 448 while ((uLength < pCurrentSite->rsnIeLen) && (uRsnIECount < MAX_RSN_IE)) 449 { 450 if (uLength + 2 + pRsnIe->hdr[ 1 ] > sizeof (uCurRsnData)) 451 { 452 TRACE4( pSme->hReport, REPORT_SEVERITY_ERROR, 453 "sme_SelectRsnMatch. uRsnIECount=%d, uLength=%d; required copy of %d bytes exceeds the buffer limit %d\n", 454 uRsnIECount, uLength, pRsnIe->hdr[ 1 ] +2, sizeof (uCurRsnData)); 455 handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); 456 return TI_FALSE; 457 } 458 uCurRsnData[ 0 + uLength ] = pRsnIe->hdr[ 0 ]; 459 uCurRsnData[ 1 + uLength ] = pRsnIe->hdr[ 1 ]; 460 os_memoryCopy (pSme->hOS, &uCurRsnData[ 2 + uLength ], pRsnIe->rsnIeData, pRsnIe->hdr[ 1 ]); 461 uLength += pRsnIe->hdr[ 1 ] + 2; 462 pRsnIe += 1; 463 uRsnIECount++; 464 } 465 /* sanity check - make sure RSN IE's size is not too big */ 466 if (uLength < pCurrentSite->rsnIeLen) 467 { 468 TRACE2(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_SelectRsnMatch, RSN IE is too long: rsnIeLen=%d, MAX_RSN_IE=%d\n", pCurrentSite->rsnIeLen, MAX_RSN_IE); 469 } 470 471 /* call the RSN to evaluate the site */ 472 tRsnData.pIe = (pCurrentSite->rsnIeLen == 0) ? NULL : uCurRsnData; 473 tRsnData.ieLen = pCurrentSite->rsnIeLen; 474 tRsnData.privacy = pCurrentSite->privacy; 475 if (rsn_evalSite (pSme->hRsn, &tRsnData, &tRsnSiteParams , &uMetric) != TI_OK) 476 { 477 /* no match */ 478 return TI_FALSE; 479 } 480 else 481 { 482 /* match! */ 483 return TI_TRUE; 484 } 485 } 486 487