From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHeii-0005Cn-PV for qemu-devel@nongnu.org; Tue, 30 Oct 2018 20:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHeid-0002Vs-Ou for qemu-devel@nongnu.org; Tue, 30 Oct 2018 20:50:52 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:34079) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHeid-0001tK-H7 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 20:50:47 -0400 Received: by mail-pf1-x441.google.com with SMTP id f78-v6so6728441pfe.1 for ; Tue, 30 Oct 2018 17:50:27 -0700 (PDT) From: Zhang Chen Date: Wed, 31 Oct 2018 08:50:15 +0800 Message-Id: <20181031005015.5433-1-zhangckid@gmail.com> Subject: [Qemu-devel] [PATCH V2] net/filter-rewriter.c: Fix coverity static analysis issue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Peter Maydell , Jason Wang Cc: Zhang Chen , 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 --- 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 bb8f4d93b1..2e26839bc2 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 == TCPS_FIN_WAIT_1) { - conn->tcp_state = 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 = TCPS_CLOSED; g_hash_table_remove(rf->connection_track_table, key); -- 2.17.1