diff mbox

Remove VLAN client on network connection close

Message ID 623FF5F796BC1248BD72BE2383C52FAF7AD08B2C4E@il-ex01.ad.checkpoint.com
State New
Headers show

Commit Message

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

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

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.

Thanks,
Boris.

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

Signed-off-by: Boris Sukholitko <boriss@checkpoint.com>
---
diff mbox

Patch

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)
     eoc:
         qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
         closesocket(s->fd);
+        qemu_del_vlan_client(s->vc);
         return;
     }
     buf = buf1;