Prechádzať zdrojové kódy

qcacld-3.0: Add changes to handle SAE status

After SAE auth completion, supplicant informs status to driver.
Add changes to handle SAE status that comes through vendor
command QCA_NL80211_VENDOR_SUBCMD_EXTERNAL_AUTH using attribute
QCA_ATTR_EXTERNAL_AUTH_STATUS.

Change-Id: I474cfe9ea049e684837133479f8b6697fef1f189
CRs-Fixed: 2029357
Padma, Santhosh Kumar 7 rokov pred
rodič
commit
dd3f48598d

+ 15 - 0
core/mac/inc/sir_api.h

@@ -7714,4 +7714,19 @@ struct sir_sae_info {
 	struct qdf_mac_addr peer_mac_addr;
 	tSirMacSSid ssid;
 };
+
+/**
+ * struct sir_sae_msg - SAE msg used for message posting
+ * @message_type: message type
+ * @length: message length
+ * @session_id: SME session id
+ * @sae_status: SAE status, 0: Success, Non-zero: Failure.
+ */
+struct sir_sae_msg {
+	uint16_t message_type;
+	uint16_t length;
+	uint16_t session_id;
+	uint8_t sae_status;
+};
+
 #endif /* __SIR_API_H */

+ 1 - 0
core/mac/inc/wni_api.h

@@ -248,6 +248,7 @@ enum eWniMsgTypes {
 	eWNI_SME_SET_HE_BSS_COLOR,
 	eWNI_SME_TRIGGER_SAE,
 	eWNI_SME_SEND_MGMT_FRAME_TX,
+	eWNI_SME_SEND_SAE_MSG,
 	eWNI_SME_MSG_TYPES_END
 };
 

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

@@ -65,11 +65,78 @@
 #include "wlan_policy_mgr_api.h"
 #include "nan_datapath.h"
 #include "wlan_reg_services_api.h"
+#include "lim_security_utils.h"
+#include "cds_ieee80211_common.h"
 
 void lim_log_session_states(tpAniSirGlobal pMac);
 static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx,
 	struct scheduler_msg *msg, uint8_t rsp_reqd);
 
+#ifdef WLAN_FEATURE_SAE
+/**
+ * lim_process_sae_msg() - Process SAE message
+ * @mac: Global MAC pointer
+ * @body: Buffer pointer
+ *
+ * Return: None
+ */
+static void lim_process_sae_msg(tpAniSirGlobal mac, struct sir_sae_msg *body)
+{
+	struct sir_sae_msg *sae_msg = body;
+	tpPESession session;
+
+	if (!sae_msg) {
+		pe_err("SAE msg is NULL");
+		return;
+	}
+
+	session = pe_find_session_by_sme_session_id(mac,
+				sae_msg->session_id);
+	if (session == NULL) {
+		pe_err("SAE:Unable to find session");
+		return;
+	}
+
+	if (session->pePersona != QDF_STA_MODE) {
+		pe_err("SAE:Not supported in this mode %d",
+				session->pePersona);
+		return;
+	}
+
+	pe_debug("SAE:status %d limMlmState %d pePersona %d",
+		sae_msg->sae_status, session->limMlmState,
+		session->pePersona);
+	switch (session->limMlmState) {
+	case eLIM_MLM_WT_SAE_AUTH_STATE:
+		/* SAE authentication is completed. Restore from auth state */
+		if (tx_timer_running(&mac->lim.limTimers.sae_auth_timer))
+			lim_deactivate_and_change_timer(mac,
+				eLIM_AUTH_SAE_TIMER);
+		/* success */
+		if (sae_msg->sae_status == IEEE80211_STATUS_SUCCESS)
+			lim_restore_from_auth_state(mac,
+				eSIR_SME_SUCCESS,
+				eSIR_MAC_SUCCESS_STATUS,
+				session);
+		else
+			lim_restore_from_auth_state(mac,
+				eSIR_SME_AUTH_REFUSED,
+				eSIR_MAC_UNSPEC_FAILURE_STATUS,
+				session);
+		break;
+	default:
+		/* SAE msg is received in unexpected state */
+		pe_err("received SAE msg in state %X",
+			session->limMlmState);
+		lim_print_mlm_state(mac, LOGE, session->limMlmState);
+		break;
+	}
+}
+#else
+static inline void lim_process_sae_msg(tpAniSirGlobal mac, void *body)
+{}
+#endif
+
 /**
  * lim_process_dual_mac_cfg_resp() - Process set dual mac config response
  * @mac: Global MAC pointer
@@ -1911,6 +1978,11 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx,
 		qdf_mem_free(msg->bodyptr);
 		msg->bodyptr = NULL;
 		break;
+	case eWNI_SME_SEND_SAE_MSG:
+		lim_process_sae_msg(mac_ctx, msg->bodyptr);
+		qdf_mem_free((void *)msg->bodyptr);
+		msg->bodyptr = NULL;
+		break;
 	default:
 		qdf_mem_free((void *)msg->bodyptr);
 		msg->bodyptr = NULL;

+ 9 - 3
core/mac/src/pe/lim/lim_security_utils.c

@@ -472,11 +472,17 @@ lim_restore_from_auth_state(tpAniSirGlobal pMac, tSirResultCodes resultCode,
 	 * retry is needed also cancel the auth rety timer
 	 */
 	pMac->auth_ack_status = LIM_AUTH_ACK_RCD_SUCCESS;
-	/* 'Change' timer for future activations */
-	lim_deactivate_and_change_timer(pMac, eLIM_AUTH_RETRY_TIMER);
 
+	/* Auth retry and AUth failure timers are not started for SAE */
+	/* 'Change' timer for future activations */
+	if (tx_timer_running(&pMac->lim.limTimers.
+	    g_lim_periodic_auth_retry_timer))
+		lim_deactivate_and_change_timer(pMac,
+				eLIM_AUTH_RETRY_TIMER);
 	/* 'Change' timer for future activations */
-	lim_deactivate_and_change_timer(pMac, eLIM_AUTH_FAIL_TIMER);
+	if (tx_timer_running(&pMac->lim.limTimers.gLimAuthFailureTimer))
+		lim_deactivate_and_change_timer(pMac,
+				eLIM_AUTH_FAIL_TIMER);
 
 	sir_copy_mac_addr(currentBssId, sessionEntry->bssId);
 

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

@@ -403,6 +403,7 @@ uint8_t *mac_trace_get_sme_msg_string(uint16_t sme_msg)
 		CASE_RETURN_STRING(eWNI_SME_RSO_CMD_STATUS_IND);
 		CASE_RETURN_STRING(eWNI_SME_TRIGGER_SAE);
 		CASE_RETURN_STRING(eWNI_SME_SEND_MGMT_FRAME_TX);
+		CASE_RETURN_STRING(eWNI_SME_SEND_SAE_MSG);
 		CASE_RETURN_STRING(eWNI_SME_MSG_TYPES_END);
 	default:
 		return (uint8_t *) "UNKNOWN";

+ 20 - 0
core/sme/inc/sme_api.h

@@ -2039,4 +2039,24 @@ void sme_enable_roaming_on_connected_sta(tHalHandle hal);
  */
 QDF_STATUS sme_send_mgmt_tx(tHalHandle hal, uint8_t session_id,
 			   const uint8_t *buf, uint32_t len);
+
+#ifdef WLAN_FEATURE_SAE
+/**
+ * sme_handle_sae_msg() - Sends SAE message received from supplicant
+ * @hal: The handle returned by mac_open
+ * @session_id: session id
+ * @sae_status: status of SAE authentication
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS sme_handle_sae_msg(tHalHandle hal, uint8_t session_id,
+		uint8_t sae_status);
+#else
+static inline QDF_STATUS sme_handle_sae_msg(tHalHandle hal, uint8_t session_id,
+		uint8_t sae_status)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 #endif /* #if !defined( __SME_API_H ) */

+ 36 - 0
core/sme/src/common/sme_api.c

@@ -16021,3 +16021,39 @@ int sme_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
 	return 0;
 }
 
+#ifdef WLAN_FEATURE_SAE
+QDF_STATUS sme_handle_sae_msg(tHalHandle hal, uint8_t session_id,
+		uint8_t sae_status)
+{
+	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
+	tpAniSirGlobal mac = PMAC_STRUCT(hal);
+	struct sir_sae_msg *sae_msg;
+	struct scheduler_msg sch_msg = {0};
+
+	qdf_status = sme_acquire_global_lock(&mac->sme);
+	if (QDF_IS_STATUS_SUCCESS(qdf_status)) {
+		sae_msg = qdf_mem_malloc(sizeof(*sae_msg));
+		if (!sae_msg) {
+			qdf_status = QDF_STATUS_E_NOMEM;
+			sme_err("SAE: memory allocation failed");
+		} else {
+			sae_msg->message_type = eWNI_SME_SEND_SAE_MSG;
+			sae_msg->length = sizeof(*sae_msg);
+			sae_msg->session_id = session_id;
+			sae_msg->sae_status = sae_status;
+			sme_debug("SAE: sae_status %d session_id %d",
+				sae_msg->sae_status,
+				sae_msg->session_id);
+
+			sch_msg.type = eWNI_SME_SEND_SAE_MSG;
+			sch_msg.bodyptr = sae_msg;
+
+			qdf_status =
+				scheduler_post_msg(QDF_MODULE_ID_PE, &sch_msg);
+		}
+		sme_release_global_lock(&mac->sme);
+	}
+
+	return qdf_status;
+}
+#endif