From e3535751a9ccddc6e631204b1f86d81940099cd9 Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Wed, 10 Feb 2021 15:15:40 +0530 Subject: [PATCH] qcacld-3.0: Do not intrabss fwd EAPOL frames in IPA exc path Do not intrabss forward EAPOL frames received in IPA exception path. Change-Id: I0be68ec2c186a7b64d4d2f1c3de7dbb20e49d860 CRs-Fixed: 2860225 --- components/ipa/core/src/wlan_ipa_core.c | 43 +++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/components/ipa/core/src/wlan_ipa_core.c b/components/ipa/core/src/wlan_ipa_core.c index 08e886e52dcb..2fd884a65047 100644 --- a/components/ipa/core/src/wlan_ipa_core.c +++ b/components/ipa/core/src/wlan_ipa_core.c @@ -978,6 +978,33 @@ wlan_ipa_send_skb_to_network(qdf_nbuf_t skb, ipa_ctx->ipa_rx_net_send_count++; } +/** + * wlan_ipa_eapol_intrabss_fwd_check() - Check if eapol pkt intrabss fwd is + * allowed or not + * @ipa_ctx: IPA global context + * @vdev_id: vdev id + * @nbuf: network buffer + * + * Return: true if intrabss fwd is allowed for eapol else false + */ +static bool +wlan_ipa_eapol_intrabss_fwd_check(struct wlan_ipa_priv *ipa_ctx, + uint8_t vdev_id, qdf_nbuf_t nbuf) +{ + uint8_t *vdev_mac_addr; + + vdev_mac_addr = cdp_get_vdev_mac_addr(ipa_ctx->dp_soc, vdev_id); + + if (!vdev_mac_addr) + return false; + + if (qdf_mem_cmp(qdf_nbuf_data(nbuf) + QDF_NBUF_DEST_MAC_OFFSET, + vdev_mac_addr, QDF_MAC_ADDR_SIZE)) + return false; + + return true; +} + /** * __wlan_ipa_w2i_cb() - WLAN to IPA callback handler * @priv: pointer to private data registered with IPA (we register a @@ -1054,9 +1081,21 @@ static void __wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt, QDF_NBUF_SRC_MAC_OFFSET, QDF_MAC_ADDR_SIZE); - if (qdf_nbuf_is_ipv4_eapol_pkt(skb) || - qdf_nbuf_is_ipv4_wapi_pkt(skb)) + if (qdf_nbuf_is_ipv4_eapol_pkt(skb)) { is_eapol_wapi = true; + if (iface_context->device_mode == QDF_SAP_MODE && + !wlan_ipa_eapol_intrabss_fwd_check(ipa_ctx, + iface_context->session_id, skb)) { + ipa_err_rl("EAPOL intrabss fwd drop DA:"QDF_MAC_ADDR_FMT, + QDF_MAC_ADDR_REF(qdf_nbuf_data(skb) + + QDF_NBUF_DEST_MAC_OFFSET)); + ipa_ctx->ipa_rx_internal_drop_count++; + dev_kfree_skb_any(skb); + return; + } + } else if (qdf_nbuf_is_ipv4_wapi_pkt(skb)) { + is_eapol_wapi = true; + } /* * Check for peer authorized state before allowing