Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp865751pxb; Tue, 1 Feb 2022 12:03:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLAYHX3ykBJmAoiUgN2VqbUUQj49+cQsLJJ19p9i1Nr3lPh1bjuPVBpGayo4jpvGl09Wyu X-Received: by 2002:a17:907:1c09:: with SMTP id nc9mr22806103ejc.663.1643745796050; Tue, 01 Feb 2022 12:03:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745796; cv=none; d=google.com; s=arc-20160816; b=j6CBLenI9B52UdPRle0/lpBC1WxOXYRZZA9MGfucCfCOrPGhpKJ3bav9QtDPTa244+ rDv9IxoCCO8QHrZBK9IJqiNbCC+G+Sj6fUZ6UxDQeOffdAr1AbWW946zimIYXdxquwMI Mlmru8cYZW8kknAhkJffpGFM6vaCpdzK1AJF5z61JKtjmDRtiRzO0SDDe4Xt6umeLqCO P1qrcuSWsnBRvi7wn6MyWaQvsK0CXO0yOM2hoG2Bj6zl7aR1zZAmZt2TC/DgcxSyBLas nBqCFtQO5uOkDrjreZzjZYYaoHqm2sWt8OizSTZetOOkwWLbv2z1ia+eYfhOqLBv5Arb 9Gcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rdSdB4sNxgX2LvVQzFnurA57Mbwvdv+iPCNLbnNsxog=; b=Zam/ZLj6v0N5Fsbcm2EChurhm7YMDvbfpfwXDv5S3vkmQB+dwh+CIxvBYXfb33MWtV tHQ1zHIvx/wjrQ7iWYNaXa5oBi8zxG2V+CkTeKUpHXz0JuU2mQyE0KGE609iiKXiKW+H srMejwQJUP+R0j1+zqKLl9w0CXhMd+LTeLkOTRf35Jv0ReqiMNeHPFd8WvSngCCClafi EspHOVH5+XZ+WwWicBLU0I14yazzMVHRi3tXS7nGzcGVzc5CCD3kuwV52xvLkMyrXrAg AR7ZLgm9jP3L0gHLe7GmdtxMBwU9tEzgRzg4ai9MzEnvAjs4TtqUqtkxCX2Ur+fACGo1 5Czg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ICap4FEn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si9641293ejn.613.2022.02.01.12.02.48; Tue, 01 Feb 2022 12:03:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ICap4FEn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376480AbiAaLPY (ORCPT + 99 others); Mon, 31 Jan 2022 06:15:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376381AbiAaLIW (ORCPT ); Mon, 31 Jan 2022 06:08:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85861C06137D; Mon, 31 Jan 2022 03:05:09 -0800 (PST) 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 F0E5360B2D; Mon, 31 Jan 2022 11:05:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA995C340E8; Mon, 31 Jan 2022 11:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627108; bh=zvyNwOr93+rBG2GHu7E1w57INMl7TdbBKGqvr/NBZrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICap4FEnYet9l77TP33XCFgIxV7HeEHYlrr1XvbqcllNSDLYjOkesLoyHZ8NR4DiT FATuXxZCzawaIJ2/Us9aWHGCI+m/HR9eFBdEh7yHVIOSvldM9sHTVhlw24edZwa+fd KXZsbr89EbChoBagHKGLHzUeTUUHMSjT/fMrs/oE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.10 069/100] netfilter: conntrack: dont increment invalid counter on NF_REPEAT Date: Mon, 31 Jan 2022 11:56:30 +0100 Message-Id: <20220131105222.755280957@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Westphal [ Upstream commit 830af2eba40327abec64325a5b08b1e85c37a2e0 ] The packet isn't invalid, REPEAT means we're trying again after cleaning out a stale connection, e.g. via tcp tracker. This caused increases of invalid stat counter in a test case involving frequent connection reuse, even though no packet is actually invalid. Fixes: 56a62e2218f5 ("netfilter: conntrack: fix NF_REPEAT handling") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_conntrack_core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index f4cf26b606f92..8369af0c50eab 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -1832,15 +1832,17 @@ repeat: pr_debug("nf_conntrack_in: Can't track with proto module\n"); nf_conntrack_put(&ct->ct_general); skb->_nfct = 0; - NF_CT_STAT_INC_ATOMIC(state->net, invalid); - if (ret == -NF_DROP) - NF_CT_STAT_INC_ATOMIC(state->net, drop); /* Special case: TCP tracker reports an attempt to reopen a * closed/aborted connection. We have to go back and create a * fresh conntrack. */ if (ret == -NF_REPEAT) goto repeat; + + NF_CT_STAT_INC_ATOMIC(state->net, invalid); + if (ret == -NF_DROP) + NF_CT_STAT_INC_ATOMIC(state->net, drop); + ret = -ret; goto out; } -- 2.34.1