Ver Fonte

qcacld-3.0: Add delay in sending open system auth frame

On receiving auth resp with algo not supported status
code, open system auth is sent to firmware. There is
a possibility that AP does not receive ack sent by DUT
and retries auth frame. The retry frame could be received
at host after open sys auth req is sent to firmware
resulting in auth failure.

Fix is to send open system auth frame after timer of
15msec expires.

Change-Id: I6bc7097ec7568fc65a379c7c31c96d5874f1e216
CRs-Fixed: 2075272
yeshwanth sriram guntuka há 7 anos atrás
pai
commit
0dcbcab7ca

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

@@ -331,6 +331,11 @@ typedef struct sLimTimers {
 	 */
 	TX_TIMER gLimActiveToPassiveChannelTimer;
 	TX_TIMER g_lim_periodic_auth_retry_timer;
+	/*
+	 * This timer is used for delay between shared auth failure and
+	 * open auth start
+	 */
+	TX_TIMER open_sys_auth_timer;
 
 /* ********************TIMER SECTION ENDS************************************************** */
 /* ALL THE FIELDS BELOW THIS CAN BE ZEROED OUT in lim_initialize */

+ 11 - 28
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -474,8 +474,7 @@ void lim_pmf_comeback_timer_callback(void *context)
  */
 void lim_process_mlm_auth_cnf(tpAniSirGlobal mac_ctx, uint32_t *msg)
 {
-	tAniAuthType auth_type, auth_mode;
-	tLimMlmAuthReq *auth_req;
+	tAniAuthType auth_type;
 	tLimMlmAuthCnf *auth_cnf;
 	tpPESession session_entry;
 
@@ -545,34 +544,18 @@ void lim_process_mlm_auth_cnf(tpAniSirGlobal mac_ctx, uint32_t *msg)
 		 * When shared authentication fails with reason
 		 * code "13" and authType set to 'auto switch',
 		 * Try with open Authentication
+		 * There is a possibility that AP does not receive
+		 * ack and retries auth frame. The retry frame could be
+		 * received at host after open sys auth is sent to firmware
+		 * resulting in auth failure. So, to fix this issue, open system
+		 * auth frame is sent to firmware after timer of 15msec expires.
 		 */
-		auth_mode = eSIR_OPEN_SYSTEM;
-		/* Trigger MAC based Authentication */
-		auth_req = qdf_mem_malloc(sizeof(tLimMlmAuthReq));
-		if (NULL == auth_req) {
-			pe_err("mlmAuthReq :Memory alloc failed");
-			return;
-		}
-		if (session_entry->limSmeState ==
-			eLIM_SME_WT_AUTH_STATE) {
-			sir_copy_mac_addr(auth_req->peerMacAddr,
-				session_entry->bssId);
-		} else {
-			qdf_mem_copy((uint8_t *)&auth_req->peerMacAddr,
-			(uint8_t *)&mac_ctx->lim.gLimPreAuthPeerAddr,
-			sizeof(tSirMacAddr));
+		mac_ctx->lim.limTimers.open_sys_auth_timer.sessionId =
+							    auth_cnf->sessionId;
+		if (tx_timer_activate(&mac_ctx->lim.limTimers.
+				      open_sys_auth_timer) != TX_SUCCESS) {
+			pe_err("failed to activate system Auth timer");
 		}
-		auth_req->authType = auth_mode;
-		/* Update PE session Id */
-		auth_req->sessionId = auth_cnf->sessionId;
-		if (wlan_cfg_get_int(mac_ctx,
-			WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
-			(uint32_t *) &auth_req->authFailureTimeout)
-			!= eSIR_SUCCESS) {
-			pe_err("Fail:retrieve AuthFailureTimeout");
-		}
-		lim_post_mlm_message(mac_ctx, LIM_MLM_AUTH_REQ,
-			(uint32_t *) auth_req);
 		return;
 	} else {
 		/* MAC based authentication failure */

+ 8 - 0
core/mac/src/pe/lim/lim_timer_utils.c

@@ -133,6 +133,13 @@ static bool lim_create_non_ap_timers(tpAniSirGlobal pMac)
 		return false;
 	}
 
+	if (tx_timer_create(pMac, &pMac->lim.limTimers.open_sys_auth_timer,
+			"open system Auth timer", lim_send_open_system_auth, 0,
+			SYS_MS_TO_TICKS(15), 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
+		pe_err("failed to create open system Auth timer");
+		return false;
+	}
+
 	if (wlan_cfg_get_int(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
 			     &cfgValue) != eSIR_SUCCESS)
 		pe_err("could not retrieve AssocFailureTimeout value");
@@ -380,6 +387,7 @@ err_timer:
 	tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
 	tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
 	tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
+	tx_timer_delete(&pMac->lim.limTimers.open_sys_auth_timer);
 	tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
 	tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
 	tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);

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

@@ -515,6 +515,43 @@ void lim_print_msg_name(tpAniSirGlobal pMac, uint16_t logLevel, uint32_t msgType
 	pe_debug("Msg: %s", lim_msg_str(msgType));
 }
 
+void lim_send_open_system_auth(void *ctx, uint32_t param)
+{
+	tLimMlmAuthReq *auth_req;
+	tpPESession session_entry;
+	tpAniSirGlobal mac_ctx = (tpAniSirGlobal)ctx;
+	uint8_t session_id;
+
+	session_id = mac_ctx->lim.limTimers.open_sys_auth_timer.sessionId;
+	session_entry = pe_find_session_by_session_id(mac_ctx, session_id);
+
+	if (!session_entry)
+		return;
+	/* Trigger MAC based Authentication */
+	auth_req = qdf_mem_malloc(sizeof(tLimMlmAuthReq));
+	if (!auth_req) {
+		pe_err("mlmAuthReq :Memory alloc failed");
+		lim_handle_sme_join_result(mac_ctx,
+					eSIR_SME_AUTH_TIMEOUT_RESULT_CODE,
+					eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS,
+					session_entry);
+		tx_timer_deactivate(&mac_ctx->lim.limTimers.
+				    open_sys_auth_timer);
+		return;
+	}
+	sir_copy_mac_addr(auth_req->peerMacAddr, session_entry->bssId);
+	auth_req->authType = eSIR_OPEN_SYSTEM;
+	/* Update PE session Id */
+	auth_req->sessionId = session_id;
+	if (wlan_cfg_get_int(mac_ctx, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
+	    (uint32_t *) &auth_req->authFailureTimeout) != eSIR_SUCCESS) {
+		pe_err("Fail:retrieve AuthFailureTimeout");
+	}
+	lim_post_mlm_message(mac_ctx, LIM_MLM_AUTH_REQ, (uint32_t *) auth_req);
+	tx_timer_deactivate(&mac_ctx->lim.limTimers.open_sys_auth_timer);
+
+}
+
 /**
  * lim_init_mlm() -  This function is called by limProcessSmeMessages() to
  * initialize MLM state machine on STA
@@ -634,6 +671,10 @@ void lim_cleanup_mlm(tpAniSirGlobal mac_ctx)
 		tx_timer_deactivate(&lim_timer->gLimAssocFailureTimer);
 		tx_timer_delete(&lim_timer->gLimAssocFailureTimer);
 
+		/* Deactivate and delete Open system auth timer. */
+		tx_timer_deactivate(&lim_timer->open_sys_auth_timer);
+		tx_timer_delete(&lim_timer->open_sys_auth_timer);
+
 		/* Deactivate and delete Authentication failure timer. */
 		tx_timer_deactivate(&lim_timer->gLimAuthFailureTimer);
 		tx_timer_delete(&lim_timer->gLimAuthFailureTimer);

+ 12 - 0
core/mac/src/pe/lim/lim_utils.h

@@ -104,6 +104,18 @@ void lim_print_sme_state(tpAniSirGlobal pMac, uint16_t logLevel,
 		tLimSmeStates state);
 void lim_print_msg_name(tpAniSirGlobal pMac, uint16_t logLevel, uint32_t msgType);
 
+/**
+ * lim_send_open_system_auth() - api to send open system auth frame
+ * @ctx: Pointer to global mac structure
+ * @session_id: session id
+ *
+ * This function is used to send open system auth when
+ * shared auth fails with reason-algo not supported
+ *
+ * Return: None
+ */
+void lim_send_open_system_auth(void *ctx, uint32_t param);
+
 extern tSirRetStatus lim_send_set_max_tx_power_req(tpAniSirGlobal pMac,
 		int8_t txPower,
 		tpPESession pSessionEntry);