/**
*
* mlme_reportAssocStatus - Set a specific parameter to the MLME SM
*
* \b Description:
*
* Set a specific parameter to the MLME SM.
*
* \b ARGS:
*
*  I   - hMlme - MLME SM context  \n
*  I/O - pParam - Parameter \n
*
* \b RETURNS:
*
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Start, mlme_Stop
*/
TI_STATUS mlme_reportAssocStatus(TI_HANDLE hMlme, TI_UINT16 status)
{
	mlme_t      *pHandle;
	TI_STATUS   fStatus;

	pHandle = (mlme_t*)hMlme;

	if (pHandle == NULL)
		return TI_NOK;

	if (pHandle->legacyAuthType == AUTH_LEGACY_NONE)
		return TI_NOK;

	pHandle->mlmeData.uStatusCode = status;

	/* If status is successful */
	if (status == 0) {
		pHandle->mlmeData.mgmtStatus = STATUS_SUCCESSFUL;
		fStatus = mlme_smEvent(&pHandle->currentState, MLME_SM_EVENT_ASSOC_SUCCESS, pHandle);
	} else {
		pHandle->mlmeData.mgmtStatus = STATUS_ASSOC_REJECT;
		fStatus = mlme_smEvent(&pHandle->currentState, MLME_SM_EVENT_ASSOC_FAIL, pHandle);
	}

	return fStatus;
}
Example #2
0
/**
*
* mlme_authRecv - Recive an authentication message from the AP
*
* \b Description:
* Parse a message form the AP and perform the appropriate event.
*
* \b ARGS:
*  I   - hMlme - mlme handler  \n
*
* \b RETURNS:
*  TI_OK if successful, TI_NOK otherwise.
*
*/
TI_STATUS mlme_authRecv(TI_HANDLE hMlme, mlmeFrameInfo_t *pFrame)
{
	mlme_t	*pMlme = (mlme_t*)hMlme;
	if ((pMlme == NULL) || (pFrame->subType != AUTH) || (pMlme->authInfo.authType == AUTH_LEGACY_NONE))
		return TI_NOK;

	/*
	 * If we asked for shared, the failure response can come back as open
	 * Note this code assumes we try shared first.
	 */
	if (pFrame->content.auth.authAlgo != pMlme->authInfo.authType &&
		!(pFrame->content.auth.status != STATUS_SUCCESSFUL &&
		  pFrame->content.auth.authAlgo == AUTH_LEGACY_OPEN_SYSTEM &&
		  pMlme->authInfo.authType == AUTH_LEGACY_SHARED_KEY &&
		  pMlme->legacyAuthType == RSN_AUTH_AUTO_SWITCH))
	{
		return TI_NOK;
	}

	if (pFrame->content.auth.status != STATUS_SUCCESSFUL)
	{
		pMlme->authInfo.authRejectCount++;

		pMlme->mlmeData.mgmtStatus = STATUS_AUTH_REJECT;
		pMlme->mlmeData.uStatusCode = TI_OK;

		mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_FAIL, pMlme);
		return TI_OK;
	}

	TRACE1(pMlme->hReport, REPORT_SEVERITY_INFORMATION, "mlme_authRecv authAlgo = %d\n", pFrame->content.auth.authAlgo);
	if (pFrame->content.auth.authAlgo == AUTH_LEGACY_SHARED_KEY)
	{
		pMlme->authInfo.authData.challangeLen = pFrame->content.auth.pChallenge->hdr[1];
		pMlme->authInfo.authData.pChalange = pFrame->content.auth.pChallenge->text;
		switch (pFrame->content.auth.seqNum)
		{
		case 2:
			mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_SHARED_RECV, pMlme);
			break;
		case 4:
			mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_SUCCESS, pMlme);
			break;
		default:
			TRACE1(pMlme->hReport, REPORT_SEVERITY_ERROR, "mlme_authRecv: authAlgo = AUTH_LEGACY_SHARED_KEY, unexpected seqNum = %d\n",
				   pFrame->content.auth.seqNum);

			return TI_NOK;
		}
	}
	else
	{
		mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_SUCCESS, pMlme);
	}
	return TI_OK;
}
Example #3
0
/**
*
* mlme_authRecv - Recive an authentication message from the AP
*
* \b Description:
* Parse a message form the AP and perform the appropriate event.
*
* \b ARGS:
*  I   - hMlme - mlme handler  \n
*
* \b RETURNS:
*  TI_OK if successful, TI_NOK otherwise.
*
*/
TI_STATUS mlme_authRecv(TI_HANDLE hMlme, mlmeFrameInfo_t *pFrame)
{
	mlme_t	*pMlme = (mlme_t*)hMlme;
	if ((pMlme == NULL) || (pFrame->subType != AUTH) || (pMlme->authInfo.authType == AUTH_LEGACY_NONE))
		return TI_NOK;

	if (pFrame->content.auth.authAlgo != pMlme->authInfo.authType)
	{
		return TI_NOK;
	}

	if (pFrame->content.auth.status != STATUS_SUCCESSFUL)
	{
		pMlme->authInfo.authRejectCount++;

		pMlme->mlmeData.mgmtStatus = STATUS_AUTH_REJECT;
		pMlme->mlmeData.uStatusCode = TI_OK;

		mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_FAIL, pMlme);
		return TI_OK;
	}

	TRACE1(pMlme->hReport, REPORT_SEVERITY_INFORMATION, "mlme_authRecv authAlgo = %d\n", pFrame->content.auth.authAlgo);
	if (pFrame->content.auth.authAlgo == AUTH_LEGACY_SHARED_KEY)
	{
		pMlme->authInfo.authData.challangeLen = pFrame->content.auth.pChallenge->hdr[1];
		pMlme->authInfo.authData.pChalange = pFrame->content.auth.pChallenge->text;
		switch (pFrame->content.auth.seqNum)
		{
		case 2:
			mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_SHARED_RECV, pMlme);
			break;
		case 4:
			mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_SUCCESS, pMlme);
			break;
		default:
			TRACE1(pMlme->hReport, REPORT_SEVERITY_ERROR, "mlme_authRecv: authAlgo = AUTH_LEGACY_SHARED_KEY, unexpected seqNum = %d\n",
				   pFrame->content.auth.seqNum);

			return TI_NOK;
		}
	}
	else
	{
		mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_SUCCESS, pMlme);
	}
	return TI_OK;
}
Example #4
0
/** 
 * \fn     mlme_sendAssocRequest 
 * \brief  sends association request
 * 
 * The function builds and sends the association request according to the 
 * mlme parames
 * 
 * \param  pMlme - pointer to mlme_t
 * \return TI_OK if auth send successfully
 *         TI_NOK otherwise
 * 
 * \sa     mlme_assocRequestMsgBuild 
 */ 
TI_STATUS mlme_sendAssocRequest(mlme_t *pMlme)
{
	TI_STATUS status = TI_OK;
	static TI_UINT8            assocMsg[MAX_ASSOC_MSG_LENGTH];
	TI_UINT32           msgLen;
	dot11MgmtSubType_e  assocType=ASSOC_REQUEST;

	if ( pMlme->assocInfo.retryCount >= pMlme->assocInfo.maxCount)
	{
		TRACE0(pMlme->hReport, REPORT_SEVERITY_ERROR, "mlme_sendAssocRequest: retry count - failed to send assoc request\n");
        pMlme->mlmeData.mgmtStatus = STATUS_UNSPECIFIED;
        pMlme->mlmeData.uStatusCode = TI_NOK;
		mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_FAIL, pMlme);
		return TI_NOK;
	}
	pMlme->assocInfo.retryCount++;

	if (pMlme->reAssoc)
	{
		assocType = RE_ASSOC_REQUEST;
	}

	status = mlme_assocRequestMsgBuild(pMlme, assocMsg, &msgLen);
	if (status == TI_OK) {

        TRACE_INFO_HEX(pMlme->hReport,(TI_UINT8 *)assocMsg, msgLen);
		/* Save the association request message */
		mlme_saveAssocReqMessage(pMlme, assocMsg, msgLen);
		status = mlmeBuilder_sendFrame(pMlme, assocType, assocMsg, msgLen, 0);
	}

    return status;
}
/**
*
* mlme_reportAuthStatus - Set a specific parameter to the MLME SM
*
* \b Description:
*
* Set a specific parameter to the MLME SM.
*
* \b ARGS:
*
*  I   - hMlme - MLME SM context  \n
*  I/O - pParam - Parameter \n
*
* \b RETURNS:
*
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Start, mlme_Stop
*/
TI_STATUS mlme_reportAuthStatus(TI_HANDLE hMlme, TI_UINT16 status)
{
	mlme_t          *pHandle;
	paramInfo_t     param;
	TI_STATUS       fStatus;

	pHandle = (mlme_t*)hMlme;

	if (pHandle == NULL)
		return TI_NOK;

	if (pHandle->legacyAuthType == AUTH_LEGACY_NONE)
		return TI_NOK;

	pHandle->mlmeData.uStatusCode = status;

	/* If status is successful */
	if (status == 0) {
		/* Mark a successful status - used for conn.c */
		pHandle->mlmeData.mgmtStatus = STATUS_SUCCESSFUL;
		fStatus = mlme_smEvent(&pHandle->currentState, MLME_SM_EVENT_AUTH_SUCCESS, pHandle);
	} else {
		/* Now, if the MLME legacy auth type is AUTO_SWITCH, and the Auth legacy auth type is shared key,
		    we configure the auth SM to open system, otherwise, this is really an authentication failure. */
		param.paramType = AUTH_LEGACY_TYPE_PARAM;
		auth_getParam(pHandle->hAuth, &param);

		if ((pHandle->legacyAuthType == AUTH_LEGACY_AUTO_SWITCH) && (param.content.authLegacyAuthType ==  AUTH_LEGACY_SHARED_KEY)) {
			param.content.authLegacyAuthType = AUTH_LEGACY_OPEN_SYSTEM;
			fStatus = auth_setParam(pHandle->hAuth, &param);
			fStatus = auth_start(pHandle->hAuth);
		}

		else {
			pHandle->mlmeData.mgmtStatus = STATUS_AUTH_REJECT;
			fStatus = mlme_smEvent(&pHandle->currentState, MLME_SM_EVENT_AUTH_FAIL, pHandle);
		}

	}

	return fStatus;
}
/**
*
* mlme_Stop - Stop event for the MLME SM
*
* \b Description:
*
* Stop event for the MLME SM
*
* \b ARGS:
*
*  I   - hMlme - MLME SM context  \n
*
* \b RETURNS:
*
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Start, mlme_Recv
*/
TI_STATUS mlme_stop(TI_HANDLE hMlme, DisconnectType_e disConnType, mgmtStatus_e reason)
{
	TI_STATUS       status;
	mlme_t      *pHandle;

	pHandle = (mlme_t*)hMlme;

	if (pHandle->legacyAuthType == AUTH_LEGACY_NONE)
		return TI_NOK;

	pHandle->disConnType = disConnType;
	pHandle->disConnReason = reason;

	status = mlme_smEvent(&pHandle->currentState, MLME_SM_EVENT_STOP, pHandle);

	return status;
}
/**
*
* mlme_Start - Start event for the MLME SM
*
* \b Description:
*
* Start event for the MLME SM
*
* \b ARGS:
*
*  I   - hMlme - MLME SM context  \n
*
* \b RETURNS:
*
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Stop, mlme_Recv
*/
TI_STATUS mlme_start(TI_HANDLE hMlme)
{
	TI_STATUS	status;
	mlme_t		*pHandle = (mlme_t*)hMlme;

	if (pHandle == NULL) {
		return TI_NOK;
	}

	if (pHandle->legacyAuthType == AUTH_LEGACY_NONE) {
		TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "mlme_start: pHandle->legacyAuthType == AUTH_LEGACY_NONE\n");
		return TI_NOK;
	}

	status = mlme_smEvent(&pHandle->currentState, MLME_SM_EVENT_START, pHandle);

	return status;
}
Example #8
0
/**
*
* mlme_Stop - Stop event for the MLME SM
*
* \b Description:
* Stop event for the MLME SM
*
* \b ARGS:
*  I   - hMlme - MLME SM context  \n
*
* \b RETURNS:
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Start, mlme_Recv
*/
TI_STATUS mlme_stop(TI_HANDLE hMlme, DisconnectType_e disConnType, mgmtStatus_e reason)
{
    mlme_t      *pMlme;

    pMlme = (mlme_t*)hMlme;

	mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_STOP, pMlme);

    if (pMlme->authInfo.authType == AUTH_LEGACY_NONE)
	{
        return TI_NOK;
	}

    pMlme->disConnType = disConnType;
    pMlme->disConnReason = reason;

    return TI_OK;
}
Example #9
0
/**
* mlme_Start - Start event for the MLME SM
*
* \b Description:
* Start event for the MLME SM
*
* \b ARGS:
*  I   - hMlme - MLME SM context  \n
*  II  - connectionType - roaming or initial? with FT (802.11r) or not?
* \b RETURNS:
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Stop, mlme_Recv
*/
TI_STATUS mlme_start(TI_HANDLE hMlme, TI_UINT8 connectionType)
{
	EConnType econnectionType = (EConnType)connectionType;
	mlme_t		*pMlme = (mlme_t*)hMlme;
    paramInfo_t *pParam;

	if (pMlme == NULL)
    {
        return TI_NOK;
    }

    pParam = (paramInfo_t *)os_memoryAlloc(pMlme->hOs, sizeof(paramInfo_t));

    if (pParam == NULL)
    {
        return TI_NOK;
    }

	pMlme->assocInfo.disAssoc = TI_FALSE;

	pParam->paramType = RSN_EXT_AUTHENTICATION_MODE;
	rsn_getParam(pMlme->hRsn, pParam);

	switch (econnectionType)
	{
	case CONN_TYPE_FIRST_CONN:
	case CONN_TYPE_ROAM:
		if (AUTH_LEGACY_SHARED_KEY == pParam->content.rsnExtAuthneticationMode)
		{
			pMlme->authInfo.authType = AUTH_LEGACY_SHARED_KEY;
		}
		else
		{
			pMlme->authInfo.authType = AUTH_LEGACY_OPEN_SYSTEM;
		}
		break;
	default:
		pMlme->authInfo.authType = AUTH_LEGACY_OPEN_SYSTEM;
		break;
	}
	mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_START, pMlme);
	return TI_OK;
}
Example #10
0
/**
* mlme_Start - Start event for the MLME SM
*
* \b Description:
* Start event for the MLME SM
*
* \b ARGS:
*  I   - hMlme - MLME SM context  \n
*  II  - connectionType - roaming or initial? with FT (802.11r) or not?
* \b RETURNS:
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Stop, mlme_Recv
*/
TI_STATUS mlme_start(TI_HANDLE hMlme, TI_UINT8 connectionType)
{
	EConnType econnectionType = (EConnType)connectionType;
	mlme_t		*pMlme = (mlme_t*)hMlme;
    paramInfo_t param;

	if (pMlme == NULL)
    {
        return TI_NOK;
    }

	pMlme->assocInfo.disAssoc = TI_FALSE;

	param.paramType = RSN_EXT_AUTHENTICATION_MODE;
	rsn_getParam(pMlme->hRsn, &param);
	pMlme->legacyAuthType = AUTH_LEGACY_NONE;
    switch (econnectionType)
	{
	case CONN_TYPE_FIRST_CONN:
	case CONN_TYPE_ROAM:
        if (RSN_AUTH_SHARED_KEY == param.content.rsnExtAuthneticationMode)
        {
            pMlme->authInfo.authType = AUTH_LEGACY_SHARED_KEY;
        }
        else if (RSN_AUTH_AUTO_SWITCH == param.content.rsnExtAuthneticationMode)
        {
            pMlme->authInfo.authType = AUTH_LEGACY_SHARED_KEY;  /* the default of AutoSwitch mode is SHARED mode */
			pMlme->legacyAuthType = RSN_AUTH_AUTO_SWITCH;   /* legacyAuthType indecate that the auth mode is AutoSwitch */
			pMlme->bSharedFailed = TI_FALSE;
        }
        else
		{
			pMlme->authInfo.authType = AUTH_LEGACY_OPEN_SYSTEM;
		}
		break;
	default:
		pMlme->authInfo.authType = AUTH_LEGACY_OPEN_SYSTEM;
		break;
	}
	mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_START, pMlme);
	return TI_OK;
}
Example #11
0
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;
}