Remove VLAN client on network connection close
diff mbox

Message ID
State New
Headers show

Commit Message

Boris Sukholitko Nov. 23, 2009, 12:23 p.m. UTC

I am seeing funny QEMU behaviour when using "-net socket,listen"

When connecting and disconnecting several clients I start
to get duplicated packets from QEMU server.

IMHO, the following is happenning:
1. Client is disconnected: we get into net_socket_send callback.
2. net_socket_send does closesocket on the fd.
3. Note, that VLANClientState is not being removed.
4. New client is getting the same fd as the old client.
5. At this stage we have two VLANClientState's with the same fd.
6. From now on, every packet is being sent twice by qemu_vlan_deliver_packet.

It seems that the fix would be to qemu_del_vlan_client on stage 3. It certainly
fixes my problem.


PS. Please CC me as I am not subscribed to the list.

Signed-off-by: Boris Sukholitko <>

diff mbox

diff --git a/net.c b/net.c
index 9ea66e3..951b9a4 100644
--- a/net.c
+++ b/net.c
@@ -1440,6 +1440,7 @@  static void net_socket_send(void *opaque)
         qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
+        qemu_del_vlan_client(s->vc);
     buf = buf1;