-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Alok 
Tiwari
Sent: Tuesday, November 11, 2025 12:44 AM
To: [email protected]; Kitszel, Przemyslaw <[email protected]>; 
Lobakin, Aleksander <[email protected]>; Nguyen, Anthony L 
<[email protected]>; [email protected]; [email protected]; 
[email protected]; [email protected]; [email protected]; [email protected]; 
[email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [Intel-wired-lan] [PATCH v2 net] i40e: fix src IP mask checks and 
memcpy argument names in cloud filter

Fix following issues in the IPv4 and IPv6 cloud filter handling logic in both 
the add and delete paths:

- The source-IP mask check incorrectly compares mask.src_ip[0] against
  tcf.dst_ip[0]. Update it to compare against tcf.src_ip[0]. This likely
  goes unnoticed because the check is in an "else if" path that only
  executes when dst_ip is not set, most cloud filter use cases focus on
  destination-IP matching, and the buggy condition can accidentally
  evaluate true in some cases.

- memcpy() for the IPv4 source address incorrectly uses
  ARRAY_SIZE(tcf.dst_ip) instead of ARRAY_SIZE(tcf.src_ip), although
  both arrays are the same size.

- The IPv4 memcpy operations used ARRAY_SIZE(tcf.dst_ip) and ARRAY_SIZE
  (tcf.src_ip), Update these to use sizeof(cfilter->ip.v4.dst_ip) and
  sizeof(cfilter->ip.v4.src_ip) to ensure correct and explicit copy size.

- In the IPv6 delete path, memcmp() uses sizeof(src_ip6) when comparing
  dst_ip6 fields. Replace this with sizeof(dst_ip6) to make the intent
  explicit, even though both fields are struct in6_addr.

Fixes: e284fc280473 ("i40e: Add and delete cloud filter")
Signed-off-by: Alok Tiwari <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
Reviewed-by: Paul Menzel <[email protected]>
---
v1 -> v2
update patch subject line and replace ARRAY_SIZE with sizeof as suggested by 
Alex and added Reviewed-by Alex and Paul.
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
>


Unable able to create  Ipv4 and Ipv6 filter with src_ip.

Below are the commands I used to create the filters for IPV4 and IPV6.

tc filter add dev eth0 protocol ipv6 parent ffff: prio 1 flower  src_ip 
2001:db8:0:f101::12 skip_sw hw_tc 1

Error:
RTNETLINK answers: Invalid argument
We have an error talking to the kernel

tc filter add dev eth0 protocol ip parent ffff: prio 1 flower src_ip 1.2.1.1 
skip_sw hw_tc 1

Error:
RTNETLINK answers: Invalid argument
We have an error talking to the kernel



Reply via email to