From patchwork Wed Dec 23 11:23:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1420105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=OAoq+hZI; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D19tP1Vm3z9sVm for ; Wed, 23 Dec 2020 22:27:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 32B0685E2B; Wed, 23 Dec 2020 11:27:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qde9kTm7ohU0; Wed, 23 Dec 2020 11:27:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id CA1FA85742; Wed, 23 Dec 2020 11:27:52 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 99FDCC1825; Wed, 23 Dec 2020 11:27:52 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6DDC4C0893 for ; Wed, 23 Dec 2020 11:27:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5FF7F8720B for ; Wed, 23 Dec 2020 11:27:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ajmnRZDffigm for ; Wed, 23 Dec 2020 11:27:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) by hemlock.osuosl.org (Postfix) with ESMTPS id D6D0A871E9 for ; Wed, 23 Dec 2020 11:27:49 +0000 (UTC) Received: by mail-oi1-f174.google.com with SMTP id s2so17955446oij.2 for ; Wed, 23 Dec 2020 03:27:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=NU0hLfZMuWSqJrpaPIScEyXfftk0dhZV+3QoxRLhVLo=; b=OAoq+hZIXRndTeAnFfIbNZ2rxiuI+Ajm3qCvxJjbbMPZp6FS11ffZBo7gZZa/Jt7kk edGrY2oa0b0gOSkFzYDD5Yew19w+BGyWWJVimjzFK6f44LCdUwO7RQeBI2om3lqwvETf IWgDo7b+88XgI4afOC/kV3Oku0YNBcZzOc0YaFtNX+qnGm2dNwJzpTcCN08p1edeo2XK 3rYLRZ8wg59XApCHcKUcYM4f1+PXXYEW8+QEgYe+jldjw1MCJLELcFmuD6QSgJJH6E6c xK2fX+xrxMoz6cLmlOBetOtoGx3uAE1pJm7wvgUPUweINTsUszhj87lUkAe6r4UZiLxd YFYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NU0hLfZMuWSqJrpaPIScEyXfftk0dhZV+3QoxRLhVLo=; b=JFTXQScUJXU7zQt+e2z4S50/+E2NrVmtS9xn26jmU+iJygORXlfL305TOlANiqbbRo aM0tquyQou80zjSI21gcAGrrJIWOf4ul/K4RjQh5ioyrW4aqZTX63OaPSLjtaq+enftB 7DRXlG+Wtx8nLnfptFMJsFGPNQkFuJY6yQr4FqtrWVrvIEsJcIVu4gcprBKtcTnkpUST agnX7WxXgaPiqtHotap+VzdfSZzDtXr9ZTx6CRF6Q5ijCSE7IdGixrlH8mf8/slqrDTN FcWMR/HehenMIGPDGJ/yD9ileGwod+KUo16S448LzvpdN4gPzFAejGvb2Zk+uLq7yQq+ vssA== X-Gm-Message-State: AOAM5300k4lKlxC5Sm9hSHbxOxC1To5NuU3t9DKxrstyu3MkX3sUXqAR /w/4LyjIm3A94hVdwk7oLSk= X-Google-Smtp-Source: ABdhPJy48TGEAWlGq4ZY6D021MdpOFW+l9F1JP7AWlaKVcTNehB3OBK9i8Ka3Vv4Al6G0Q8z2dCSDA== X-Received: by 2002:aca:5a42:: with SMTP id o63mr16492583oib.69.1608722869187; Wed, 23 Dec 2020 03:27:49 -0800 (PST) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id 59sm5105465oti.69.2020.12.23.03.27.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Dec 2020 03:27:48 -0800 (PST) From: xiangxia.m.yue@gmail.com To: i.maximets@ovn.org, blp@ovn.org Date: Wed, 23 Dec 2020 19:23:53 +0800 Message-Id: <20201223112353.63526-1-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 2.15.0 Cc: Daniele Di Proietto , ovs-dev@openvswitch.org Subject: [ovs-dev] [PATCH ovs] conntrack: Update the icmp stats accurately. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang The same icmp packet may traverse conntrack module more than once. Or same icmp packets traverse contranck module in orderly. Don't change stats to CS_ESTABLISHED before receiving reply or related packets. Fixes: b269a1229df2 ("conntrack: Track ICMP type and code.") Cc: Daniele Di Proietto Signed-off-by: Tonghao Zhang --- lib/conntrack-icmp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/conntrack-icmp.c b/lib/conntrack-icmp.c index 9b7263011..7e24d90a5 100644 --- a/lib/conntrack-icmp.c +++ b/lib/conntrack-icmp.c @@ -59,13 +59,16 @@ icmp_conn_update(struct conntrack *ct, struct conn *conn_, struct dp_packet *pkt OVS_UNUSED, bool reply, long long now) { struct conn_icmp *conn = conn_icmp_cast(conn_); + enum ct_update_res ret = CT_UPDATE_VALID; if (reply && conn->state == ICMPS_FIRST) { conn->state = ICMPS_REPLY; + } else if (conn->state == ICMPS_FIRST) { + ret = CT_UPDATE_VALID_NEW; } conn_update_expiration(ct, &conn->up, icmp_timeouts[conn->state], now); - return CT_UPDATE_VALID; + return ret; } static bool