On 05/06/2016 06:56 PM, Zhang Chen wrote:
Signed-off-by: Zhang Chen <zhangchen.f...@cn.fujitsu.com> Signed-off-by: Li Zhijian <lizhij...@cn.fujitsu.com> Signed-off-by: Wen Congyang <we...@cn.fujitsu.com> --- include/net/net.h | 8 ++++++ net/filter-mirror.c | 60 ++++++++------------------------------------ net/net.c | 56 ++++++++++++++++++++++++++++++++++++++++++ net/socket.c | 71 +++++++++++++---------------------------------------- 4 files changed, 91 insertions(+), 104 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 73e4c46..1439cf9 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -102,6 +102,14 @@ typedef struct NICState { bool peer_deleted; } NICState; +typedef struct ReadState { + int state; /* 0 = getting length, 1 = getting data */ + uint32_t index; + uint32_t packet_len; + uint8_t buf[NET_BUFSIZE]; +} ReadState; + +int net_fill_rstate(ReadState *rs, const uint8_t *buf, int size); char *qemu_mac_strdup_printf(const uint8_t *macaddr); NetClientState *qemu_find_netdev(const char *id); int qemu_find_net_clients_except(const char *id, NetClientState **ncs, diff --git a/net/filter-mirror.c b/net/filter-mirror.c index c0c4dc6..bcec509 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -40,10 +40,7 @@ typedef struct MirrorState { char *outdev; CharDriverState *chr_in; CharDriverState *chr_out; - int state; /* 0 = getting length, 1 = getting data */ - unsigned int index; - unsigned int packet_len; - uint8_t buf[REDIRECTOR_MAX_LEN];
you may need to remove 'REDIRECTOR_MAX_LEN' defination too. Thanks Li Zhijian