netfilter: conntrack: remove flowtable early-drop test
authorFlorian Westphal <fw@strlen.de>
Tue, 23 Apr 2024 13:44:28 +0000 (15:44 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 6 May 2024 14:29:21 +0000 (16:29 +0200)
Not sure why this special case exists.  Early drop logic
(which kicks in when conntrack table is full) should be independent
of flowtable offload and only consider assured bit (i.e., two-way
traffic was seen).

flowtable entries hold a reference to the conntrack entry (struct
nf_conn) that has been offloaded. The conntrack use count is not
decremented until after the entry is free'd.

This change therefore will not result in exceeding the conntrack table
limit.  It does allow early-drop of tcp flows even when they've been
offloaded, but only if they have been offloaded before syn-ack was
received or after at least one peer has sent a fin.

Currently 'fin' packet reception already stops offloading, so this
should not impact offloading either.

Cc: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_core.c

index 6102dc09cdd3efef46472602a738977f0c11fb5b..7ac20750c127b5e537b7d3019717ca98d007fead 100644 (file)
@@ -1440,8 +1440,6 @@ static bool gc_worker_can_early_drop(const struct nf_conn *ct)
        const struct nf_conntrack_l4proto *l4proto;
        u8 protonum = nf_ct_protonum(ct);
 
-       if (test_bit(IPS_OFFLOAD_BIT, &ct->status) && protonum != IPPROTO_UDP)
-               return false;
        if (!test_bit(IPS_ASSURED_BIT, &ct->status))
                return true;