]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
net/filter-rewriter.c: Fix coverity static analysis issue
authorZhang Chen <zhangckid@gmail.com>
Wed, 31 Oct 2018 00:50:15 +0000 (08:50 +0800)
committerJason Wang <jasowang@redhat.com>
Fri, 16 Nov 2018 03:08:26 +0000 (11:08 +0800)
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 <zhangckid@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/filter-rewriter.c

index bb8f4d93b117c2f5dde0b2446c596f8aab612f64..2e26839bc26f5425128e643f3a2ffa6029a87222 100644 (file)
@@ -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);