[Qemu-devel] [PATCH] net/filter-rewirter.c: Fix coverity static analysis issue

Zhang Chen posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181030035030.4542-1-zhangckid@gmail.com
Test docker-clang@ubuntu passed
Test checkpatch passed
Test asan passed
Test docker-quick@centos7 passed
net/filter-rewriter.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH] net/filter-rewirter.c: Fix coverity static analysis issue
Posted by Zhang Chen 7 years ago
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>
---
 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.GIT


Re: [Qemu-devel] [PATCH] net/filter-rewirter.c: Fix coverity static analysis issue
Posted by Peter Maydell 7 years ago
On 30 October 2018 at 03:50, Zhang Chen <zhangckid@gmail.com> wrote:
> 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>
> ---
>  net/filter-rewriter.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

NB: typo in Subject: s/rewirter/rewriter/

Hopefully whoever commits this patch can fix that up for you.

thanks
-- PMM

Re: [Qemu-devel] [PATCH] net/filter-rewirter.c: Fix coverity static analysis issue
Posted by Zhang Chen 7 years ago
Oh, Sorry.
I will send the V2 patch.

Thank
Zhang Chen

On Wed, Oct 31, 2018 at 12:18 AM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On 30 October 2018 at 03:50, Zhang Chen <zhangckid@gmail.com> wrote:
> > 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>
> > ---
> >  net/filter-rewriter.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
>
> NB: typo in Subject: s/rewirter/rewriter/
>
> Hopefully whoever commits this patch can fix that up for you.
>
> thanks
> -- PMM
>