diff mbox series

[nf-next] netfilter: flowtables: use fixed renew timeout on teardown

Message ID 20180615214642.13763-1-fw@strlen.de
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nf-next] netfilter: flowtables: use fixed renew timeout on teardown | expand

Commit Message

Florian Westphal June 15, 2018, 9:46 p.m. UTC
This is one of the very few external callers of ->get_timeouts(),

We can use a fixed timeout instead, conntrack core will refresh this in
case a new packet comes within this period.

Use of ESTABLISHED timeout seems way too huge anyway.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nf_flow_table_core.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Pablo Neira Ayuso June 27, 2018, 2:54 p.m. UTC | #1
On Fri, Jun 15, 2018 at 11:46:42PM +0200, Florian Westphal wrote:
> This is one of the very few external callers of ->get_timeouts(),
> 
> We can use a fixed timeout instead, conntrack core will refresh this in
> case a new packet comes within this period.
> 
> Use of ESTABLISHED timeout seems way too huge anyway.

Applied, thanks Florian.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index eb0d1658ac05..9140b3cc16e2 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -110,8 +110,6 @@  static void flow_offload_fixup_tcp(struct ip_ct_tcp *tcp)
 static void flow_offload_fixup_ct_state(struct nf_conn *ct)
 {
 	const struct nf_conntrack_l4proto *l4proto;
-	struct net *net = nf_ct_net(ct);
-	unsigned int *timeouts;
 	unsigned int timeout;
 	int l4num;
 
@@ -123,14 +121,10 @@  static void flow_offload_fixup_ct_state(struct nf_conn *ct)
 	if (!l4proto)
 		return;
 
-	timeouts = l4proto->get_timeouts(net);
-	if (!timeouts)
-		return;
-
 	if (l4num == IPPROTO_TCP)
-		timeout = timeouts[TCP_CONNTRACK_ESTABLISHED];
+		timeout = 2 * 60 * HZ;
 	else if (l4num == IPPROTO_UDP)
-		timeout = timeouts[UDP_CT_REPLIED];
+		timeout = 30 * HZ;
 	else
 		return;