Skip to contentSkip to conversation

Remove VLAN client on network connection close

PATCH New Boris Sukholitko 1 participant 1 message Nov 23, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 623FF5F796BC1248BD72BE2383C52FAF7AD08B2C4D@il-ex01.ad.checkpoint.com

#1 lore raw

PATCH 1/1 Remove VLAN client on network connection close

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.

---

net.c +1 -0
index 9ea66e3..951b9a4 100644
@@ -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;