Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9c4ca79 authored by Pankaj Singh's avatar Pankaj Singh
Browse files

wlan: 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: 2734661
parent 19a60dcc
Loading
Loading
Loading
Loading
+61 −2
Original line number Diff line number Diff line
@@ -102,6 +102,46 @@ static inline unsigned int isAuthValid(tpAniSirGlobal pMac, tpSirMacAuthFrameBod
}

#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(tpAniSirGlobal mac_ctx,
                                                tpSirMacMgmtHdr mac_hdr,
                                                tLimMlmStates mlm_state)
{
    struct tLimPreAuthNode *auth_node;
    tpLimPreAuthTable preauth_table = &mac_ctx->lim.gLimPreAuthTimerTable;

    limLog(mac_ctx, LOG1, FL("=======> eSIR_AUTH_TYPE_SAE"));
    /* Create entry for this STA in pre-auth list */
    auth_node = limAcquireFreePreAuthNode(mac_ctx, preauth_table);
    if (!auth_node) {
        limLog(mac_ctx, LOG1,
                "Max pre-auth nodes reached " MAC_ADDRESS_STR,
                MAC_ADDR_ARRAY(mac_hdr->sa));
        return;
    }
    limLog(mac_ctx, LOG1,
            "Creating preauth node for SAE peer " MAC_ADDRESS_STR,
            MAC_ADDR_ARRAY(mac_hdr->sa));
    vos_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 = vos_timer_get_system_ticks();
    auth_node->seqNo = ((mac_hdr->seqControl.seqNumHi << 4) |
                        (mac_hdr->seqControl.seqNumLo));
    auth_node->assoc_req.present = false;
    limAddPreAuthNode(mac_ctx, auth_node);
}


/**
 * lim_process_sae_auth_frame()-Process SAE authentication frame
 * @mac_ctx: MAC context
@@ -128,8 +168,27 @@ static void lim_process_sae_auth_frame(tpAniSirGlobal mac_ctx,
               FL("received SAE auth response 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 = limSearchPreAuthList(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);
            }
    }

    limSendSmeMgmtFrameInd(mac_ctx, pe_session->peSessionId,
                           rx_pkt_info, pe_session,