From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9BD0C7EE25 for ; Wed, 7 Jun 2023 20:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233896AbjFGUeh (ORCPT ); Wed, 7 Jun 2023 16:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233894AbjFGUeg (ORCPT ); Wed, 7 Jun 2023 16:34:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02288211B for ; Wed, 7 Jun 2023 13:34:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D777564555 for ; Wed, 7 Jun 2023 20:34:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE376C433EF; Wed, 7 Jun 2023 20:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686170059; bh=BTitAfmWMoFUwxjYr3Aji1L2znMoFfwcG3nQ3uQ9O04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2knZ9bu9xxwkrZRzMBufj4mc+PtG5KFfGUvYTi7B8XTXd5CCaAOmNBL3XLfmrJcpn uWiA9p85YA7OsO/ZI4pxCrPIfpon3PvLfaNAtgWh8jWdJ2HUVgnIgQCJq419MaJmgh r8QvfSxv+tKmi1Jc+cfuOvEJQ++YY89rGMoPDy5Y= 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 4.19 09/88] netfilter: ctnetlink: Support offloaded conntrack entry deletion Date: Wed, 7 Jun 2023 22:15:26 +0200 Message-ID: <20230607200857.327416757@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607200854.030202132@linuxfoundation.org> References: <20230607200854.030202132@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 @@ -1216,9 +1216,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); } @@ -1280,11 +1277,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]);