/** * * openAuth_Recv - Recive a message from the AP * * \b Description: * * Parse a message form the AP and perform the appropriate event. * * \b ARGS: * * I - hAuth - Association SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa openAuth_Start, openAuth_Stop */ TI_STATUS openAuth_Recv(TI_HANDLE hAuth, mlmeFrameInfo_t *pFrame) { TI_STATUS status; auth_t *pHandle; TI_UINT16 authAlgo; pHandle = (auth_t*)hAuth; if (pHandle == NULL) { return TI_NOK; } /* check response status */ authAlgo = ENDIAN_HANDLE_WORD(pFrame->content.auth.authAlgo); if ((authAlgo != AUTH_LEGACY_OPEN_SYSTEM) && (authAlgo != AUTH_LEGACY_RESERVED1)) { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); return TI_NOK; } if ((pHandle->authType==AUTH_LEGACY_RESERVED1) && (authAlgo !=AUTH_LEGACY_RESERVED1)) { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); } pHandle->authData.status = pFrame->content.auth.status; if (pHandle->authData.status == STATUS_SUCCESSFUL) { status = auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_SUCCESS, pHandle); } else { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); status = auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_FAIL, pHandle); } return status; }
/** * * mainKeySmLogMessage * * \b Description: * * Prints Log messge.\n * Start session timer. * * \b ARGS: * * I - pData - station control block \n * * \b RETURNS: * * OK on success, NOK otherwise. */ TI_STATUS mainKeys_smTimeOut(void* data) { OS_802_11_AUTHENTICATION_REQUEST *request; UINT8 AuthBuf[sizeof(UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)]; paramInfo_t param; TI_STATUS status; struct _mainKeys_t *pMainKeys = (struct _mainKeys_t *)data; WLAN_REPORT_INFORMATION(pMainKeys->hReport, RSN_MODULE_LOG, ("MAIN_KEY_SM: TRAP: Session Timeout for station , mainKeysTimeoutCounter=%d\n", pMainKeys->mainKeysTimeoutCounter)); request = (OS_802_11_AUTHENTICATION_REQUEST *)(AuthBuf + sizeof(UINT32)); request->Length = sizeof(OS_802_11_AUTHENTICATION_REQUEST); param.paramType = CTRL_DATA_CURRENT_BSSID_PARAM; status = ctrlData_getParam(pMainKeys->hCtrlData, ¶m); if (status != OK) { return NOK; } WLAN_REPORT_INFORMATION(pMainKeys->hReport, RSN_MODULE_LOG, ("current station is banned from the roaming candidates list for %d Ms\n", RSN_MAIN_KEYS_SESSION_TIMEOUT)); rsn_banSite(pMainKeys->hRsn, param.content.ctrlDataCurrentBSSID, RSN_SITE_BAN_LEVEL_FULL, RSN_MAIN_KEYS_SESSION_TIMEOUT); /* mainKeysTimeoutCounter is a boolean variable, With states: */ /* TRUE - It is a Timeout Association Event */ /* FALSE - It is a Media specific Event */ if (!pMainKeys->mainKeysTimeoutCounter) { /* Fill Media specific indication fields and send to OS/User */ os_memoryCopy(pMainKeys->hOs, request->BSSID, (void *)param.content.ctrlDataCurrentBSSID.addr, MAC_ADDR_LEN); request->Flags = OS_802_11_REQUEST_REAUTH; *(UINT32*)AuthBuf = os802_11StatusType_Authentication; WLAN_REPORT_INFORMATION(pMainKeys->hReport, RSN_MODULE_LOG, (" %d Ms\n",RSN_MAIN_KEYS_SESSION_TIMEOUT)); EvHandlerSendEvent(pMainKeys->hEvHandler, IPC_EVENT_MEDIA_SPECIFIC, (UINT8*)AuthBuf, sizeof(UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)); os_timerStart(pMainKeys->hOs, pMainKeys->timer, pMainKeys->keysTimeout, FALSE); pMainKeys->mainKeysTimeoutCounter = TRUE; } else { pMainKeys->mainKeysTimeoutCounter = FALSE; rsn_reportAuthFailure(pMainKeys->hRsn, RSN_AUTH_STATUS_TIMEOUT); conn_reportRsnStatus(pMainKeys->hConn, (mgmtStatus_e)STATUS_SECURITY_FAILURE); } return OK; }
TI_STATUS openAuth_smMaxRetryWait(auth_t *hAuth) { TI_STATUS status; rsn_reportAuthFailure(hAuth->hRsn, RSN_AUTH_STATUS_TIMEOUT); status = openAuth_smReportFailure(hAuth); return status; }
/** * * mainKeySmLogMessage * * \b Description: * * Prints Log messge.\n * Start session timer. * * \b ARGS: * * I - pData - station control block \n * * \b RETURNS: * * TI_OK on success, TI_NOK otherwise. */ TI_STATUS mainKeys_smTimeOut(void* data) { OS_802_11_AUTHENTICATION_REQUEST *request; TI_UINT8 AuthBuf[sizeof(TI_UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)]; paramInfo_t param; TI_STATUS status; struct _mainKeys_t *pMainKeys = (struct _mainKeys_t *)data; request = (OS_802_11_AUTHENTICATION_REQUEST *)(AuthBuf + sizeof(TI_UINT32)); request->Length = sizeof(OS_802_11_AUTHENTICATION_REQUEST); param.paramType = CTRL_DATA_CURRENT_BSSID_PARAM; status = ctrlData_getParam(pMainKeys->hCtrlData, ¶m); if (status != TI_OK) { return TI_NOK; } rsn_banSite(pMainKeys->hRsn, param.content.ctrlDataCurrentBSSID, RSN_SITE_BAN_LEVEL_FULL, RSN_MAIN_KEYS_SESSION_TIMEOUT); /* mainKeysTimeoutCounter is a boolean variable, With states: */ /* TI_TRUE - It is a Timeout Association Event */ /* TI_FALSE - It is a Media specific Event */ if (!pMainKeys->mainKeysTimeoutCounter) { /* Fill Media specific indication fields and send to OS/User */ MAC_COPY (request->BSSID, param.content.ctrlDataCurrentBSSID); request->Flags = OS_802_11_REQUEST_REAUTH; *(TI_UINT32*)AuthBuf = os802_11StatusType_Authentication; EvHandlerSendEvent(pMainKeys->hEvHandler, IPC_EVENT_MEDIA_SPECIFIC, (TI_UINT8*)AuthBuf, sizeof(TI_UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)); tmr_StartTimer (pMainKeys->hSessionTimer, mainKeys_sessionTimeout, (TI_HANDLE)pMainKeys, pMainKeys->keysTimeout, TI_FALSE); pMainKeys->mainKeysTimeoutCounter = TI_TRUE; } else { pMainKeys->mainKeysTimeoutCounter = TI_FALSE; rsn_reportAuthFailure(pMainKeys->hRsn, RSN_AUTH_STATUS_TIMEOUT); conn_reportRsnStatus(pMainKeys->hConn, (mgmtStatus_e)STATUS_SECURITY_FAILURE); } return TI_OK; }
/** * * openAuth_Recv - Recive a message from the AP * * \b Description: * * Parse a message form the AP and perform the appropriate event. * * \b ARGS: * * I - hAuth - Association SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa openAuth_Start, openAuth_Stop */ TI_STATUS openAuth_Recv(TI_HANDLE hAuth, mlmeFrameInfo_t *pFrame) { TI_STATUS status; auth_t *pHandle; TI_UINT16 authAlgo; pHandle = (auth_t*)hAuth; if (pHandle == NULL) { return TI_NOK; } /* check response status */ authAlgo = ENDIAN_HANDLE_WORD(pFrame->content.auth.authAlgo); if ((authAlgo != AUTH_LEGACY_OPEN_SYSTEM) && (authAlgo != AUTH_LEGACY_RESERVED1)) { TRACE0(pHandle->hReport, REPORT_SEVERITY_SM, "OPEN_AUTH_SM: DEBUG recieved authentication message with wrong algorithm \n"); rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); return TI_NOK; } if ((pHandle->authType==AUTH_LEGACY_RESERVED1) && (authAlgo !=AUTH_LEGACY_RESERVED1)) { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); } TRACE1(pHandle->hReport, REPORT_SEVERITY_SM, "OPEN_AUTH_SM: DEBUG Authentication status is %d \n", pFrame->content.auth.status); pHandle->authData.status = pFrame->content.auth.status; if (pHandle->authData.status == STATUS_SUCCESSFUL) { status = auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_SUCCESS, pHandle); } else { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); status = auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_FAIL, pHandle); } 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; }