mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
filter-rewriter: Add TCP state machine and fix memory leak in connection_track_table
We add almost full TCP state machine in filter-rewriter, except TCPS_LISTEN and some simplify in VM active close FIN states. The reason for this simplify job is because guest kernel will track the TCP status and wait 2MSL time too, if client resend the FIN packet, guest will resend the last ACK, so we needn't wait 2MSL time in filter-rewriter. After a net connection is closed, we didn't clear its related resources in connection_track_table, which will lead to memory leak. Let's track the state of net connection, if it is closed, its related resources will be cleared up. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Zhang Chen <zhangckid@gmail.com> Signed-off-by: Zhang Chen <chen.zhang@intel.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
77f7c74719
commit
6214231abd
3 changed files with 104 additions and 16 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "slirp/slirp.h"
|
||||
#include "qemu/jhash.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "slirp/tcp.h"
|
||||
|
||||
#define HASHTABLE_MAX_SIZE 16384
|
||||
|
||||
|
@ -81,11 +82,9 @@ typedef struct Connection {
|
|||
uint32_t sack;
|
||||
/* offset = secondary_seq - primary_seq */
|
||||
tcp_seq offset;
|
||||
/*
|
||||
* we use this flag update offset func
|
||||
* run once in independent tcp connection
|
||||
*/
|
||||
int syn_flag;
|
||||
|
||||
int tcp_state; /* TCP FSM state */
|
||||
tcp_seq fin_ack_seq; /* the seq of 'fin=1,ack=1' */
|
||||
} Connection;
|
||||
|
||||
uint32_t connection_key_hash(const void *opaque);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue