From nobody Sun Feb 8 02:16:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542339912559949.7388127104867; Thu, 15 Nov 2018 19:45:12 -0800 (PST) Received: from localhost ([::1]:42023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNV4B-0001JM-DP for importer@patchew.org; Thu, 15 Nov 2018 22:45:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNV2s-0000j9-PU for qemu-devel@nongnu.org; Thu, 15 Nov 2018 22:43:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNV2s-0007mM-4k for qemu-devel@nongnu.org; Thu, 15 Nov 2018 22:43:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47224) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNV2o-0007jn-B9 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 22:43:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9FC3C05D3F4; Fri, 16 Nov 2018 03:43:38 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-23.pek2.redhat.com [10.72.12.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A65A6129F; Fri, 16 Nov 2018 03:43:35 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 16 Nov 2018 11:43:31 +0800 Message-Id: <1542339811-18549-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1542339811-18549-1-git-send-email-jasowang@redhat.com> References: <1542339811-18549-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 16 Nov 2018 03:43:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL] net/filter-rewriter.c: Fix coverity static analysis issue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Chen The original code just follow the TCP state diagram, but in this case, we can skip the TCPS_TIME_WAIT state to simplify the implementation. Signed-off-by: Zhang Chen Signed-off-by: Jason Wang --- net/filter-rewriter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index bb8f4d9..2e26839 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -155,12 +155,13 @@ static int handle_primary_tcp_pkt(RewriterState *rf, * Active close step 2. */ if (conn->tcp_state =3D=3D TCPS_FIN_WAIT_1) { - conn->tcp_state =3D TCPS_TIME_WAIT; /* * For simplify implementation, we needn't wait 2MSL time * in filter rewriter. Because guest kernel will track the * TCP status and wait 2MSL time, if client resend the FIN * packet, guest will apply the last ACK too. + * So, we skip the TCPS_TIME_WAIT state here and go straight + * to TCPS_CLOSED state. */ conn->tcp_state =3D TCPS_CLOSED; g_hash_table_remove(rf->connection_track_table, key); --=20 2.5.0