Merge changes I474cfe9e,I09bc0e36 into wlan-driver.lnx.1.0
* changes:
wlan: Add changes to handle SAE status
wlan: Add SAE auth timer
diff --git a/CORE/MAC/inc/aniGlobal.h b/CORE/MAC/inc/aniGlobal.h
index db919d5..8715388 100644
--- a/CORE/MAC/inc/aniGlobal.h
+++ b/CORE/MAC/inc/aniGlobal.h
@@ -244,6 +244,8 @@
*/
TX_TIMER gLimActiveToPassiveChannelTimer;
TX_TIMER g_lim_ap_ecsa_timer;
+ /* SAE authentication related timer */
+ TX_TIMER sae_auth_timer;
//********************TIMER SECTION ENDS**************************************************
// ALL THE FIELDS BELOW THIS CAN BE ZEROED OUT in limInitialize
//****************************************************************************************
diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h
index fd1fc1e..4d51fdb 100644
--- a/CORE/MAC/inc/sirApi.h
+++ b/CORE/MAC/inc/sirApi.h
@@ -6465,4 +6465,17 @@
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/wniApi.h b/CORE/MAC/inc/wniApi.h
index 9408712..67839eb 100644
--- a/CORE/MAC/inc/wniApi.h
+++ b/CORE/MAC/inc/wniApi.h
@@ -403,6 +403,7 @@
eWNI_SME_STA_DEL_BA_REQ,
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/include/sirParams.h b/CORE/MAC/src/include/sirParams.h
index 4057e37..552cdd7 100644
--- a/CORE/MAC/src/include/sirParams.h
+++ b/CORE/MAC/src/include/sirParams.h
@@ -927,6 +927,7 @@
#define SIR_LIM_REASSOC_MBB_RSP_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x2A)
#endif
+#define SIR_LIM_AUTH_SAE_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x2B)
#define SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE (SIR_LIM_TIMEOUT_MSG_START + 0x2C)
#define SIR_LIM_AUTH_RETRY_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x2D)
#define SIR_LIM_SAP_ECSA_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x2E)
diff --git a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
index 6659903..eb2c931 100644
--- a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
+++ b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
@@ -82,6 +82,7 @@
#include "vos_types.h"
#include "vos_packet.h"
#include "vos_memory.h"
+#include "limSecurityUtils.h"
/* This value corresponds to 500 ms */
#define MAX_PROBEREQ_TIME 50
@@ -92,8 +93,69 @@
#define CHECK_BIT(value, mask) ((value) & (1 << (mask)))
+#define IEEE80211_STATUS_SUCCESS 0
+
void limLogSessionStates(tpAniSirGlobal pMac);
+#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) {
+ limLog(mac, LOGE, FL("SAE msg is NULL"));
+ return;
+ }
+
+ session = pe_find_session_by_sme_session_id(mac, sae_msg->session_id);
+ if (session == NULL) {
+ limLog(mac, LOGE, FL("SAE:Unable to find session"));
+ return;
+ }
+
+ if (session->pePersona != VOS_STA_MODE) {
+ limLog(mac, LOGE, FL("SAE:Not supported in this mode %d"),
+ session->pePersona);
+ return;
+ }
+
+ limLog(mac, LOG1, FL("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))
+ limDeactivateAndChangeTimer(mac, eLIM_AUTH_SAE_TIMER);
+ /* success */
+ if (sae_msg->sae_status == IEEE80211_STATUS_SUCCESS)
+ limRestoreFromAuthState(mac, eSIR_SME_SUCCESS,
+ eSIR_MAC_SUCCESS_STATUS, session);
+ else
+ limRestoreFromAuthState(mac, eSIR_SME_AUTH_REFUSED,
+ eSIR_MAC_UNSPEC_FAILURE_STATUS, session);
+ break;
+ default:
+ /* SAE msg is received in unexpected state */
+ limLog(mac, LOGE, FL("received SAE msg in state %X"),
+ session->limMlmState);
+ limPrintMlmState(mac, LOGE, session->limMlmState);
+ break;
+ }
+}
+#else
+static void lim_process_sae_msg(tpAniSirGlobal mac, struct sir_sae_msg *body)
+{}
+#endif
+
/** -------------------------------------------------------------
\fn defMsgDecision
\brief The function decides whether to defer a message or not in limProcessMessage function
@@ -2028,6 +2090,7 @@
#ifdef WLAN_FEATURE_LFR_MBB
case SIR_LIM_PREAUTH_MBB_RSP_TIMEOUT:
case SIR_LIM_REASSOC_MBB_RSP_TIMEOUT:
+ case SIR_LIM_AUTH_SAE_TIMEOUT:
#endif
// These timeout messages are handled by MLM sub module
@@ -2559,6 +2622,11 @@
case eWNI_SME_STA_DEL_BA_REQ:
limStaDelBASession(pMac);
break;
+ case eWNI_SME_SEND_SAE_MSG:
+ lim_process_sae_msg(pMac, limMsg->bodyptr);
+ vos_mem_free((v_VOID_t*)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ break;
default:
vos_mem_free((v_VOID_t*)limMsg->bodyptr);
limMsg->bodyptr = NULL;
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
index a8a4fd9..91615de 100644
--- a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
@@ -100,6 +100,49 @@
#define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_AGGRESSIVE_BACKGROUND_SCAN)
#define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac) (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_NORMAL_BACKGROUND_SCAN)
+ /**
+ * 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 = peFindSessionBySessionId(mac_ctx,
+ mac_ctx->lim.limTimers.sae_auth_timer.sessionId);
+ if (session == NULL) {
+ limLog(mac_ctx, LOGE,
+ FL("Session does not exist for given session id"));
+ return;
+ }
+
+ limLog(mac_ctx, LOG1,
+ FL("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 == VOS_STA_MODE)
+ limRestoreFromAuthState(mac_ctx, eSIR_SME_AUTH_TIMEOUT_RESULT_CODE,
+ eSIR_MAC_UNSPEC_FAILURE_REASON, session);
+ break;
+ default:
+ /* SAE authentication is timed out in unexpected state */
+ limLog(mac_ctx, LOGE,
+ FL("received unexpected SAE auth timeout in state %X"),
+ session->limMlmState);
+ limPrintMlmState(mac_ctx, LOGE, session->limMlmState);
+ break;
+ }
+}
+
/**
* limProcessMlmReqMessages()
*
@@ -180,6 +223,9 @@
case LIM_MLM_ADDBA_REQ: limProcessMlmAddBAReq( pMac, Msg->bodyptr ); break;
case LIM_MLM_ADDBA_RSP: limProcessMlmAddBARsp( pMac, Msg->bodyptr ); break;
case LIM_MLM_DELBA_REQ: limProcessMlmDelBAReq( pMac, Msg->bodyptr ); break;
+ case SIR_LIM_AUTH_SAE_TIMEOUT:
+ lim_process_sae_auth_timeout(pMac);
+ break;
case LIM_MLM_TSPEC_REQ:
default:
break;
@@ -2506,7 +2552,7 @@
if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
{
- limLog(mac_ctx, LOGE, "%s failed to post msg to self ",
+ limLog(mac_ctx, LOGE, FL("%s failed to post msg to self "),
__func__);
vos_mem_free((void *)sae_info);
status = VOS_STATUS_E_FAILURE;
@@ -2517,6 +2563,15 @@
MTRACE(macTrace(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(macTrace(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) {
+ limLog(mac_ctx, LOGE, FL("could not start Auth SAE timer"));
+ }
+
return status;
}
#else
diff --git a/CORE/MAC/src/pe/lim/limSecurityUtils.c b/CORE/MAC/src/pe/lim/limSecurityUtils.c
index bffffb0..e364e73 100644
--- a/CORE/MAC/src/pe/lim/limSecurityUtils.c
+++ b/CORE/MAC/src/pe/lim/limSecurityUtils.c
@@ -518,10 +518,14 @@
* retry is needed also cancel the auth rety timer
*/
pMac->authAckStatus = LIM_AUTH_ACK_RCD_SUCCESS;
- // 'Change' timer for future activations
- limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER);
- // 'Change' timer for future activations
- limDeactivateAndChangeTimer(pMac, eLIM_AUTH_FAIL_TIMER);
+ /* Auth retry and AUth failure timers are not started for SAE
+ * Change' timer for future activations
+ */
+ if (tx_timer_running(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer))
+ limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER);
+ /* Change' timer for future activations */
+ if (tx_timer_running(&pMac->lim.limTimers.gLimAuthFailureTimer))
+ limDeactivateAndChangeTimer(pMac, eLIM_AUTH_FAIL_TIMER);
#if 0
if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != eSIR_SUCCESS)
diff --git a/CORE/MAC/src/pe/lim/limTimerUtils.c b/CORE/MAC/src/pe/lim/limTimerUtils.c
index 5a5163a..f5bb4d3 100644
--- a/CORE/MAC/src/pe/lim/limTimerUtils.c
+++ b/CORE/MAC/src/pe/lim/limTimerUtils.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017, 2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -56,6 +56,11 @@
#define LIM_JOIN_PROBE_REQ_TIMER_MS 200
#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
//default beacon interval value used in HB timer interval calculation
#define LIM_HB_TIMER_BEACON_INTERVAL 100
@@ -431,6 +436,18 @@
goto err_timer;
}
+ /*
+ * SAE auth timer of 5secs. This is required for duration of entire SAE
+ * authentication.
+ */
+ if ((tx_timer_create(&pMac->lim.limTimers.sae_auth_timer,
+ "SAE AUTH Timer", limTimerHandler, SIR_LIM_AUTH_SAE_TIMEOUT,
+ SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS), 0, TX_NO_ACTIVATE)) !=
+ TX_SUCCESS) {
+ limLog(pMac, LOGP, FL("could not create SAE AUTH Timer"));
+ goto err_timer;
+ }
+
if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
&cfgValue) != eSIR_SUCCESS)
{
@@ -784,6 +801,7 @@
tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
+ tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);
if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
{
@@ -1935,6 +1953,21 @@
limLog(pMac, LOGE, FL("Unable to change g_lim_ap_ecsa_timer timer"));
}
+ case eLIM_AUTH_SAE_TIMER:
+ if (tx_timer_deactivate(&pMac->lim.limTimers.sae_auth_timer)
+ != TX_SUCCESS) {
+ limLog(pMac, LOGP, FL("Unable to deactivate SAE auth timer"));
+ return;
+ }
+ /* 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) {
+ limLog(pMac, LOGP, FL("unable to change SAE auth timer"));
+ return;
+ }
+ break;
+
break;
default:
// Invalid timerId. Log error
diff --git a/CORE/MAC/src/pe/lim/limTimerUtils.h b/CORE/MAC/src/pe/lim/limTimerUtils.h
index 2b10fdc..eb4e284 100644
--- a/CORE/MAC/src/pe/lim/limTimerUtils.h
+++ b/CORE/MAC/src/pe/lim/limTimerUtils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2015, 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, 2017, 2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -81,7 +81,8 @@
eLIM_AP_ECSA_TIMER,
#ifdef WLAN_FEATURE_LFR_MBB
eLIM_PREAUTH_MBB_RSP_TIMER,
- eLIM_REASSOC_MBB_RSP_TIMER
+ eLIM_REASSOC_MBB_RSP_TIMER,
+ eLIM_AUTH_SAE_TIMER
#endif
};
diff --git a/CORE/MAC/src/pe/lim/limUtils.c b/CORE/MAC/src/pe/lim/limUtils.c
index e0f4560..a35cff5 100644
--- a/CORE/MAC/src/pe/lim/limUtils.c
+++ b/CORE/MAC/src/pe/lim/limUtils.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -1141,6 +1141,9 @@
tx_timer_deactivate(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
+ tx_timer_deactivate(&pMac->lim.limTimers.sae_auth_timer);
+ tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);
+
pMac->lim.gLimTimersCreated = 0;
}
diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h
index 1ed8abd..68b1e92 100644
--- a/CORE/SME/inc/sme_Api.h
+++ b/CORE/SME/inc/sme_Api.h
@@ -4127,4 +4127,23 @@
eHalStatus 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: HAL_STATUS
+ */
+eHalStatus sme_handle_sae_msg(tHalHandle hal, uint8_t session_id,
+ uint8_t sae_status);
+#else
+static inline eHalStatus sme_handle_sae_msg(tHalHandle hal, uint8_t session_id,
+ uint8_t sae_status)
+{
+ return eHAL_STATUS_SUCCESS;
+}
+#endif
+
#endif //#if !defined( __SME_API_H )
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index f7d81d4..142d289 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -15447,3 +15447,44 @@
return status;
}
+
+#ifdef WLAN_FEATURE_SAE
+eHalStatus sme_handle_sae_msg(tHalHandle hal, uint8_t session_id,
+ uint8_t sae_status)
+{
+ eHalStatus hal_status = eHAL_STATUS_SUCCESS;
+ tpAniSirGlobal mac = PMAC_STRUCT(hal);
+ struct sir_sae_msg *sae_msg;
+ vos_msg_t vos_message;
+ VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
+
+ hal_status = sme_AcquireGlobalLock(&mac->sme);
+ if (HAL_STATUS_SUCCESS(hal_status)) {
+ sae_msg = vos_mem_malloc(sizeof(*sae_msg));
+ if (!sae_msg) {
+ hal_status = eHAL_STATUS_FAILED_ALLOC;
+ VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+ "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;
+ vos_message.bodyptr = sae_msg;
+ vos_message.type = eWNI_SME_SEND_SAE_MSG;
+ VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
+ "SAE: sae_status %d session_id %d", sae_msg->sae_status,
+ sae_msg->session_id);
+
+ vos_status = vos_mq_post_message(VOS_MQ_ID_PE, &vos_message);
+ if (!VOS_IS_STATUS_SUCCESS(vos_status)) {
+ vos_mem_free(sae_msg);
+ hal_status = eHAL_STATUS_FAILURE;
+ }
+ }
+ sme_ReleaseGlobalLock(&mac->sme);
+}
+
+return hal_status;
+}
+#endif
diff --git a/CORE/SYS/legacy/src/utils/src/macTrace.c b/CORE/SYS/legacy/src/utils/src/macTrace.c
index 69b2a52..981dd2d 100644
--- a/CORE/SYS/legacy/src/utils/src/macTrace.c
+++ b/CORE/SYS/legacy/src/utils/src/macTrace.c
@@ -588,6 +588,7 @@
CASE_RETURN_STRING(eWNI_SME_ECSA_CHAN_CHANGE_RSP);
CASE_RETURN_STRING(eWNI_SME_TRIGGER_SAE);
CASE_RETURN_STRING(eWNI_SME_SEND_MGMT_FRAME_TX);
+ CASE_RETURN_STRING(eWNI_SME_SEND_SAE_MSG);
default:
return( (tANI_U8*)"UNKNOWN" );
break;
@@ -1001,6 +1002,7 @@
#endif
+ CASE_RETURN_STRING(SIR_LIM_AUTH_SAE_TIMEOUT);
CASE_RETURN_STRING(SIR_LIM_AUTH_RETRY_TIMEOUT);
CASE_RETURN_STRING(SIR_LIM_SAP_ECSA_TIMEOUT);