Skip to content

Commit

Permalink
netfilter: ctnetlink: Support offloaded conntrack entry deletion
Browse files Browse the repository at this point in the history
commit 9b7c68b upstream.

Currently, offloaded conntrack entries (flows) can only be deleted
after they are removed from offload, which is either by timeout,
tcp state change or tc ct rule deletion. This can cause issues for
users wishing to manually delete or flush existing entries.

Support deletion of offloaded conntrack entries.

Example usage:
 # Delete all offloaded (and non offloaded) conntrack entries
 # whose source address is 1.2.3.4
 $ conntrack -D -s 1.2.3.4
 # Delete all entries
 $ conntrack -F

Signed-off-by: Paul Blakey <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Acked-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>
Cc: Demi Marie Obenour <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Paul Blakey authored and gregkh committed Jun 5, 2023
1 parent 395d846 commit e226893
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions net/netfilter/nf_conntrack_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1546,9 +1546,6 @@ static const struct nla_policy ct_nla_policy[CTA_MAX+1] = {

static int ctnetlink_flush_iterate(struct nf_conn *ct, void *data)
{
if (test_bit(IPS_OFFLOAD_BIT, &ct->status))
return 0;

return ctnetlink_filter_match(ct, data);
}

Expand Down Expand Up @@ -1612,11 +1609,6 @@ static int ctnetlink_del_conntrack(struct sk_buff *skb,

ct = nf_ct_tuplehash_to_ctrack(h);

if (test_bit(IPS_OFFLOAD_BIT, &ct->status)) {
nf_ct_put(ct);
return -EBUSY;
}

if (cda[CTA_ID]) {
__be32 id = nla_get_be32(cda[CTA_ID]);

Expand Down

0 comments on commit e226893

Please sign in to comment.