qcacld-3.0: Add preauth node when SAE auth frame is received

Add preauth node and mark state as eLIM_MLM_WT_SAE_AUTH_STATE
(waiting for SAE authentication) when SAE auth frame is received
from peer. State can be moved to authenticated when hostapd sends
SAE authentication status as success.

Change-Id: I7e1c326d54465d2bae86a9b0de5152196a9ce359
CRs-Fixed: 2396382
This commit is contained in:
Srinivas Dasari
2018-10-24 17:31:57 +05:30
committed by nshrivas
parent ea1c133d3f
commit 6e83e649b7

View File

@@ -277,6 +277,43 @@ static void lim_process_auth_open_system_algo(struct mac_context *mac_ctx,
}
#ifdef WLAN_FEATURE_SAE
/**
* lim_external_auth_add_pre_auth_node()- Add preauth node for the peer
* performing external authentication
* @mac_ctx: MAC context
* @mac_hdr: Mac header of the packet
* @mlm_state: MLM state to be marked to track SAE authentication
*
* Return: None
*/
static void lim_external_auth_add_pre_auth_node(struct mac_context *mac_ctx,
tpSirMacMgmtHdr mac_hdr,
tLimMlmStates mlm_state)
{
struct tLimPreAuthNode *auth_node;
tpLimPreAuthTable preauth_table = &mac_ctx->lim.gLimPreAuthTimerTable;
pe_debug("=======> eSIR_AUTH_TYPE_SAE");
/* Create entry for this STA in pre-auth list */
auth_node = lim_acquire_free_pre_auth_node(mac_ctx, preauth_table);
if (!auth_node) {
pe_debug("Max pre-auth nodes reached " QDF_MAC_ADDR_STR,
QDF_MAC_ADDR_ARRAY(mac_hdr->sa));
return;
}
pe_debug("Creating preauth node for SAE peer " QDF_MAC_ADDR_STR,
QDF_MAC_ADDR_ARRAY(mac_hdr->sa));
qdf_mem_copy((uint8_t *)auth_node->peerMacAddr,
mac_hdr->sa, sizeof(tSirMacAddr));
auth_node->mlmState = mlm_state;
auth_node->authType = eSIR_AUTH_TYPE_SAE;
auth_node->timestamp = qdf_mc_timer_get_system_ticks();
auth_node->seq_num = ((mac_hdr->seqControl.seqNumHi << 4) |
(mac_hdr->seqControl.seqNumLo));
lim_add_pre_auth_node(mac_ctx, auth_node);
}
/**
* lim_process_sae_auth_frame()-Process SAE authentication frame
* @mac_ctx: MAC context
@@ -305,14 +342,34 @@ static void lim_process_sae_auth_frame(struct mac_context *mac_ctx,
pe_err("SAE auth response for STA in unexpected state %x",
pe_session->limMlmState);
if (LIM_IS_AP_ROLE(pe_session))
if (LIM_IS_AP_ROLE(pe_session)) {
struct tLimPreAuthNode *sta_pre_auth_ctx;
rx_flags = RXMGMT_FLAG_EXTERNAL_AUTH;
/* Add preauth node when the first SAE authentication frame
* is received and mark state as authenticating.
* It's not good to track SAE authentication frames with
* authTransactionSeqNumber as it's subjected to
* SAE protocol optimizations.
*/
/* Extract pre-auth context for the STA, if any. */
sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx,
mac_hdr->sa);
if (!sta_pre_auth_ctx ||
(sta_pre_auth_ctx->mlmState != eLIM_MLM_WT_SAE_AUTH_STATE &&
sta_pre_auth_ctx->mlmState !=
eLIM_MLM_AUTHENTICATED_STATE)) {
lim_external_auth_add_pre_auth_node(mac_ctx, mac_hdr,
eLIM_MLM_WT_SAE_AUTH_STATE);
}
}
lim_send_sme_mgmt_frame_ind(mac_ctx, mac_hdr->fc.subType,
(uint8_t *) mac_hdr,
frame_len + sizeof(tSirMacMgmtHdr), 0,
WMA_GET_RX_CH(rx_pkt_info), pe_session,
WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info), rx_flags);
(uint8_t *)mac_hdr,
frame_len + sizeof(tSirMacMgmtHdr), 0,
WMA_GET_RX_CH(rx_pkt_info), pe_session,
WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info),
rx_flags);
}
#else
static inline void lim_process_sae_auth_frame(struct mac_context *mac_ctx,