diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 20842e888fd9..6710ec0d1095 100644 --- a/core/mac/inc/sir_api.h +++ b/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 */ diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h index d7374de57139..1f3fdc05ba47 100644 --- a/core/mac/inc/wni_api.h +++ b/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 }; diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index c1e5335d229b..230d7e14038e 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/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; diff --git a/core/mac/src/pe/lim/lim_security_utils.c b/core/mac/src/pe/lim/lim_security_utils.c index 7f61233d30d7..f082c31a9e4c 100644 --- a/core/mac/src/pe/lim/lim_security_utils.c +++ b/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 */ - lim_deactivate_and_change_timer(pMac, eLIM_AUTH_FAIL_TIMER); + 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 */ + 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); diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c index e730949bdb64..796dced12dae 100644 --- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c +++ b/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"; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 29d7a58108c2..d538c2ae594a 100644 --- a/core/sme/inc/sme_api.h +++ b/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 ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 927995627701..b90d3ad1dfde 100644 --- a/core/sme/src/common/sme_api.c +++ b/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