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

Commit 041516f8 authored by Yeshwanth Sriram Guntuka's avatar Yeshwanth Sriram Guntuka Committed by Madan Koyyalamudi
Browse files

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
parent f2975edc
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -971,6 +971,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
@@ -1047,9 +1074,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