[PATCH v5 net-next 11/14] netfilter: nft_flow_offload: No ingress_vlan forward info for dsa user port

Eric Woudstra
2025-02-04T21:16:19Z

The bitfield info->ingress_vlans and correcponding vlan encap are used for
a switchdev user port. However, they should not be set for a dsa user port.

Signed-off-by: Eric Woudstra <ericwouds@gmail.com>
---
net/netfilter/nft_flow_offload.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index b9e6d9e6df66..c95fad495460 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -116,6 +116,11 @@ static void nft_dev_path_info(const struct net_device_path_stack *stack,
break;
if (path->type == DEV_PATH_DSA) {
i = stack->num_paths;
+ if (!info->num_encaps ||
+ !(info->ingress_vlans & BIT(info->num_encaps - 1)))
+ break;
+ info->num_encaps--;
+ info->ingress_vlans &= ~BIT(info->num_encaps - 1);
break;
}
if (path->type == DEV_PATH_MTK_WDMA) {
--
2.47.1