From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D7A0E54A for ; Thu, 1 Jun 2023 13:22:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEE1DC433D2; Thu, 1 Jun 2023 13:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1685625745; bh=7qfgA5nJCgVbaXXii7SkqXch5xCs/LNXXLaLlH0JOro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9sWQVyLmn7ezTHJd1rXdh+O7Bx7eFYf9/LQPaRA4ccgpxA2Qefo39w6F8R7aRXVY g+64FsBGF88PJi68qf+lBOULnkGCYmmFVXA5b9Mpn5mzslmvXgBJZj1p3s5OHw5kfd ImdbTaY9++LaznQ48kRBc8qPen1PH09Mb47XHnew= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paul Blakey , Simon Horman , Pablo Neira Ayuso , Florian Westphal , Demi Marie Obenour Subject: [PATCH 5.4 16/16] netfilter: ctnetlink: Support offloaded conntrack entry deletion Date: Thu, 1 Jun 2023 14:21:11 +0100 Message-Id: <20230601131932.704331175@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601131931.947241286@linuxfoundation.org> References: <20230601131931.947241286@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Paul Blakey commit 9b7c68b3911aef84afa4cbfc31bce20f10570d51 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 Reviewed-by: Simon Horman Acked-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal Cc: Demi Marie Obenour Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_conntrack_netlink.c | 8 -------- 1 file changed, 8 deletions(-) --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -1229,9 +1229,6 @@ static const struct nla_policy ct_nla_po 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); } @@ -1294,11 +1291,6 @@ static int ctnetlink_del_conntrack(struc 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]);