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 96568FBE8 for ; Thu, 1 Jun 2023 13:27:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 260EEC433D2; Thu, 1 Jun 2023 13:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1685626024; bh=MILY39kd8rCMkR/XdLUoPwEY904DFCAaG/DiuQJQ4f0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6vHKpi+qYVWqeWF73ZbvwsWP3546VEQ54yRBNlewFw6ifuYKmA3h3DYG8sAtecyv Qoiq+2UkCXjROtbg5DZNO2Wxw1HhqiPTCTT0cS7hKXfjpEy4Rid95Y/RCIDHzutjku Zluks0ZG7J4TNMrn2ydN0V1O//3V1ncYU+RI0VoU= 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 6.3 45/45] netfilter: ctnetlink: Support offloaded conntrack entry deletion Date: Thu, 1 Jun 2023 14:21:41 +0100 Message-Id: <20230601131940.779545951@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601131938.702671708@linuxfoundation.org> References: <20230601131938.702671708@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 @@ -1559,9 +1559,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); } @@ -1631,11 +1628,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]);