[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250204195030.46765-4-ericwouds@gmail.com>
Date: Tue, 4 Feb 2025 20:50:30 +0100
From: Eric Woudstra <ericwouds@...il.com>
To: Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Vladimir Oltean <olteanv@...il.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
"Frank Wunderlich" <frank-w@...lic-files.de>,
Daniel Golle <daniel@...rotopia.org>
Cc: netfilter-devel@...r.kernel.org,
coreteam@...filter.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Eric Woudstra <ericwouds@...il.com>
Subject: [RFC PATCH v1 net-next 3/3] netfilter: nf_flow_table_ip: don't follow fastpath when marked teardown
When a flow is marked for teardown, because the destination is not valid
any more, the software fastpath may still be in effect and traffic is
still send to the wrong destination. Change the ip/ipv6 hooks to not use
the software fastpath for a flow that is marked to be teared down and let
the packet continue along the normal path.
Signed-off-by: Eric Woudstra <ericwouds@...il.com>
---
net/netfilter/nf_flow_table_ip.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index b9292eb40907..84a8fe7b7b5d 100644
--- a/net/netfilter/nf_flow_table_ip.c
+++ b/net/netfilter/nf_flow_table_ip.c
@@ -543,6 +543,9 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
dir = tuplehash->tuple.dir;
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
+ if (test_bit(NF_FLOW_TEARDOWN, &flow->flags))
+ return NF_ACCEPT;
+
switch (tuplehash->tuple.xmit_type) {
case FLOW_OFFLOAD_XMIT_NEIGH:
rt = dst_rtable(tuplehash->tuple.dst_cache);
@@ -841,6 +844,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
dir = tuplehash->tuple.dir;
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
+ if (test_bit(NF_FLOW_TEARDOWN, &flow->flags))
+ return NF_ACCEPT;
+
switch (tuplehash->tuple.xmit_type) {
case FLOW_OFFLOAD_XMIT_NEIGH:
rt = dst_rt6_info(tuplehash->tuple.dst_cache);
--
2.47.1
Powered by blists - more mailing lists