/* STOP_RSN, SET_DATA_PORT_CLOSE, STOP_MLME, DIS_JOIN */
static TI_STATUS rsnWait_to_disassociate(void *pData)
{
    TI_STATUS status;
    paramInfo_t param;
    conn_t *pConn = (conn_t *)pData;

    status = rsn_stop(pConn->hRsn, pConn->disConEraseKeys);
    if (status != OK)
        return status;

    param.paramType = RX_DATA_PORT_STATUS_PARAM;
    param.content.rxDataPortStatus = CLOSE;
    status = rxData_setParam(pConn->hRxData, &param);
    if (status != OK)
        return status;

    param.paramType = TX_DATA_PORT_STATUS_PARAM;
    param.content.txDataPortStatus = CLOSE;
    status = txData_setParam(pConn->hTxData, &param);
    if (status != OK)
        return status;

    /* Start the disconnect complete time out timer. 
        This should be done BEFORE calling mlme_stop, which invokes Disconect Complete
        event, which stops the timer. */
    os_timerStart(pConn->hOs, pConn->pTimer, DISCONNECT_TIMEOUT, FALSE);

    status = mlme_stop( pConn->hMlmeSm, pConn->disConnType, pConn->disConnReasonToAP );

    if (status != OK)
        return status;

    return OK;
}
/**
*
* 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, &param);
	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;
}
Example #3
0
/**
 * \fn     tmr_StartTimer
 * \brief  Start a timer
 *
 * Start the specified timer running.
 *
 * \note   Periodic-Timer may be used by applications that serve the timer expiry
 *           in a single context.
 *         If an application can't finish serving the timer expiry in a single context,
 *           e.g. periodic scan, then it isn't recommended to use the periodic timer service.
 *         If such an application uses the periodic timer then it should protect itself from cases
 *            where the timer expires again before the previous timer expiry processing is finished!!
 * \param  hTimerInfo    - The specific timer handle
 * \param  fExpiryCbFunc - The timer's expiry callback function.
 * \param  hExpiryCbHndl - The client's expiry callback function handle.
 * \param  uIntervalMsec - The timer's duration in Msec.
 * \param  bPeriodic     - If TRUE, the timer is restarted after expiry.
 * \return void
 * \sa     tmr_StopTimer, tmr_GetExpiry
 */
void tmr_StartTimer (TI_HANDLE     hTimerInfo,
                     TTimerCbFunc  fExpiryCbFunc,
                     TI_HANDLE     hExpiryCbHndl,
                     TI_UINT32     uIntervalMsec,
                     TI_BOOL       bPeriodic)
{
	TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */
	TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */

	if (!pTimerModule) {
		WLAN_OS_REPORT (("tmr_StartTimer(): ERROR - NULL timer!\n"));
		return;
	}

	/* Save the timer parameters. */
	pTimerInfo->fExpiryCbFunc            = fExpiryCbFunc;
	pTimerInfo->hExpiryCbHndl            = hExpiryCbHndl;
	pTimerInfo->uIntervalMsec            = uIntervalMsec;
	pTimerInfo->bPeriodic                = bPeriodic;
	pTimerInfo->bOperStateWhenStarted    = pTimerModule->bOperState;
	pTimerInfo->uTwdInitCountWhenStarted = pTimerModule->uTwdInitCount;

	/* Start OS-API timer running */
	os_timerStart(pTimerModule->hOs, pTimerInfo->hOsTimerObj, uIntervalMsec);
}
void FW_DebugSendPacket(TI_HANDLE hDrvMain ,TI_HANDLE hOs, TI_HANDLE hTxMgmtQ, void *pParam)
{
	void *fSendPkt;

	if ( pParam == NULL ) {
		os_printf("\nFW_DebugSendPacket Error: received NULL parameter\n");
		return;
	}

	/* Open Tx path for all packet types */
	txMgmtQ_SetConnState (hTxMgmtQ, TX_CONN_STATE_MGMT);
	txMgmtQ_SetConnState (hTxMgmtQ, TX_CONN_STATE_EAPOL);
	txMgmtQ_SetConnState (hTxMgmtQ, TX_CONN_STATE_OPEN);

	infinitLoopFl	= 0;
	numOfPackets 	= 1;
	packetsNum 		= 1;
	packetLength    = *(TI_UINT32*)pParam;
	os_printf("\nFW_DebugSendPacket: packetsNum = %d, packetLength = %d\n",packetsNum, packetLength);
	fSendPkt = bSendDataPkt ? sendDataPacket : sendMgmtPacket;
	dTimer = os_timerCreate(hOs, fSendPkt, hDrvMain);
	os_timerStart(hOs, dTimer, 1000);

	SendFlag = TI_TRUE;
}
void FW_DebugInfinitSendPacket(TI_HANDLE hDrvMain ,TI_HANDLE hOs)
{
	infinitLoopFl = 1;
	numOfPackets = 1;

	dTimer = os_timerCreate(hOs, sendMgmtPacket, hDrvMain);
	os_timerStart(hOs, dTimer, 1000);
	SendFlag = TI_TRUE;
}
static TI_STATUS connect_to_disassociate(void *pData)
{
    TI_STATUS status;
    paramInfo_t param;
    conn_t *pConn = (conn_t *)pData;

    status = rsn_stop(pConn->hRsn, pConn->disConEraseKeys);
    if (status != OK)
        return status;

    param.paramType = RX_DATA_PORT_STATUS_PARAM;
    param.content.rxDataPortStatus = CLOSE;
    status = rxData_setParam(pConn->hRxData, &param);
    if (status != OK)
        return status;

    param.paramType = TX_DATA_PORT_STATUS_PARAM;
    param.content.txDataPortStatus = CLOSE;
    status = txData_setParam(pConn->hTxData, &param);
    if (status != OK)
        return status;

    param.paramType = REGULATORY_DOMAIN_DISCONNECT_PARAM;
    regulatoryDomain_setParam(pConn->hRegulatoryDomain, &param);

    /* Start the disconnect complete time out timer. 
        This should be done BEFORE calling mlme_stop, which invokes Disconect Complete
        event, which stops the timer. */
    os_timerStart(pConn->hOs, pConn->pTimer, DISCONNECT_TIMEOUT, FALSE);

    status = mlme_stop( pConn->hMlmeSm, pConn->disConnType, pConn->disConnReasonToAP );
    if (status != OK)
        return status;

    /* Must be called AFTER mlme_stop. since De-Auth packet should be sent with the
        supported rates, and stopModules clears all rates. */
    stopModules(pConn);

    return OK;

}
void sendMgmtPacket(TI_HANDLE hOs)
{
	static TI_UINT8            aMsg[2000];
	TI_UINT32           i;
	dot11MgmtSubType_e  eMsgType = DE_AUTH;

	for (i = 0; i < packetLength; i++) {
		aMsg[i] = i;
	}

	mlmeBuilder_sendFrame(tmp_hMlme, eMsgType, aMsg, packetLength, 0);

	numOfPackets++;
	if ((infinitLoopFl == 0) && (numOfPackets > packetsNum)) {
		os_timerStop(hOs, dTimer);
		os_printf("\n *********** Last Packet was sent **********");
		os_timerDestroy(hOs, dTimer);
	} else {
		os_timerStart(hOs, dTimer, 1000);
	}
}
TI_STATUS mainKeys_startIdle(struct _mainKeys_t *pMainKeys)
{
	TI_STATUS  status;
	
	status = pMainKeys->pUcastSm->start(pMainKeys->pUcastSm);
	if (status != OK)
	{
		return NOK;
	}

	status = pMainKeys->pBcastSm->start(pMainKeys->pBcastSm);
	if (status != OK)
	{
		return NOK;
	}

	os_timerStart(pMainKeys->hOs, pMainKeys->timer, pMainKeys->keysTimeout, FALSE);
	
	status = pMainKeys->pKeyParser->replayReset(pMainKeys->pKeyParser);

	return status;
}
Example #9
0
/****************************************************************************
 *                      elpCtrl_wakeUpSeqSM()
 ****************************************************************************
 * DESCRIPTION: SM for handling Synch & Asynch wake up sequence.
 *              The flow of the SM is by that order:
 *              WRITE (wake up) -> READ (elp) -> if awake - exit. else WRITE (mux)
 *
 * OUTPUT:      
 * 
 * RETURNS: 
 ****************************************************************************/
static void elpCtrl_wakeUpSeqSM (TI_HANDLE hElpCtrl, UINT8 module_id, TI_STATUS status)
{
    elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
    
    /* Check if Arbiter announced that interrupt occurred (i.e. no need for wake up sequence) */
    if (pElpCtrl->bExitWakeUpSeq)
    {     
        /* Fw is up - we should imitate TXN_COMPLETE to announce that we are done */
        pElpCtrl->state = ELPS_AWAKE;
        /* set TXN_COMPLETE to ArbiterSM - Note: It could only happen in Asynch IF */
        pElpCtrl->fCb (pElpCtrl->hTNETWArb, DEFAULT_MODULE_ID, OK);
        return;
    }

    pElpCtrl->eReturnValue = OK;

    /*
     * This while loop will continue till the exit or when waiting for the CB due to
     * memory transfer operation pending for DMA to complete   
     */
    while (TNETWIF_PENDING != pElpCtrl->eReturnValue)
    {
        switch(pElpCtrl->state) 
        {
        case ELPS_ASLEEP:

            pElpCtrl->state = ELPS_WAKING_UP_WRITE;
            pElpCtrl->eReturnValue = TNETWIF_WriteELPOpt (pElpCtrl->hTNETWIF, 
                                                            ELPCTRL_WAKE_UP, 
                                                            DEFAULT_MODULE_ID,
                                                            elpCtrl_wakeUpSeqSM, 
                                                            hElpCtrl,
                                                            TRUE);
            break;

        
        case ELPS_WAKING_UP_WRITE:

            pElpCtrl->state = ELPS_WAKING_UP_READ;
            pElpCtrl->eReturnValue = TNETWIF_ReadELPOpt (pElpCtrl->hTNETWIF, 
                                                            (UINT8*)&pElpCtrl->uElpRegister, 
                                                            DEFAULT_MODULE_ID,
                                                            elpCtrl_wakeUpSeqSM,
                                                            hElpCtrl,
                                                            TRUE);
            break;

        case ELPS_WAKING_UP_READ:

            /* Check whether Muxing is needed */
            if (pElpCtrl->uElpRegister & ELPCTRL_WLAN_READY)
            {
                /* Fw is up, but no WLAN_READY interrupt will occur (since we disabled the mux) */
                pElpCtrl->state = ELPS_AWAKE;
                /* 
				 * set TXN_COMPLETE to ArbiterSM only if we are not working in synchronize IF 
				 *  In synch IF we set the TXN_COMPLETE at the end of this function
				 */
				if ( !pElpCtrl->bSynch)
				{
					pElpCtrl->fCb (pElpCtrl->hTNETWArb, DEFAULT_MODULE_ID, OK);
				}
            } 
            else /* Fw is asleep - Mux to WLAN_READY and let arbiter wait for interrupt */
            {
				pElpCtrl->state = ELPS_WAKING_UP_MUX;
                pElpCtrl->bMuxBackNeeded = TRUE;
#ifdef DM_USE_WORKQUEUE
                /* printk("TI: %s:\t%lu - start timeout 1000 ms\n", __FUNCTION__, jiffies); */
                os_timerStart (pElpCtrl->hOs, pElpCtrl->hTimer, ELPCTRL_TIMER_TIMEOUT * 10, FALSE);
#else
                os_timerStart (pElpCtrl->hOs, pElpCtrl->hTimer, ELPCTRL_TIMER_TIMEOUT, FALSE);
#endif
                /* 
                 * Mux to WLAN_READY and let the Arbiter wait for Txn complete 
                 */
                pElpCtrl->eReturnValue = TNETWIF_WriteELPOpt (pElpCtrl->hTNETWIF,  
                                        ELPCTRL_WAKE_UP_WLAN_READY, 
                                        DEFAULT_MODULE_ID,
                                        pElpCtrl->fCb, 
                                        pElpCtrl->hTNETWArb,
                                        TRUE);
				if(TNETWIF_PENDING == pElpCtrl->eReturnValue)
				{
                    /* If we are here then we are not using Synch IF */
					pElpCtrl->bSynch = FALSE;
				}

				/* The previous states was async and now it sync */
				if((TNETWIF_COMPLETE == pElpCtrl->eReturnValue) && (pElpCtrl->bSynch == FALSE))
				{
					   pElpCtrl->fCb (pElpCtrl->hTNETWArb, DEFAULT_MODULE_ID, OK);
				}
             }
    
             return;

        default:
            
            WLAN_OS_REPORT(("Error: %s state = %d\n", __FUNCTION__, pElpCtrl->state));
            
        }
    }
	/* If we are here then we are not using Synch IF */
	pElpCtrl->bSynch = FALSE;
}