[PATCH v3 nf-next 1/3] netfilter: flow: Add bridge_vid member
From: Eric Woudstra <hidden>
Date: 2025-06-17 07:00:23
Also in:
netfilter-devel
Subsystem:
netfilter, networking [general], the rest · Maintainers:
Pablo Neira Ayuso, Florian Westphal, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
Store the vid used on the bridge in the flow_offload_tuple, so it can be used later to identify fdb entries that relate to the tuple. The bridge_vid member is added to the structures nft_forward_info, nf_flow_route and flow_offload_tuple. It can now be passed from net_device_path->bridge.vlan_id to flow_offload_tuple->out.bridge_vid. Signed-off-by: Eric Woudstra <redacted> --- include/net/netfilter/nf_flow_table.h | 2 ++ net/netfilter/nf_flow_table_core.c | 1 + net/netfilter/nft_flow_offload.c | 3 +++ 3 files changed, 6 insertions(+)
diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
index d711642e78b5..9d9363e91587 100644
--- a/include/net/netfilter/nf_flow_table.h
+++ b/include/net/netfilter/nf_flow_table.h@@ -146,6 +146,7 @@ struct flow_offload_tuple { struct { u32 ifidx; u32 hw_ifidx; + u16 bridge_vid; u8 h_source[ETH_ALEN]; u8 h_dest[ETH_ALEN]; } out;
@@ -212,6 +213,7 @@ struct nf_flow_route { struct { u32 ifindex; u32 hw_ifindex; + u16 bridge_vid; u8 h_source[ETH_ALEN]; u8 h_dest[ETH_ALEN]; } out;
diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 9441ac3d8c1a..992958db4a19 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c@@ -128,6 +128,7 @@ static int flow_offload_fill_route(struct flow_offload *flow, ETH_ALEN); flow_tuple->out.ifidx = route->tuple[dir].out.ifindex; flow_tuple->out.hw_ifidx = route->tuple[dir].out.hw_ifindex; + flow_tuple->out.bridge_vid = route->tuple[dir].out.bridge_vid; dst_release(dst); break; case FLOW_OFFLOAD_XMIT_XFRM:
diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index fdf927a8252d..31372a8ef37e 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c@@ -85,6 +85,7 @@ struct nft_forward_info { __u16 id; __be16 proto; } encap[NF_FLOW_TABLE_ENCAP_MAX]; + u16 bridge_vid; u8 num_encaps; u8 ingress_vlans; u8 h_source[ETH_ALEN];
@@ -159,6 +160,7 @@ static void nft_dev_path_info(const struct net_device_path_stack *stack, case DEV_PATH_BR_VLAN_KEEP: break; } + info->bridge_vid = path->bridge.vlan_id; info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT; break; default:
@@ -223,6 +225,7 @@ static void nft_dev_forward_path(struct nf_flow_route *route, memcpy(route->tuple[dir].out.h_dest, info.h_dest, ETH_ALEN); route->tuple[dir].out.ifindex = info.outdev->ifindex; route->tuple[dir].out.hw_ifindex = info.hw_outdev->ifindex; + route->tuple[dir].out.bridge_vid = info.bridge_vid; route->tuple[dir].xmit_type = info.xmit_type; } }
--
2.47.1