/** * * admCtrlNone_config - Configure empty admission control. * * \b Description: * * Configure empty admission control. * * \b ARGS: * * I - pAdmCtrl - context \n * * \b RETURNS: * * TI_OK on success, TI_NOK on failure. * * \sa */ TI_STATUS admCtrlNone_config(admCtrl_t *pAdmCtrl) { TI_STATUS status; TRsnPaeConfig paeConfig; #ifdef XCC_MODULE_INCLUDED TTwdParamInfo tTwdParam; #endif if ((pAdmCtrl->authSuite != RSN_AUTH_OPEN ) && (pAdmCtrl->authSuite != RSN_AUTH_SHARED_KEY) && (pAdmCtrl->authSuite != RSN_AUTH_AUTO_SWITCH)) { /* The default is OPEN */ pAdmCtrl->authSuite = RSN_AUTH_OPEN; } /* set admission control parameters */ pAdmCtrl->keyMngSuite = RSN_KEY_MNG_NONE; pAdmCtrl->externalAuthMode = (EExternalAuthMode)pAdmCtrl->authSuite; /* set callback functions (API) */ pAdmCtrl->getInfoElement = admCtrlNone_getInfoElement; pAdmCtrl->setSite = admCtrlNone_setSite; pAdmCtrl->evalSite = admCtrlNone_evalSite; pAdmCtrl->getPmkidList = admCtrl_nullGetPMKIDlist; pAdmCtrl->setPmkidList = admCtrl_nullSetPMKIDlist; pAdmCtrl->resetPmkidList = admCtrl_resetPMKIDlist; pAdmCtrl->getPreAuthStatus = admCtrl_nullGetPreAuthStatus; pAdmCtrl->startPreAuth = admCtrl_nullStartPreAuth; pAdmCtrl->get802_1x_AkmExists = admCtrl_nullGet802_1x_AkmExists; /* set cipher suite */ pAdmCtrl->broadcastSuite = TWD_CIPHER_NONE; pAdmCtrl->unicastSuite = TWD_CIPHER_NONE; /* set PAE parametrs */ paeConfig.authProtocol = pAdmCtrl->externalAuthMode; paeConfig.unicastSuite = pAdmCtrl->unicastSuite; paeConfig.broadcastSuite = pAdmCtrl->broadcastSuite; paeConfig.keyExchangeProtocol = pAdmCtrl->keyMngSuite; /* set default PAE configuration */ status = pAdmCtrl->pRsn->setPaeConfig(pAdmCtrl->pRsn, &paeConfig); #ifdef XCC_MODULE_INCLUDED /* Clean MIC and KP in HAL and re-send WEP-keys */ tTwdParam.paramType = TWD_RSN_XCC_SW_ENC_ENABLE_PARAM_ID; tTwdParam.content.rsnXCCSwEncFlag = TI_FALSE; status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam); tTwdParam.paramType = TWD_RSN_XCC_MIC_FIELD_ENABLE_PARAM_ID; tTwdParam.content.rsnXCCMicFieldFlag = TI_FALSE; status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam); #endif /*XCC_MODULE_INCLUDED*/ return status; }
/** * * assoc_recv - Recive a message from the AP * * \b Description: * * Parse a message form the AP and perform the appropriate event. * * \b ARGS: * * I - hAssoc - Association SM context \n * I - pFrame - Frame recieved \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa assoc_Start, assoc_Stop */ TI_STATUS assoc_recv(TI_HANDLE hAssoc, mlmeFrameInfo_t *pFrame) { TI_STATUS status; assoc_t *pHandle = (assoc_t*)hAssoc; TTwdParamInfo tTwdParam; TI_UINT16 rspStatus; if (pHandle == NULL) { return TI_NOK; } /* ensure that the SM is waiting for assoc response */ if(pHandle->currentState != ASSOC_SM_STATE_WAIT) return TI_OK; if ((pFrame->subType != ASSOC_RESPONSE) && (pFrame->subType != RE_ASSOC_RESPONSE)) { return TI_NOK; } /* check response status */ rspStatus = pFrame->content.assocRsp.status; if (rspStatus == 0) { TRsnData rsnData; dot11_RSN_t *pRsnIe; TI_UINT8 curRsnData[255]; TI_UINT8 rsnAssocIeLen; TI_UINT8 length = 0; TRACE0(pHandle->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG Success associating to AP \n"); /* set AID to HAL */ tTwdParam.paramType = TWD_AID_PARAM_ID; tTwdParam.content.halCtrlAid = pFrame->content.assocRsp.aid; TWD_SetParam (pHandle->hTWD, &tTwdParam); /* Get the RSN IE data */ pRsnIe = pFrame->content.assocRsp.pRsnIe; while (length < pFrame->content.assocRsp.rsnIeLen && (pFrame->content.assocRsp.rsnIeLen < 255)) { curRsnData[0+length] = pRsnIe->hdr[0]; curRsnData[1+length] = pRsnIe->hdr[1]; os_memoryCopy(pHandle->hOs, &curRsnData[2+length], (void *)pRsnIe->rsnIeData, pRsnIe->hdr[1]); length += pRsnIe->hdr[1] + 2; pRsnIe += 1; } if (pFrame->content.assocRsp.rsnIeLen != 0) { rsnData.pIe = curRsnData; rsnData.ieLen = pFrame->content.assocRsp.rsnIeLen; rsnData.privacy = ((pFrame->content.assocRsp.capabilities >> CAP_PRIVACY_SHIFT) & CAP_PRIVACY_MASK) ? TI_TRUE : TI_FALSE; rsn_setSite(pHandle->hRsn, &rsnData, NULL, &rsnAssocIeLen); }
/** * \fn cmdDispatch_SetTwdParam / cmdDispatch_GetParam * \brief Set/Get a TWD parameter * * Set/Get a TWD parameter. * * \note * \param hCmdDispatch - The object * \param param - The parameter information * \return parameter set/get result * \sa */ static TI_STATUS cmdDispatch_SetTwdParam (TI_HANDLE hCmdDispatch, paramInfo_t *pParam) { TCmdDispatchObj *pCmdDispatch = (TCmdDispatchObj *)hCmdDispatch; pParam->paramType &= ~(SET_BIT | GET_BIT | TWD_MODULE_PARAM | ASYNC_PARAM | ALLOC_NEEDED_PARAM); return TWD_SetParam (pCmdDispatch->hTWD, (TTwdParamInfo *)pParam); }
/*************************************************************************** * SoftGemini_setParamsToFW * **************************************************************************** * DESCRIPTION: The function sets the FW with the appropriate parameters set. * * INPUTS: pSoftGemini - the object * * * OUTPUT: * * RETURNS: ***************************************************************************/ static TI_STATUS SoftGemini_setParamsToFW(TI_HANDLE hSoftGemini, TSoftGeminiParams *softGeminiParams) { SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; TTwdParamInfo param; os_memoryCopy(pSoftGemini->hOs,¶m.content.SoftGeminiParam, softGeminiParams, sizeof(TSoftGeminiParams)); param.paramType = TWD_SG_CONFIG_PARAM_ID; return TWD_SetParam (pSoftGemini->hTWD, ¶m); }
/*************************************************************************** * SoftGemini_setEnableParam * **************************************************************************** * DESCRIPTION: The function sets the appropriate Enable value, * configures SCR , POWER MGR , DATA CTRL , FW. * * INPUTS: pSoftGemini - the object ***************************************************************************/ static TI_STATUS SoftGemini_setEnableParam(TI_HANDLE hSoftGemini, ESoftGeminiEnableModes SoftGeminiEnable, TI_BOOL recovery) { SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; TTwdParamInfo param; TI_STATUS return_value = TI_OK; TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " setSoftGeminiEnableParam() - Old value = , New value = \n"); /* * PsPoll work around is active. Just save the value and configure it later */ if ( pSoftGemini->bPsPollFailureActive ) { TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " setSoftGeminiEnableParam() - while PsPollFailure is active\n"); pSoftGemini->PsPollFailureLastEnableValue = SoftGeminiEnable; return TI_OK; } /**********************************/ /* Sanity check on enable values */ /********************************/ /* Old Value New Value */ /* | | */ /* \|/ \|/ */ if ((pSoftGemini->SoftGeminiEnable == SoftGeminiEnable) && !recovery) { TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " - setting same value \n"); return TI_NOK; } /*******************************/ /* Make the necessary actions */ /*****************************/ switch (SoftGeminiEnable) { case SG_PROTECTIVE: case SG_OPPORTUNISTIC: /* set FW with SG_ENABLE */ param.paramType = TWD_SG_ENABLE_PARAM_ID; param.content.SoftGeminiEnable = SoftGeminiEnable; return_value = TWD_SetParam (pSoftGemini->hTWD, ¶m); break; case SG_DISABLE: /* set FW with SG_DISABLE */ param.paramType = TWD_SG_ENABLE_PARAM_ID; param.content.SoftGeminiEnable = SG_DISABLE; return_value = TWD_SetParam (pSoftGemini->hTWD, ¶m); if (pSoftGemini->bDriverEnabled) { SoftGemini_DisableDriver(hSoftGemini); } break; default: TRACE1(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " defualt :%d\n",SoftGeminiEnable); return TI_NOK; } /* Pass to the new enable state */ pSoftGemini->SoftGeminiEnable = SoftGeminiEnable; if (TI_OK != return_value) { TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " can't configure enable param to FW :\n"); } return return_value; }
/*************************************************************************** * SoftGemini_setEnableParam * **************************************************************************** * DESCRIPTION: The function sets the appropriate Enable value, * configures SCR , POWER MGR , DATA CTRL , FW. * * INPUTS: pSoftGemini - the object ***************************************************************************/ static TI_STATUS SoftGemini_setEnableParam(TI_HANDLE hSoftGemini, ESoftGeminiEnableModes SoftGeminiEnable, TI_BOOL recovery) { SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; TTwdParamInfo param; TI_STATUS return_value = TI_OK; /* * PsPoll work around is active. Just save the value and configure it later */ if ( pSoftGemini->bPsPollFailureActive ) { pSoftGemini->PsPollFailureLastEnableValue = SoftGeminiEnable; return TI_OK; } /**********************************/ /* Sanity check on enable values */ /********************************/ /* Old Value New Value */ /* | | */ /* \|/ \|/ */ if ((pSoftGemini->SoftGeminiEnable == SoftGeminiEnable) && !recovery) { return TI_NOK; } /*******************************/ /* Make the necessary actions */ /*****************************/ switch (SoftGeminiEnable) { case SG_PROTECTIVE: case SG_OPPORTUNISTIC: /* set FW with SG_ENABLE */ param.paramType = TWD_SG_ENABLE_PARAM_ID; param.content.SoftGeminiEnable = SoftGeminiEnable; return_value = TWD_SetParam (pSoftGemini->hTWD, ¶m); break; case SG_DISABLE: /* set FW with SG_DISABLE */ param.paramType = TWD_SG_ENABLE_PARAM_ID; param.content.SoftGeminiEnable = SG_DISABLE; return_value = TWD_SetParam (pSoftGemini->hTWD, ¶m); if (pSoftGemini->bDriverEnabled) { SoftGemini_DisableDriver(hSoftGemini); } break; default: return TI_NOK; } /* Pass to the new enable state */ pSoftGemini->SoftGeminiEnable = SoftGeminiEnable; return return_value; }
/** * * admCtrlNone_setSite - Set current primary site parameters for registration. * * \b Description: * * Set current primary site parameters for registration. * * \b ARGS: * * I - pAdmCtrl - context \n * I - pRsnData - site's RSN data \n * O - pAssocIe - result IE of evaluation \n * O - pAssocIeLen - length of result IE of evaluation \n * * \b RETURNS: * * TI_OK on site is aproved, TI_NOK on site is rejected. * * \sa */ TI_STATUS admCtrlNone_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 *pAssocIe, TI_UINT8 *pAssocIeLen) { TI_STATUS status; paramInfo_t param; TTwdParamInfo tTwdParam; EAuthSuite authSuite; admCtrlNone_config(pAdmCtrl); authSuite = pAdmCtrl->authSuite; /* Config the default keys */ if ((authSuite == RSN_AUTH_SHARED_KEY) || (authSuite == RSN_AUTH_AUTO_SWITCH)) { /* Configure Security status in HAL */ tTwdParam.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID; tTwdParam.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_WEP; status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam); /* Configure the keys in HAL */ rsn_setDefaultKeys(pAdmCtrl->pRsn); } #ifdef XCC_MODULE_INCLUDED admCtrlXCC_setExtendedParams(pAdmCtrl, pRsnData); #endif /* Now we configure the MLME module with the 802.11 legacy authentication suite, THe MLME will configure later the authentication module */ param.paramType = MLME_LEGACY_TYPE_PARAM; switch (authSuite) { case RSN_AUTH_OPEN: param.content.mlmeLegacyAuthType = AUTH_LEGACY_OPEN_SYSTEM; break; case RSN_AUTH_SHARED_KEY: param.content.mlmeLegacyAuthType = AUTH_LEGACY_SHARED_KEY; break; case RSN_AUTH_AUTO_SWITCH: param.content.mlmeLegacyAuthType = AUTH_LEGACY_AUTO_SWITCH; break; default: return TI_NOK; } status = mlme_setParam(pAdmCtrl->hMlme, ¶m); if (status != TI_OK) { return status; } param.paramType = RX_DATA_EAPOL_DESTINATION_PARAM; param.content.rxDataEapolDestination = OS_ABS_LAYER; status = rxData_setParam(pAdmCtrl->hRx, ¶m); if (status != TI_OK) { return status; } /* Configure privacy status in HAL */ if (authSuite == RSN_AUTH_OPEN) { tTwdParam.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID; tTwdParam.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_NONE; status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam); } return status; }
TI_STATUS mlme_assocRecv(TI_HANDLE hMlme, mlmeFrameInfo_t *pFrame) { TI_STATUS status = TI_OK; mlme_t *pMlme = (mlme_t*)hMlme; assoc_t *pAssoc; TTwdParamInfo tTwdParam; TI_UINT16 rspStatus; if (pMlme == NULL) { return TI_NOK; } pAssoc = &(pMlme->assocInfo); /* ensure that the SM is waiting for assoc response */ if(pAssoc->currentState != MLME_SM_STATE_ASSOC_WAIT) return TI_OK; if ((pFrame->subType != ASSOC_RESPONSE) && (pFrame->subType != RE_ASSOC_RESPONSE)) { return TI_NOK; } /* check response status */ rspStatus = pFrame->content.assocRsp.status; if (rspStatus == 0) { dot11_RSN_t *pRsnIe; TI_UINT8 curRsnData[255]; TI_UINT8 length = 0; TRACE0(pMlme->hReport, REPORT_SEVERITY_SM, "MLME_SM: DEBUG Success associating to AP \n"); /* set AID to HAL */ tTwdParam.paramType = TWD_AID_PARAM_ID; tTwdParam.content.halCtrlAid = pFrame->content.assocRsp.aid; TWD_SetParam (pMlme->hTWD, &tTwdParam); /* Get the RSN IE data */ pRsnIe = pFrame->content.assocRsp.pRsnIe; while (length < pFrame->content.assocRsp.rsnIeLen && (pFrame->content.assocRsp.rsnIeLen < 255)) { curRsnData[0+length] = pRsnIe->hdr[0]; curRsnData[1+length] = pRsnIe->hdr[1]; os_memoryCopy(pMlme->hOs, &curRsnData[2+length], (void *)pRsnIe->rsnIeData, pRsnIe->hdr[1]); length += pRsnIe->hdr[1] + 2; pRsnIe += 1; } /* update siteMgr with capabilities and whether we are connected to Cisco AP */ siteMgr_assocReport(pMlme->hSiteMgr, pFrame->content.assocRsp.capabilities, pFrame->content.assocRsp.ciscoIEPresent); /* update QoS Manager - it the QOS active protocol is NONE, or no WME IE present, it will return TI_OK */ /* if configured by AP, update MSDU lifetime */ status = qosMngr_setSite(pMlme->hQosMngr, &pFrame->content.assocRsp); if(status != TI_OK) { TRACE0(pMlme->hReport, REPORT_SEVERITY_ERROR, "MLME_SM: DEBUG - Association failed : qosMngr_setSite error \n"); /* in case we wanted to work with qosAP and failed to connect to qos AP we want to reassociated again to another one */ pMlme->mlmeData.mgmtStatus = STATUS_UNSPECIFIED; pMlme->mlmeData.uStatusCode = status; mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_FAIL, pMlme); } else { mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_SUCCESS, pMlme); } } else { pAssoc->assocRejectCount++; /* If there was attempt to renegotiate voice settings, update QoS Manager */ qosMngr_checkTspecRenegResults(pMlme->hQosMngr, &pFrame->content.assocRsp); /* check failure reason */ switch (rspStatus) { case 0: break; case 1: /* print debug message */ TRACE0(pMlme->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG - Association denied: Unspecified error \n"); break; case 10: /* print debug message */ TRACE0(pMlme->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG - Association denied: Cannot support all requested capabilities in the Capability Information field \n"); break; case 11: /* print debug message */ TRACE0(pMlme->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG - Association denied: Reassociation denied due to inability to confirm that association exists \n"); break; case 12: /* print debug message */ TRACE0(pMlme->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG - Association denied: Association denied due to reason outside the scope of this standard \n"); rsn_reportAuthFailure(pMlme->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); break; case 13: TRACE0(pMlme->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG - Association denied: Association denied due to wrong authentication algorithm \n"); rsn_reportAuthFailure(pMlme->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); break; case 17: /* print debug message */ TRACE0(pMlme->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG - Association denied: Association denied because AP is unable to handle additional associated stations \n"); break; case 18: /* print debug message */ TRACE0(pMlme->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG - Association denied: Association denied due to requesting station not supporting all of the data rates in the BSSBasicRateSet parameter \n"); break; default: /* print error message on wrong error code for association response */ TRACE1(pMlme->hReport, REPORT_SEVERITY_ERROR, "ASSOC_SM: ERROR - Association denied: error code (%d) irrelevant \n", rspStatus); break; } pMlme->mlmeData.mgmtStatus = STATUS_ASSOC_REJECT; pMlme->mlmeData.uStatusCode = TI_OK; mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_FAIL, pMlme); } return status; }
/** * * admCtrlWep_setSite - Set current primary site parameters for registration. * * \b Description: * * Set current primary site parameters for registration. * * \b ARGS: * * I - pAdmCtrl - context \n * I - pRsnData - site's RSN data \n * O - pAssocIe - result IE of evaluation \n * O - pAssocIeLen - length of result IE of evaluation \n * * \b RETURNS: * * TI_OK on site is aproved, TI_NOK on site is rejected. * * \sa */ TI_STATUS admCtrlWep_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 *pAssocIe, TI_UINT8 *pAssocIeLen) { TI_STATUS status; paramInfo_t param; TTwdParamInfo tTwdParam; EAuthSuite authSuite; #ifdef XCC_MODULE_INCLUDED if (mlmeParser_ParseIeBuffer (pAdmCtrl->hMlme, pRsnData->pIe, pRsnData->ieLen, XCC_EXT_1_IE_ID, NULL, NULL, 0)) { pAdmCtrl->XCCSupport = TI_TRUE; return (admCtrlXCC_setSite(pAdmCtrl, pRsnData, pAssocIe, pAssocIeLen)); } #endif pAdmCtrl->XCCSupport = TI_FALSE; pAdmCtrl->unicastSuite = TWD_CIPHER_WEP; pAdmCtrl->broadcastSuite = TWD_CIPHER_WEP; admCtrlWep_config(pAdmCtrl); authSuite = pAdmCtrl->authSuite; /* Config the default keys */ if ((authSuite == RSN_AUTH_SHARED_KEY) || (authSuite == RSN_AUTH_AUTO_SWITCH)) { /* Configure Security status in HAL */ tTwdParam.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID; tTwdParam.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_WEP; status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam); /* Configure the keys in HAL */ rsn_setDefaultKeys(pAdmCtrl->pRsn); } /* Now we configure the MLME module with the 802.11 legacy authentication suite, THe MLME will configure later the authentication module */ param.paramType = MLME_LEGACY_TYPE_PARAM; #ifdef XCC_MODULE_INCLUDED if (pAdmCtrl->networkEapMode!=OS_XCC_NETWORK_EAP_OFF) { param.content.mlmeLegacyAuthType = AUTH_LEGACY_RESERVED1; } else #endif { switch (authSuite) { case RSN_AUTH_OPEN: param.content.mlmeLegacyAuthType = AUTH_LEGACY_OPEN_SYSTEM; break; case RSN_AUTH_SHARED_KEY: param.content.mlmeLegacyAuthType = AUTH_LEGACY_SHARED_KEY; break; case RSN_AUTH_AUTO_SWITCH: param.content.mlmeLegacyAuthType = AUTH_LEGACY_AUTO_SWITCH; TRACE0(pAdmCtrl->hReport , REPORT_SEVERITY_INFORMATION, "WEP admCtrl mlme_setParam, RSN_AUTH_AUTO_SWITCH\n"); break; default: return TI_NOK; } } status = mlme_setParam(pAdmCtrl->hMlme, ¶m); if (status != TI_OK) { return status; } param.paramType = RX_DATA_EAPOL_DESTINATION_PARAM; param.content.rxDataEapolDestination = OS_ABS_LAYER; status = rxData_setParam(pAdmCtrl->hRx, ¶m); if (status != TI_OK) { return status; } /* Configure Security status in HAL */ tTwdParam.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID; tTwdParam.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_WEP; status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam); return status; }