From ddac9c138c5b4b16b99fb8bc5f0f10418efa1029 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Fri, 29 Jan 2010 14:38:28 -0800 Subject: wl1271: Android/Sholes update Signed-off-by: Dmitry Shmidt --- wl1271/stad/src/Connection_Managment/admCtrlWpa.c | 13 +++---- wl1271/stad/src/Connection_Managment/admCtrlWpa2.c | 16 +++------ wl1271/stad/src/Connection_Managment/apConn.c | 10 +----- wl1271/stad/src/Connection_Managment/apConnApi.h | 3 -- wl1271/stad/src/Connection_Managment/conn.c | 20 ++++++----- wl1271/stad/src/Connection_Managment/connIbss.c | 2 +- wl1271/stad/src/Connection_Managment/connIbss.h | 1 + wl1271/stad/src/Connection_Managment/connInfra.c | 42 ++++++++++------------ wl1271/stad/src/Connection_Managment/externalSec.c | 11 ++---- wl1271/stad/src/Connection_Managment/rsn.c | 22 +++++++----- wl1271/stad/src/Connection_Managment/rsnApi.h | 1 - wl1271/stad/src/Connection_Managment/sme.c | 24 +++++++------ wl1271/stad/src/Connection_Managment/smeSelect.c | 3 +- wl1271/stad/src/Connection_Managment/smeSm.c | 16 ++++----- 14 files changed, 81 insertions(+), 103 deletions(-) (limited to 'wl1271/stad/src/Connection_Managment') diff --git a/wl1271/stad/src/Connection_Managment/admCtrlWpa.c b/wl1271/stad/src/Connection_Managment/admCtrlWpa.c index 69079ada..91339236 100644 --- a/wl1271/stad/src/Connection_Managment/admCtrlWpa.c +++ b/wl1271/stad/src/Connection_Managment/admCtrlWpa.c @@ -843,12 +843,11 @@ TI_STATUS admCtrlWpa_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 * pAdmCtrl->externalAuthMode = RSN_EXT_AUTH_MODE_OPEN; break; } - #ifdef XCC_MODULE_INCLUDED pParam->paramType = XCC_CCKM_EXISTS; - pParam->content.XCCCckmExists = (wpaData.KeyMngSuite[0]==WPA_IE_KEY_MNG_CCKM) ? TI_TRUE : TI_FALSE; + pParam->content.XCCCckmExists = (wpaData.KeyMngSuite[0]==WPA_IE_KEY_MNG_CCKM) ? TI_TRUE : TI_FALSE; XCCMngr_setParam(pAdmCtrl->hXCCMngr, pParam); #endif /* set replay counter */ @@ -896,7 +895,7 @@ TI_STATUS admCtrlWpa_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 * status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam); if (status != TI_OK) { - goto adm_ctrl_wpa_end; + goto adm_ctrl_wpa_end; } #ifdef XCC_MODULE_INCLUDED @@ -915,7 +914,7 @@ TI_STATUS admCtrlWpa_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 * if (status != TI_OK) { - goto adm_ctrl_wpa_end; + goto adm_ctrl_wpa_end; } #endif /*XCC_MODULE_INCLUDED*/ @@ -925,7 +924,6 @@ TI_STATUS admCtrlWpa_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 * { goto adm_ctrl_wpa_end; } - adm_ctrl_wpa_end: os_memoryFree(pAdmCtrl->hOs, pParam, sizeof(paramInfo_t)); return status; @@ -1080,7 +1078,6 @@ TI_STATUS admCtrlWpa_evalSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSiteP return TI_NOK; /* if the encyption is TKIP and the site does support HT(11n) the site can not be a candidate */ } - /* Check privacy bit if not in mixed mode */ if (!pAdmCtrl->mixedMode) { /* There's no mixed mode, so make sure that the privacy Bit matches the privacy mode*/ @@ -1103,7 +1100,6 @@ TI_STATUS admCtrlWpa_evalSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSiteP pAdmCtrl->unicastSuite = TWD_CIPHER_NONE; } - /* always return TI_OK */ return TI_OK; } @@ -1257,7 +1253,8 @@ TI_STATUS admCtrlWpa_parseIe(admCtrl_t *pAdmCtrl, TI_UINT8 *pWpaIe, wpaIeData_t curWpaIe +=4; /* Include all AP key management supported suites in the wpaData structure */ - pWpaData->KeyMngSuite[index+1] = curKeyMngSuite; + if ((index+1) < MAX_WPA_KEY_MNG_SUITES) + pWpaData->KeyMngSuite[index+1] = curKeyMngSuite; } pWpaData->KeyMngSuite[0] = maxKeyMngSuite; diff --git a/wl1271/stad/src/Connection_Managment/admCtrlWpa2.c b/wl1271/stad/src/Connection_Managment/admCtrlWpa2.c index 037fe96f..d4688e6f 100644 --- a/wl1271/stad/src/Connection_Managment/admCtrlWpa2.c +++ b/wl1271/stad/src/Connection_Managment/admCtrlWpa2.c @@ -651,7 +651,6 @@ TI_STATUS admCtrlWpa2_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 TI_UINT8 *pWpa2Ie; ECipherSuite uSuite, bSuite; - *pAssocIeLen = 0; if (pRsnData==NULL) @@ -693,7 +692,7 @@ TI_STATUS admCtrlWpa2_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 status = admCtrl_parseIe(pAdmCtrl, pRsnData, &pWpa2Ie, RSN_IE_ID); if (status != TI_OK) - { + { goto adm_ctrl_wpa2_end; } TRACE0(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION, "admCtrlWpa2_setSite: RSN_IE=\n"); @@ -742,14 +741,12 @@ TI_STATUS admCtrlWpa2_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 paeConfig.authProtocol = RSN_EXT_AUTH_MODE_WPA2PSK; } - #ifdef XCC_MODULE_INCLUDED pParam->paramType = XCC_CCKM_EXISTS; pParam->content.XCCCckmExists = (wpa2Data.KeyMngSuite[0]==WPA2_IE_KEY_MNG_CCKM) ? TI_TRUE : TI_FALSE; XCCMngr_setParam(pAdmCtrl->hXCCMngr, pParam); #endif - paeConfig.keyExchangeProtocol = pAdmCtrl->keyMngSuite; paeConfig.unicastSuite = uSuite; /* Updated value */ paeConfig.broadcastSuite = bSuite; /* Updated value */ @@ -849,10 +846,8 @@ TI_STATUS admCtrlWpa2_evalSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSite TRACE0(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION,"Dismiss AP - HT with TKIP is not valid"); return TI_NOK; /* if the encyption is TKIP and the site does support HT(11n) the site can not be a candidate */ } - - /* Get Simple-Config state */ + /* Get Simple-Config state */ siteMgr_getParamWSC(pAdmCtrl->pRsn->hSiteMgr, &wscMode); /* SITE_MGR_SIMPLE_CONFIG_MODE */ - status = admCtrl_parseIe(pAdmCtrl, pRsnData, &pWpa2Ie, RSN_IE_ID); if (status != TI_OK) { @@ -1680,7 +1675,7 @@ static void admCtrlWpa2_buildAndSendPMKIDCandList (TI_HANDLE hHandle, TBssidList TI_UINT8 candIndex =0, apIndex = 0, size =0; paramInfo_t *pParam; OS_802_11_PMKID_CANDIDATELIST *pCandList; - TI_UINT8 memBuff[PMKID_CAND_LIST_MEMBUFF_SIZE + sizeof(TI_UINT32)]; + TI_UINT8 memBuff[PMKID_CAND_LIST_MEMBUFF_SIZE + sizeof(TI_UINT32)]; dot11_RSN_t *rsnIE = 0; wpa2IeData_t wpa2Data; TI_STATUS status = TI_NOK; @@ -1704,7 +1699,7 @@ static void admCtrlWpa2_buildAndSendPMKIDCandList (TI_HANDLE hHandle, TBssidList /* the ssid in the PMKID cache */ if ((pAdmCtrl->pmkid_cache.ssid.len != pParam->content.smeDesiredSSID.len) || (os_memoryCompare(pAdmCtrl->hOs, (TI_UINT8 *)pAdmCtrl->pmkid_cache.ssid.str, - (TI_UINT8 *) pParam->content.smeDesiredSSID.str, + (TI_UINT8 *)pParam->content.smeDesiredSSID.str, pAdmCtrl->pmkid_cache.ssid.len) != 0)) { admCtrlWpa2_resetPMKIDCache(pAdmCtrl); @@ -1843,10 +1838,7 @@ static void admCtrlWpa2_buildAndSendPMKIDCandList (TI_HANDLE hHandle, TBssidList /* Send PRE-AUTH start event to External Application */ admCtrl_notifyPreAuthStatus (pAdmCtrl, RSN_PRE_AUTH_START); TRACE1(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION, "RSN: PMKID Candidate List with %d entries has been built and sent for ssid \n", candIndex); - - return; - } /** diff --git a/wl1271/stad/src/Connection_Managment/apConn.c b/wl1271/stad/src/Connection_Managment/apConn.c index 06b23998..39fbacb9 100644 --- a/wl1271/stad/src/Connection_Managment/apConn.c +++ b/wl1271/stad/src/Connection_Managment/apConn.c @@ -1547,15 +1547,10 @@ TI_STATUS apConn_getVendorSpecificIE(TI_HANDLE hAPConnection, TI_UINT8 *pRequest { *len = 0; } - return TI_OK; } - - - - /* Internal functions implementation */ @@ -2279,7 +2274,6 @@ static void apConn_smHandleTspecReneg (void *pData) { /* TSPEC is already configured, move to CONNECTED */ apConn_smEvent(&(pAPConnection->currentState), AP_CONNECT_EVENT_FINISHED_OK, pAPConnection); - return;; } else { @@ -2291,17 +2285,15 @@ static void apConn_smHandleTspecReneg (void *pData) { /* Re-negotiation of TSPEC cannot be performed */ apConn_smEvent(&(pAPConnection->currentState), AP_CONNECT_EVENT_FINISHED_NOT_OK, pAPConnection); - return; } - return; } } else { /* No need to re-negotiate TSPEC, move to CONNECTED */ apConn_smEvent(&(pAPConnection->currentState), AP_CONNECT_EVENT_FINISHED_OK, pAPConnection); - return; } + return; } diff --git a/wl1271/stad/src/Connection_Managment/apConnApi.h b/wl1271/stad/src/Connection_Managment/apConnApi.h index deb9b4ae..12bed1cf 100644 --- a/wl1271/stad/src/Connection_Managment/apConnApi.h +++ b/wl1271/stad/src/Connection_Managment/apConnApi.h @@ -170,8 +170,6 @@ typedef TI_STATUS (*apConn_roamMngrCallb_t) (TI_HANDLE hRoamingMngr, void *pData typedef TI_STATUS (*apConn_roamMngrEventCallb_t) (TI_HANDLE hRoamingMngr, void *pData, TI_UINT16 reasonCode); - - /*------------*/ /* Structures */ /*------------*/ @@ -248,7 +246,6 @@ typedef struct _TargetAP_t bssEntry_t newAP; } TargetAp_t; - /*---------------------------*/ /* External data definitions */ /*---------------------------*/ diff --git a/wl1271/stad/src/Connection_Managment/conn.c b/wl1271/stad/src/Connection_Managment/conn.c index d6c2824d..aa49b1cb 100644 --- a/wl1271/stad/src/Connection_Managment/conn.c +++ b/wl1271/stad/src/Connection_Managment/conn.c @@ -92,19 +92,19 @@ RETURN: Handle to the connection module on success, NULL otherwise ************************************************************************/ TI_HANDLE conn_create(TI_HANDLE hOs) { - conn_t *pConn; + conn_t *pConn; fsm_stateMachine_t *pFsm; TI_STATUS status; pConn = os_memoryAlloc(hOs, sizeof(conn_t)); if (pConn == NULL) - { + { return NULL; - } - os_memoryZero (pConn->hOs, pConn, sizeof(conn_t)); - + } + + os_memoryZero(hOs, (void *)pConn, sizeof(conn_t)); /* Creating connection Ibss SM */ - status = fsm_Create(hOs, &pFsm, CONN_IBSS_NUM_STATES, CONN_IBSS_NUM_EVENTS); + status = fsm_Create(hOs, &pFsm, CONN_IBSS_NUM_STATES, CONN_IBSS_NUM_EVENTS); if (status != TI_OK) { release_module(pConn); @@ -112,7 +112,7 @@ TI_HANDLE conn_create(TI_HANDLE hOs) } pConn->ibss_pFsm = pFsm; - /* Creating connection Infra SM */ + /* Creating connection Infra SM */ status = fsm_Create(hOs, &pFsm, CONN_INFRA_NUM_STATES, CONN_INFRA_NUM_EVENTS); if (status != TI_OK) { @@ -484,11 +484,13 @@ TI_STATUS conn_reportMlmeStatus(TI_HANDLE hConn, TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE," CONN LOST \n"); TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE,"-------------------------------------\n"); - +#ifdef REPORT_LOG WLAN_OS_REPORT(("-------------------------------------\n")); WLAN_OS_REPORT((" CONN LOST \n")); WLAN_OS_REPORT(("-------------------------------------\n")); - +#else + os_printf("%s: *** CONN LOST ***\n", __func__); +#endif if( pConn->connType == CONN_TYPE_ROAM ) pConn->disConnType = DISCONNECT_IMMEDIATE; else /* connType == CONN_TYPE_ESS */ diff --git a/wl1271/stad/src/Connection_Managment/connIbss.c b/wl1271/stad/src/Connection_Managment/connIbss.c index aa0170a4..3583abb4 100644 --- a/wl1271/stad/src/Connection_Managment/connIbss.c +++ b/wl1271/stad/src/Connection_Managment/connIbss.c @@ -447,7 +447,7 @@ RETURN: TI_OK on success, TI_NOK otherwise ************************************************************************/ static TI_STATUS rsnWait_to_waitToDisconnCmplt(void *pData) { - paramInfo_t param; + paramInfo_t param; TI_STATUS tStatus; tStatus = rsn_stop(((conn_t *)pData)->hRsn, TI_FALSE); diff --git a/wl1271/stad/src/Connection_Managment/connIbss.h b/wl1271/stad/src/Connection_Managment/connIbss.h index 3476ca5a..24ba706c 100644 --- a/wl1271/stad/src/Connection_Managment/connIbss.h +++ b/wl1271/stad/src/Connection_Managment/connIbss.h @@ -67,6 +67,7 @@ typedef enum typedef enum { STATE_CONN_IBSS_IDLE =0, + STATE_CONN_IBSS_SELF_WAIT , STATE_CONN_IBSS_RSN_WAIT , STATE_CONN_IBSS_CONNECTED , diff --git a/wl1271/stad/src/Connection_Managment/connInfra.c b/wl1271/stad/src/Connection_Managment/connInfra.c index b9fa8bfe..d2f63a0e 100644 --- a/wl1271/stad/src/Connection_Managment/connInfra.c +++ b/wl1271/stad/src/Connection_Managment/connInfra.c @@ -256,7 +256,6 @@ TI_STATUS conn_infraConfig(conn_t *pConn) return fsm_Config(pConn->infra_pFsm, (fsm_Matrix_t)smMatrix, CONN_INFRA_NUM_STATES, CONN_INFRA_NUM_EVENTS, conn_infraSMEvent, pConn->hOs); } - /*********************************************************************** * conn_infraSMEvent *********************************************************************** @@ -283,7 +282,6 @@ TI_STATUS conn_infraSMEvent(TI_UINT8 *currentState, TI_UINT8 event, TI_HANDLE hC TI_UINT8 nextState; status = fsm_GetNextState(pConn->infra_pFsm, *currentState, event, &nextState); - if (status != TI_OK) { TRACE0(pConn->hReport, REPORT_SEVERITY_SM, "State machine error, failed getting next state\n"); @@ -394,7 +392,6 @@ static TI_STATUS mlmeWait_to_WaitDisconnect(void *pData) pParam->content.rxDataPortStatus = CLOSE; rxData_setParam(pConn->hRxData, pParam); - /* Update TxMgmtQueue SM to close Tx path. */ txMgmtQ_SetConnState (pConn->hTxMgmtQ, TX_CONN_STATE_CLOSE); @@ -443,19 +440,17 @@ static TI_STATUS mlmeWait_to_rsnWait(void *pData) pParam->paramType = RX_DATA_PORT_STATUS_PARAM; pParam->content.rxDataPortStatus = OPEN_EAPOL; - status = rxData_setParam(pConn->hRxData, pParam); + status = rxData_setParam(pConn->hRxData, pParam); os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); if (status != TI_OK) return status; - /* Update TxMgmtQueue SM to enable EAPOL packets. */ txMgmtQ_SetConnState (((conn_t *)pData)->hTxMgmtQ, TX_CONN_STATE_EAPOL); - + /* * Notify that the driver is associated to the supplicant\IP stack. */ EvHandlerSendEvent(pConn->hEvHandler, IPC_EVENT_ASSOCIATED, NULL,0); - status = rsn_start(pConn->hRsn); return status; } @@ -531,16 +526,15 @@ static TI_STATUS configHW_to_disconnect(void *pData) { pParam->paramType = REGULATORY_DOMAIN_DISCONNECT_PARAM; regulatoryDomain_setParam(pConn->hRegulatoryDomain, pParam); - + /* Must be called AFTER mlme_stop. since De-Auth packet should be sent with the - supported rates, and stopModules clears all rates. */ + supported rates, and stopModules clears all rates. */ stopModules(pConn, TI_TRUE); - + /* send disconnect command to firmware */ prepare_send_disconnect(pData); } } - os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); return status; } @@ -567,25 +561,25 @@ static TI_STATUS connInfra_ScrWaitDisconn_to_disconnect(void *pData) if (status == TI_OK) { /* Update TxMgmtQueue SM to close Tx path for all except Mgmt packets. */ - txMgmtQ_SetConnState (pConn->hTxMgmtQ, TX_CONN_STATE_MGMT); - + txMgmtQ_SetConnState(pConn->hTxMgmtQ, TX_CONN_STATE_MGMT); + pParam->paramType = REGULATORY_DOMAIN_DISCONNECT_PARAM; regulatoryDomain_setParam(pConn->hRegulatoryDomain, pParam); - - status = mlme_stop( pConn->hMlmeSm, DISCONNECT_IMMEDIATE, pConn->disConnReasonToAP ); + + status = mlme_stop(pConn->hMlmeSm, DISCONNECT_IMMEDIATE, pConn->disConnReasonToAP); if (status == TI_OK) { /* Must be called AFTER mlme_stop. since De-Auth packet should be sent with the supported rates, and stopModules clears all rates. */ stopModules(pConn, TI_TRUE); - + /* send disconnect command to firmware */ prepare_send_disconnect(pData); } } - os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); return status; + } @@ -607,7 +601,7 @@ static TI_STATUS rsnWait_to_configHW(void *pData) status = rxData_setParam(pConn->hRxData, pParam); os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); if (status != TI_OK) - return status; + return status; status = qosMngr_connect(pConn->hQosMngr); if (status != TI_OK) @@ -619,15 +613,15 @@ static TI_STATUS rsnWait_to_configHW(void *pData) status = measurementMgr_connected(pConn->hMeasurementMgr); if (status != TI_OK) { - TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR, "Infra Conn status=%d, have to return (%d)\n",status,__LINE__); - return status; + TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR, "Infra Conn status=%d, have to return (%d)\n",status,__LINE__); + return status; } status = TrafficMonitor_Start(pConn->hTrafficMonitor); if (status != TI_OK) { - TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR, "Infra Conn status=%d, have to return (%d)\n",status,__LINE__); - return status; + TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR, "Infra Conn status=%d, have to return (%d)\n",status,__LINE__); + return status; } healthMonitor_setState(pConn->hHealthMonitor, HEALTH_MONITOR_STATE_CONNECTED); @@ -687,8 +681,10 @@ static TI_STATUS configHW_to_connected(void *pData) TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE, "************ NEW CONNECTION ************\n"); WLAN_OS_REPORT(("************ NEW CONNECTION ************\n")); siteMgr_printPrimarySiteDesc(pConn->hSiteMgr); - TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE, "****************************************\n"); + TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE, "****************************************\n"); WLAN_OS_REPORT(("****************************************\n")); +#else + os_printf("%s: *** NEW CONNECTION ***\n", __func__); #endif return TI_OK; diff --git a/wl1271/stad/src/Connection_Managment/externalSec.c b/wl1271/stad/src/Connection_Managment/externalSec.c index aa56c06e..64d7c9b7 100644 --- a/wl1271/stad/src/Connection_Managment/externalSec.c +++ b/wl1271/stad/src/Connection_Managment/externalSec.c @@ -115,8 +115,6 @@ TI_STATUS externalSec_config(mainSec_t *pMainSec) return status; } - - /** * * Function - externalSec_create. @@ -160,7 +158,6 @@ struct externalSec_t* externalSec_create(TI_HANDLE hOs) return pHandle; } - /** * * Function - externalSec_Destroy. @@ -185,20 +182,17 @@ TI_STATUS externalSec_Destroy (struct externalSec_t *pExternalSec) { return TI_NOK; } - - status = fsm_Unload (pExternalSec->hOs, pExternalSec->pExternalSecSm); + status = fsm_Unload(pExternalSec->hOs, pExternalSec->pExternalSecSm); if (status != TI_OK) { /* report failure but don't stop... */ TRACE0(pExternalSec->hReport, REPORT_SEVERITY_ERROR, "EXTERNAL SECURITY: Error releasing FSM memory \n"); } - os_memoryFree (pExternalSec->hOs, pExternalSec, sizeof(struct externalSec_t)); - + os_memoryFree(pExternalSec->hOs, pExternalSec, sizeof(struct externalSec_t)); return TI_OK; } - /** * * Function - externalSecSM_start. @@ -360,4 +354,3 @@ TI_STATUS externalSecSM_Unexpected(struct externalSec_t *pExternalSec) TRACE0(pExternalSec->hReport, REPORT_SEVERITY_ERROR, "EXTERNAL_SEC_SM: ERROR UnExpected Event\n"); return(TI_OK); } - diff --git a/wl1271/stad/src/Connection_Managment/rsn.c b/wl1271/stad/src/Connection_Managment/rsn.c index 02414026..70fcd29c 100644 --- a/wl1271/stad/src/Connection_Managment/rsn.c +++ b/wl1271/stad/src/Connection_Managment/rsn.c @@ -461,7 +461,6 @@ TI_STATUS rsn_start(TI_HANDLE hRsn) } TRACE0(pRsn->hReport, REPORT_SEVERITY_INFORMATION, "rsn_start ...\n"); - pRsn->rsnStartedTs = os_timeStampMs (pRsn->hOs); status = pRsn->pMainSecSm->start (pRsn->pMainSecSm); @@ -670,7 +669,7 @@ TI_STATUS rsn_getParamEncryptionStatus(TI_HANDLE hRsn, ECipherSuite *rsnStatus) TI_STATUS rsn_getParam(TI_HANDLE hRsn, void *param) { rsn_t *pRsn = (rsn_t *)hRsn; - paramInfo_t *pParam = (paramInfo_t*)param; + paramInfo_t *pParam = (paramInfo_t *)param; TI_STATUS status = TI_OK; if ( (NULL == pRsn) || (NULL == pParam) ) @@ -1223,7 +1222,6 @@ TI_STATUS rsn_reportStatus (rsn_t *pRsn, TI_STATUS rsnStatus) return TI_NOK; } - if (rsnStatus == TI_OK) { /* set EAPOL encryption status according to authentication protocol */ @@ -1584,9 +1582,13 @@ TI_STATUS rsn_setKey (rsn_t *pRsn, TSecurityKeys *pKey) TI_BOOL macIsBroadcast = TI_FALSE; TI_STATUS status = TI_OK; - keyIndex = (TI_UINT8)pKey->keyIndex; + if (pRsn == NULL || pKey == NULL) + { + return TI_NOK; + } - if ((pRsn == NULL) || (pKey == NULL) || ((keyIndex)>=MAX_KEYS_NUM)) + keyIndex = (TI_UINT8)pKey->keyIndex; + if (keyIndex >= MAX_KEYS_NUM) { return TI_NOK; } @@ -1649,6 +1651,7 @@ TI_STATUS rsn_setKey (rsn_t *pRsn, TSecurityKeys *pKey) txCtrlParams_setEncryptionFieldSizes (pRsn->hTxCtrl, 0); break; } + } pRsn->keys[keyIndex].keyType = pKey->keyType; @@ -1728,9 +1731,13 @@ TI_STATUS rsn_removeKey (rsn_t *pRsn, TSecurityKeys *pKey) TTwdParamInfo tTwdParam; TI_UINT8 keyIndex; - keyIndex = (TI_UINT8)pKey->keyIndex; + if (pRsn == NULL || pKey == NULL) + { + return TI_NOK; + } - if ( (NULL == pRsn) || (NULL == pKey) || (keyIndex >= MAX_KEYS_NUM) ) + keyIndex = (TI_UINT8)pKey->keyIndex; + if (keyIndex >= MAX_KEYS_NUM) { return TI_NOK; } @@ -1913,7 +1920,6 @@ TI_STATUS rsn_reportMicFailure(TI_HANDLE hRsn, TI_UINT8 *pType, TI_UINT32 Length (TI_UINT8*)AuthBuf, sizeof(TI_UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)); - if ( pRsn->bRsnExternalMode ) { return TI_OK; } diff --git a/wl1271/stad/src/Connection_Managment/rsnApi.h b/wl1271/stad/src/Connection_Managment/rsnApi.h index 4314e0dd..656d95d3 100644 --- a/wl1271/stad/src/Connection_Managment/rsnApi.h +++ b/wl1271/stad/src/Connection_Managment/rsnApi.h @@ -238,7 +238,6 @@ TI_STATUS rsn_eventRecv(TI_HANDLE hRsn, ERsnEvent event, void* pData); TI_STATUS rsn_setParam(TI_HANDLE hCtrlData, void *pParam); TI_STATUS rsn_getParamEncryptionStatus(TI_HANDLE hRsn, ECipherSuite *rsnStatus); - TI_STATUS rsn_getParam(TI_HANDLE hCtrlData, void *pParam); TI_STATUS rsn_evalSite(TI_HANDLE hRsn, TRsnData *pRsnData, TRsnSiteParams *pRsnSiteParams, TI_UINT32 *pMetric); diff --git a/wl1271/stad/src/Connection_Managment/sme.c b/wl1271/stad/src/Connection_Managment/sme.c index 029f4f08..c02893ef 100644 --- a/wl1271/stad/src/Connection_Managment/sme.c +++ b/wl1271/stad/src/Connection_Managment/sme.c @@ -362,6 +362,12 @@ TI_STATUS sme_SetParam (TI_HANDLE hSme, paramInfo_t *pParam) break; case SME_DESIRED_SSID_ACT_PARAM: + if (pParam->content.smeDesiredSSID.len > MAX_SSID_LEN) + { + /* printk("SSID length(%d) is out of range. Discard it.\n", pParam->content.smeDesiredSSID.len);*/ + return PARAM_VALUE_NOT_VALID; /* ssid length is out of range */ + } + pSme->bRadioOn = TI_TRUE; /* if new value is different than current one */ @@ -397,6 +403,9 @@ TI_STATUS sme_SetParam (TI_HANDLE hSme, paramInfo_t *pParam) pSme->bConstantScan = TI_FALSE; } + /* printk("SME_DESIRED_SSID_ACT_PARAM: bRadioOn = %d, bRunning = %d\n", pSme->bRadioOn, pSme->bRunning); */ + pSme->bRunning = TI_TRUE; /* set it to TRUE in case it's accidentally altered. */ + /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); break; @@ -553,12 +562,10 @@ void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus, TSme *pSme = (TSme*)hSme; paramInfo_t param; - switch (eStatus) { /* a frame was received - update the scan result table */ case SCAN_CRS_RECEIVED_FRAME: - TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received frame from BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); /* @@ -578,19 +585,17 @@ void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus, pSme->tSsid.len))) #endif { - if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update specific enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update specific entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } } else { - if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } } @@ -599,7 +604,7 @@ void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus, { if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update application scan enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update application scan entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } break; @@ -735,7 +740,7 @@ void sme_AppScanResult (TI_HANDLE hSme, EScanCncnResultStatus eStatus, if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_AppScanResult: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_AppScanResult: unable to update entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } break; @@ -783,7 +788,7 @@ void sme_MeansurementScanResult (TI_HANDLE hSme, EScanCncnResultStatus eStatus, if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_MeansurementScanResult: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_MeansurementScanResult: unable to update entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } break; @@ -990,4 +995,3 @@ void SME_Disconnect (TI_HANDLE hSme) /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } - diff --git a/wl1271/stad/src/Connection_Managment/smeSelect.c b/wl1271/stad/src/Connection_Managment/smeSelect.c index 55f6d2ed..74758890 100644 --- a/wl1271/stad/src/Connection_Managment/smeSelect.c +++ b/wl1271/stad/src/Connection_Managment/smeSelect.c @@ -81,7 +81,7 @@ TSiteEntry *sme_Select (TI_HANDLE hSme) /* on SG avalanche, select is not needed, send connect event automatically */ if (TI_TRUE == pSme->bReselect) - { + { paramInfo_t *pParam; TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: reselect flag is on, reselecting the current site\n"); @@ -100,7 +100,6 @@ TSiteEntry *sme_Select (TI_HANDLE hSme) pCurrentSite = pParam->content.pPrimarySite; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); return pCurrentSite; - } /* get the first site from the scan result table */ diff --git a/wl1271/stad/src/Connection_Managment/smeSm.c b/wl1271/stad/src/Connection_Managment/smeSm.c index 2f32bd71..dc673fe9 100644 --- a/wl1271/stad/src/Connection_Managment/smeSm.c +++ b/wl1271/stad/src/Connection_Managment/smeSm.c @@ -244,7 +244,6 @@ void smeSm_PreConnect (TI_HANDLE hSme) TSme *pSme = (TSme *)hSme; paramInfo_t *pParam; - /* set the connection mode with which this connection attempt is starting */ pSme->eLastConnectMode = pSme->eConnectMode; @@ -285,16 +284,17 @@ void smeSm_PreConnect (TI_HANDLE hSme) { /* makr whether we need to stop the attempt connection in manual mode */ pSme->bConnectRequired = TI_FALSE; - - TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "smeSm_PreConnect: No candidate available, sending connect failure\n"); + + TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "smeSm_PreConnect: No candidate available, sending connect failure\n"); /* manual mode and no connection candidate is available - connection failed */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } else /* IBSS */ { - TI_UINT8 uDesiredChannel; + TI_UINT8 uDesiredChannel; TI_BOOL channelValidity; + pSme->bConnectRequired = TI_FALSE; pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); @@ -324,7 +324,7 @@ void smeSm_PreConnect (TI_HANDLE hSme) pParam->content.channelCapabilityReq.scanOption = ACTIVE_SCANNING; pParam->content.channelCapabilityReq.channelNum = uDesiredChannel; - regulatoryDomain_getParam (pSme->hRegDomain,pParam); + regulatoryDomain_getParam (pSme->hRegDomain, pParam); channelValidity = pParam->content.channelCapabilityRet.channelValidity; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); if (!channelValidity) @@ -370,7 +370,7 @@ void smeSm_PreConnect (TI_HANDLE hSme) */ void smeSm_Connect (TI_HANDLE hSme) { - TSme *pSme = (TSme*)hSme; + TSme *pSme = (TSme*)hSme; TI_STATUS tStatus; paramInfo_t *pParam; @@ -406,8 +406,8 @@ void smeSm_Connect (TI_HANDLE hSme) pParam->content.connType = CONNECTION_IBSS; } else - pParam->content.connType = CONNECTION_INFRA; - conn_setParam(pSme->hConn, pParam); + pParam->content.connType = CONNECTION_INFRA; + conn_setParam(pSme->hConn, pParam); os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); /* start the connection process */ -- cgit v1.2.3