From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJaaB-0005rf-6e for qemu-devel@nongnu.org; Thu, 17 Jul 2008 17:00:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJaaA-0005qE-Jp for qemu-devel@nongnu.org; Thu, 17 Jul 2008 17:00:10 -0400 Received: from [199.232.76.173] (port=43798 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJaaA-0005q3-Am for qemu-devel@nongnu.org; Thu, 17 Jul 2008 17:00:10 -0400 Received: from savannah.gnu.org ([199.232.41.3]:35667 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KJaaA-0008HU-4r for qemu-devel@nongnu.org; Thu, 17 Jul 2008 17:00:10 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KJaa8-0007Zo-Gx for qemu-devel@nongnu.org; Thu, 17 Jul 2008 21:00:08 +0000 Received: from balrog by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KJaa7-0007Yi-7M for qemu-devel@nongnu.org; Thu, 17 Jul 2008 21:00:08 +0000 MIME-Version: 1.0 Errors-To: balrog Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Andrzej Zaborowski Message-Id: Date: Thu, 17 Jul 2008 21:00:07 +0000 Subject: [Qemu-devel] [4885] Remove the NIC from vlan on usb destroy. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4885 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4885 Author: balrog Date: 2008-07-17 21:00:05 +0000 (Thu, 17 Jul 2008) Log Message: ----------- Remove the NIC from vlan on usb destroy. Modified Paths: -------------- trunk/hw/usb-net.c trunk/net.h trunk/vl.c Modified: trunk/hw/usb-net.c =================================================================== --- trunk/hw/usb-net.c 2008-07-17 20:47:13 UTC (rev 4884) +++ trunk/hw/usb-net.c 2008-07-17 21:00:05 UTC (rev 4885) @@ -1418,7 +1418,8 @@ { USBNetState *s = (USBNetState *) dev; - /* FIXME: delete the VLAN client and the nic */ + /* TODO: remove the nd_table[] entry */ + qemu_del_vlan_client(s->vc); rndis_clear_responsequeue(s); qemu_free(s); } Modified: trunk/net.h =================================================================== --- trunk/net.h 2008-07-17 20:47:13 UTC (rev 4884) +++ trunk/net.h 2008-07-17 21:00:05 UTC (rev 4885) @@ -28,6 +28,7 @@ IOReadHandler *fd_read, IOCanRWHandler *fd_can_read, void *opaque); +void qemu_del_vlan_client(VLANClientState *vc); int qemu_can_send_packet(VLANClientState *vc); void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size); void qemu_handler_true(void *opaque); Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2008-07-17 20:47:13 UTC (rev 4884) +++ trunk/vl.c 2008-07-17 21:00:05 UTC (rev 4885) @@ -3870,6 +3870,19 @@ return vc; } +void qemu_del_vlan_client(VLANClientState *vc) +{ + VLANClientState **pvc = &vc->vlan->first_client; + + while (*pvc != NULL) + if (*pvc == vc) { + *pvc = vc->next; + free(vc); + break; + } else + pvc = &(*pvc)->next; +} + int qemu_can_send_packet(VLANClientState *vc1) { VLANState *vlan = vc1->vlan;