Procházet zdrojové kódy

qcacld-3.0: Add SAE auth timer

Add changes related to SAE auth timer to handle SAE authentication.
Start SAE auth timer of duration LIM_AUTH_SAE_TIMER_MS when driver
wants to trigger SAE authentication. If SAE authentication is not
completed in LIM_AUTH_SAE_TIMER_MS, then report failure to
supplicant.

Change-Id: I65f0cb01faa1194c133013eaea4a5d8554a045d2
CRs-Fixed: 2029357
Padma, Santhosh Kumar před 7 roky
rodič
revize
c56735fe68

+ 3 - 0
core/mac/inc/ani_global.h

@@ -329,6 +329,9 @@ typedef struct sLimTimers {
 	TX_TIMER gLimActiveToPassiveChannelTimer;
 	TX_TIMER g_lim_periodic_auth_retry_timer;
 
+	/* SAE authentication related timer */
+	TX_TIMER sae_auth_timer;
+
 /* ********************TIMER SECTION ENDS************************************************** */
 /* ALL THE FIELDS BELOW THIS CAN BE ZEROED OUT in lim_initialize */
 /* **************************************************************************************** */

+ 2 - 0
core/mac/src/include/sir_params.h

@@ -774,6 +774,8 @@ struct sir_mgmt_msg {
 					 (SIR_LIM_TIMEOUT_MSG_START + 0x2C)
 #define SIR_LIM_AUTH_RETRY_TIMEOUT     (SIR_LIM_TIMEOUT_MSG_START + 0x2D)
 
+#define SIR_LIM_AUTH_SAE_TIMEOUT     (SIR_LIM_TIMEOUT_MSG_START + 0x2E)
+
 #define SIR_LIM_MSG_TYPES_END            (SIR_LIM_MSG_TYPES_BEGIN+0xFF)
 
 /* PMM message types */

+ 1 - 0
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -1628,6 +1628,7 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx,
 	case SIR_LIM_DEAUTH_ACK_TIMEOUT:
 	case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
 	case SIR_LIM_AUTH_RETRY_TIMEOUT:
+	case SIR_LIM_AUTH_SAE_TIMEOUT:
 		/* These timeout messages are handled by MLM sub module */
 		lim_process_mlm_req_messages(mac_ctx, msg);
 		break;

+ 56 - 0
core/mac/src/pe/lim/lim_process_mlm_req_messages.c

@@ -63,6 +63,48 @@ static void lim_process_auth_rsp_timeout(tpAniSirGlobal, uint32_t);
 static void lim_process_periodic_join_probe_req_timer(tpAniSirGlobal);
 static void lim_process_auth_retry_timer(tpAniSirGlobal);
 
+/**
+ * lim_process_sae_auth_timeout() - This function is called to process sae
+ * auth timeout
+ * @mac_ctx: Pointer to Global MAC structure
+ *
+ * @Return: None
+ */
+static void lim_process_sae_auth_timeout(tpAniSirGlobal mac_ctx)
+{
+	tpPESession session;
+
+	session = pe_find_session_by_session_id(mac_ctx,
+			mac_ctx->lim.limTimers.sae_auth_timer.sessionId);
+	if (session == NULL) {
+		pe_err("Session does not exist for given session id");
+		return;
+	}
+
+	pe_warn("SAE auth timeout sessionid %d mlmstate %X SmeState %X",
+		session->peSessionId, session->limMlmState,
+		session->limSmeState);
+
+	switch (session->limMlmState) {
+	case eLIM_MLM_WT_SAE_AUTH_STATE:
+		/*
+		 * SAE authentication is not completed. Restore from
+		 * auth state.
+		 */
+		if (session->pePersona == QDF_STA_MODE)
+			lim_restore_from_auth_state(mac_ctx,
+				eSIR_SME_AUTH_TIMEOUT_RESULT_CODE,
+				eSIR_MAC_UNSPEC_FAILURE_REASON, session);
+		break;
+	default:
+		/* SAE authentication is timed out in unexpected state */
+		pe_err("received unexpected SAE auth timeout in state %X",
+			session->limMlmState);
+		lim_print_mlm_state(mac_ctx, LOGE, session->limMlmState);
+		break;
+	}
+}
+
 /**
  * lim_process_mlm_req_messages() - process mlm request messages
  * @mac_ctx: global MAC context
@@ -145,6 +187,9 @@ void lim_process_mlm_req_messages(tpAniSirGlobal mac_ctx,
 	case SIR_LIM_AUTH_RETRY_TIMEOUT:
 		lim_process_auth_retry_timer(mac_ctx);
 		break;
+	case SIR_LIM_AUTH_SAE_TIMEOUT:
+		lim_process_sae_auth_timeout(mac_ctx);
+		break;
 	case LIM_MLM_TSPEC_REQ:
 	default:
 		break;
@@ -1073,6 +1118,17 @@ static QDF_STATUS lim_process_mlm_auth_req_sae(tpAniSirGlobal mac_ctx,
 	MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, session->peSessionId,
 		       session->limMlmState));
 
+	mac_ctx->lim.limTimers.sae_auth_timer.sessionId =
+					session->peSessionId;
+
+	/* Activate SAE auth timer */
+	MTRACE(mac_trace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE,
+			 session->peSessionId, eLIM_AUTH_SAE_TIMER));
+	if (tx_timer_activate(&mac_ctx->lim.limTimers.sae_auth_timer)
+		    != TX_SUCCESS) {
+		pe_err("could not start Auth SAE timer");
+	}
+
 	return qdf_status;
 }
 #else

+ 37 - 1
core/mac/src/pe/lim/lim_timer_utils.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -54,6 +54,12 @@
 /* Lim Periodic Auth Retry timer default 60 ms */
 #define LIM_AUTH_RETRY_TIMER_MS   60
 
+/*
+ * SAE auth timer of 5secs. This is required for duration of entire SAE
+ * authentication.
+ */
+#define LIM_AUTH_SAE_TIMER_MS 5000
+
 
 /* This timer is a periodic timer which expires at every 1 sec to
    convert  ACTIVE DFS channel to DFS channels */
@@ -193,6 +199,20 @@ static bool lim_create_non_ap_timers(tpAniSirGlobal pMac)
 		return false;
 	}
 
+	/*
+	 * SAE auth timer of 5secs. This is required for duration of entire SAE
+	 * authentication.
+	 */
+	if ((tx_timer_create(pMac,
+		&pMac->lim.limTimers.sae_auth_timer,
+		"SAE AUTH Timer",
+		lim_timer_handler, SIR_LIM_AUTH_SAE_TIMEOUT,
+		SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS), 0,
+		TX_NO_ACTIVATE)) != TX_SUCCESS) {
+		pe_err("could not create SAE AUTH Timer");
+		return false;
+	}
+
 	return true;
 }
 /**
@@ -379,6 +399,7 @@ err_timer:
 	tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
 	tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
 	tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
+	tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);
 
 	if (NULL != pMac->lim.gLimPreAuthTimerTable.pTable) {
 		for (i = 0; i < pMac->lim.gLimPreAuthTimerTable.numEntry; i++)
@@ -924,6 +945,21 @@ void lim_deactivate_and_change_timer(tpAniSirGlobal pMac, uint32_t timerId)
 		}
 		break;
 
+	case eLIM_AUTH_SAE_TIMER:
+		if (tx_timer_deactivate
+		   (&pMac->lim.limTimers.sae_auth_timer)
+		    != TX_SUCCESS)
+			pe_err("Unable to deactivate SAE auth timer");
+
+		/* Change timer to reactivate it in future */
+		val = SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS);
+
+		if (tx_timer_change(&pMac->lim.limTimers.sae_auth_timer,
+				    val, 0) != TX_SUCCESS)
+			pe_err("unable to change SAE auth timer");
+
+		break;
+
 	default:
 		/* Invalid timerId. Log error */
 		break;

+ 3 - 2
core/mac/src/pe/lim/lim_timer_utils.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014, 2016-2018 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -68,7 +68,8 @@ enum {
 	eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER,
 	eLIM_INSERT_SINGLESHOT_NOA_TIMER,
 	eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE,
-	eLIM_AUTH_RETRY_TIMER
+	eLIM_AUTH_RETRY_TIMER,
+	eLIM_AUTH_SAE_TIMER
 };
 
 #define LIM_DISASSOC_DEAUTH_ACK_TIMEOUT         500

+ 4 - 0
core/mac/src/pe/lim/lim_utils.c

@@ -622,6 +622,8 @@ void lim_deactivate_timers(tpAniSirGlobal mac_ctx)
 
 	tx_timer_deactivate(&lim_timer->
 			gLimActiveToPassiveChannelTimer);
+
+	tx_timer_deactivate(&lim_timer->sae_auth_timer);
 }
 
 
@@ -705,6 +707,8 @@ void lim_cleanup_mlm(tpAniSirGlobal mac_ctx)
 		tx_timer_delete(&lim_timer->
 				gLimActiveToPassiveChannelTimer);
 
+		tx_timer_delete(&lim_timer->sae_auth_timer);
+
 		mac_ctx->lim.gLimTimersCreated = 0;
 	}
 } /*** end lim_cleanup_mlm() ***/

+ 1 - 0
core/mac/src/sys/legacy/src/utils/src/mac_trace.c

@@ -738,6 +738,7 @@ uint8_t *mac_trace_get_lim_msg_string(uint16_t lim_msg)
 		CASE_RETURN_STRING(SIR_LIM_DEAUTH_ACK_TIMEOUT);
 		CASE_RETURN_STRING(SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT);
 		CASE_RETURN_STRING(SIR_LIM_AUTH_RETRY_TIMEOUT);
+		CASE_RETURN_STRING(SIR_LIM_AUTH_SAE_TIMEOUT);
 		CASE_RETURN_STRING(SIR_LIM_MSG_TYPES_END);
 		CASE_RETURN_STRING(LIM_MLM_SCAN_REQ);
 		CASE_RETURN_STRING(LIM_MLM_SCAN_CNF);