netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org
Cc: Mateusz Palczewski <mateusz.palczewski@intel.com>,
	netdev@vger.kernel.org, sassmann@redhat.com,
	anthony.l.nguyen@intel.com,
	Grzegorz Szczurek <grzegorzx.szczurek@intel.com>,
	Jaroslaw Gawin <jaroslawx.gawin@intel.com>,
	Tony Brelinski <tonyx.brelinski@intel.com>
Subject: [PATCH net v2 7/8] i40e: Fix add TC filter for IPv6
Date: Fri, 19 Feb 2021 13:36:05 -0800	[thread overview]
Message-ID: <20210219213606.2567536-8-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20210219213606.2567536-1-anthony.l.nguyen@intel.com>

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

Fix insufficient distinction between IPv4 and IPv6 addresses
when creating a filter.
IPv4 and IPv6 are kept in the same memory area. If IPv6 is added,
then it's caught by IPv4 check, which leads to err -95.

Fixes: 2f4b411a3d67 ("i40e: Enable cloud filters via tc-flower")
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2e22ab5a0f9a..3e4a4d6f0419 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7731,7 +7731,8 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
 		return -EOPNOTSUPP;
 
 	/* adding filter using src_port/src_ip is not supported at this stage */
-	if (filter->src_port || filter->src_ipv4 ||
+	if (filter->src_port ||
+	    (filter->src_ipv4 && filter->n_proto != ETH_P_IPV6) ||
 	    !ipv6_addr_any(&filter->ip.v6.src_ip6))
 		return -EOPNOTSUPP;
 
@@ -7760,7 +7761,7 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
 			cpu_to_le16(I40E_AQC_ADD_CLOUD_FILTER_MAC_VLAN_PORT);
 		}
 
-	} else if (filter->dst_ipv4 ||
+	} else if ((filter->dst_ipv4 && filter->n_proto != ETH_P_IPV6) ||
 		   !ipv6_addr_any(&filter->ip.v6.dst_ip6)) {
 		cld_filter.element.flags =
 				cpu_to_le16(I40E_AQC_ADD_CLOUD_FILTER_IP_PORT);
-- 
2.26.2


  parent reply	other threads:[~2021-02-19 21:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
2021-02-19 21:35 ` [PATCH net v2 1/8] i40e: Fix flow for IPv6 next header (extension header) Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 2/8] i40e: Fix memory leak in i40e_probe Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 3/8] i40e: Add zero-initialization of AQ command structures Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 4/8] i40e: Fix overwriting flow control settings during driver loading Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 5/8] i40e: Fix addition of RX filters after enabling FW LLDP agent Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 6/8] i40e: Fix VFs not created Tony Nguyen
2021-02-19 21:36 ` Tony Nguyen [this message]
2021-02-19 21:36 ` [PATCH net v2 8/8] i40e: Fix endianness conversions Tony Nguyen
2021-02-23  3:20 ` [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210219213606.2567536-8-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=grzegorzx.szczurek@intel.com \
    --cc=jaroslawx.gawin@intel.com \
    --cc=kuba@kernel.org \
    --cc=mateusz.palczewski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    --cc=tonyx.brelinski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).