[PATCH nf-next v5 1/3] netfilter: flow: Add bridge_vid member
From: Julius Bairaktaris <hidden>
Date: 2026-09-14 07:25:47
Also in:
linux-kselftest, 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
From: Eric Woudstra <redacted> 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> Signed-off-by: Julius Bairaktaris <redacted> Assisted-by: LLM --- include/net/netfilter/nf_flow_table.h | 2 ++ net/netfilter/nf_flow_table_core.c | 1 + net/netfilter/nf_flow_table_path.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 f2e2771f188f..cadd5f82be8e 100644
--- a/include/net/netfilter/nf_flow_table.h
+++ b/include/net/netfilter/nf_flow_table.h@@ -164,6 +164,7 @@ struct flow_offload_tuple { }; struct { u32 ifidx; + u16 bridge_vid; u8 h_source[ETH_ALEN]; u8 h_dest[ETH_ALEN]; } out;
@@ -232,6 +233,7 @@ struct nf_flow_route { struct { u32 ifindex; u32 hw_ifindex; + u16 bridge_vid; u8 h_source[ETH_ALEN]; u8 h_dest[ETH_ALEN]; u8 needs_gso_segment:1;
diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 03241d4bfd5e..b308fb627640 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c@@ -139,6 +139,7 @@ static int flow_offload_fill_route(struct flow_offload *flow, memcpy(flow_tuple->out.h_source, route->tuple[dir].out.h_source, ETH_ALEN); flow_tuple->out.ifidx = route->tuple[dir].out.ifindex; + flow_tuple->out.bridge_vid = route->tuple[dir].out.bridge_vid; break; case FLOW_OFFLOAD_XMIT_XFRM: case FLOW_OFFLOAD_XMIT_NEIGH:
diff --git a/net/netfilter/nf_flow_table_path.c b/net/netfilter/nf_flow_table_path.c
index 1e55644f2edb..53629e9b2273 100644
--- a/net/netfilter/nf_flow_table_path.c
+++ b/net/netfilter/nf_flow_table_path.c@@ -88,6 +88,7 @@ struct nft_forward_info { __be16 proto; } encap[NF_FLOW_TABLE_ENCAP_MAX]; u8 num_encaps; + u16 bridge_vid; struct flow_offload_tunnel tun; struct dst_entry *tun_dst; u8 num_tuns;
@@ -180,6 +181,7 @@ static int nft_dev_path_info(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:
@@ -257,6 +259,7 @@ static int nft_dev_forward_path(const struct nft_pktinfo *pkt, if (info.xmit_type == FLOW_OFFLOAD_XMIT_DIRECT) { memcpy(route->tuple[dir].out.h_source, info.h_source, ETH_ALEN); memcpy(route->tuple[dir].out.h_dest, info.h_dest, ETH_ALEN); + route->tuple[dir].out.bridge_vid = info.bridge_vid; route->tuple[dir].xmit_type = info.xmit_type; } route->tuple[dir].out.needs_gso_segment = info.needs_gso_segment;
--
2.53.0