From 2a92ccf428e2838d9ea0e7070331f5a8759ea436 Mon Sep 17 00:00:00 2001 From: Srikanth Marepalli Date: Fri, 24 Jun 2022 16:07:20 +0530 Subject: [PATCH] qcacld-3.0: Allow unprotected diassoc frame when keys are not installed Currently unprotected diassociation frame is dropped if PMF is enabled and keys are not installed. This causes delay as supplicant has to do EAPOL timeout after 10 secs and then do disconnect. Allow unprotected disassociation frame when install keys are not done. Change-Id: I12068d7b10c4e6f7885ca3a3400a8845a4c236f2 CRs-Fixed: 3208427 --- core/mac/src/pe/include/lim_api.h | 10 ++++++++++ core/mac/src/pe/lim/lim_api.c | 14 ++------------ core/mac/src/pe/lim/lim_process_deauth_frame.c | 4 ++-- core/mac/src/pe/lim/lim_process_disassoc_frame.c | 5 +++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/core/mac/src/pe/include/lim_api.h b/core/mac/src/pe/include/lim_api.h index 813a9ad12c76..b1b18ba9ef73 100644 --- a/core/mac/src/pe/include/lim_api.h +++ b/core/mac/src/pe/include/lim_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -135,6 +136,15 @@ typedef enum eMgmtFrmDropReason { eMGMT_DROP_EXCESSIVE_MGMT_FRAME, } tMgmtFrmDropReason; +/** + * is_mgmt_protected - check RMF enabled for the peer + * @vdev_id: vdev id + * @peer_mac_addr: peer mac address + * + * Return: True if RMF enabled and key is installed + */ +bool is_mgmt_protected(uint32_t vdev_id, const uint8_t *peer_mac_addr); + /** * Function to initialize LIM state machines. * This called upon LIM thread creation. diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index 94173b4cf80f..4872771f9eee 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -630,18 +631,7 @@ static void pe_shutdown_notifier_cb(void *ctx) } #ifdef WLAN_FEATURE_11W -/** - * is_mgmt_protected - check RMF enabled for the peer - * @vdev_id: vdev id - * @peer_mac_addr: peer mac address - * - * The function check the mgmt frame protection enabled or not - * for station mode and AP mode - * - * Return: true, if the connection is RMF enabled. - */ -static bool is_mgmt_protected(uint32_t vdev_id, - const uint8_t *peer_mac_addr) +bool is_mgmt_protected(uint32_t vdev_id, const uint8_t *peer_mac_addr) { uint16_t aid; tpDphHashNode sta_ds; diff --git a/core/mac/src/pe/lim/lim_process_deauth_frame.c b/core/mac/src/pe/lim/lim_process_deauth_frame.c index f8a3c461f5a8..dfc4a1a31dd1 100644 --- a/core/mac/src/pe/lim/lim_process_deauth_frame.c +++ b/core/mac/src/pe/lim/lim_process_deauth_frame.c @@ -121,10 +121,10 @@ lim_process_deauth_frame(struct mac_context *mac, uint8_t *pRxPacketInfo, pe_err("rx frame doesn't have valid a1 address, drop it"); return; } + #ifdef WLAN_FEATURE_11W /* PMF: If this session is a PMF session, then ensure that this frame was protected */ - if (pe_session->limRmfEnabled && - pe_session->is_key_installed && + if (is_mgmt_protected(pe_session->vdev_id, (const uint8_t *)pHdr->sa) && (WMA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) & DPU_FEEDBACK_UNPROTECTED_ERROR)) { pe_debug("received an unprotected deauth from AP"); diff --git a/core/mac/src/pe/lim/lim_process_disassoc_frame.c b/core/mac/src/pe/lim/lim_process_disassoc_frame.c index 013128d961d8..84f0035122d2 100644 --- a/core/mac/src/pe/lim/lim_process_disassoc_frame.c +++ b/core/mac/src/pe/lim/lim_process_disassoc_frame.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -113,8 +114,8 @@ lim_process_disassoc_frame(struct mac_context *mac, uint8_t *pRxPacketInfo, } #ifdef WLAN_FEATURE_11W /* PMF: If this session is a PMF session, then ensure that this frame was protected */ - if (pe_session->limRmfEnabled - && (WMA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) & + if (is_mgmt_protected(pe_session->vdev_id, (const uint8_t *)pHdr->sa) && + (WMA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) & DPU_FEEDBACK_UNPROTECTED_ERROR)) { pe_err("received an unprotected disassoc from AP"); /*