Commit dcf414d638254dd6201e3adc74b535b060894d53

Authored by balrog
1 parent 6c9f886c

Remove the NIC from vlan on usb destroy.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4885 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 3 changed files with 16 additions and 1 deletions
hw/usb-net.c
... ... @@ -1418,7 +1418,8 @@ static void usb_net_handle_destroy(USBDevice *dev)
1418 1418 {
1419 1419 USBNetState *s = (USBNetState *) dev;
1420 1420  
1421   - /* FIXME: delete the VLAN client and the nic */
  1421 + /* TODO: remove the nd_table[] entry */
  1422 + qemu_del_vlan_client(s->vc);
1422 1423 rndis_clear_responsequeue(s);
1423 1424 qemu_free(s);
1424 1425 }
... ...
... ... @@ -28,6 +28,7 @@ VLANClientState *qemu_new_vlan_client(VLANState *vlan,
28 28 IOReadHandler *fd_read,
29 29 IOCanRWHandler *fd_can_read,
30 30 void *opaque);
  31 +void qemu_del_vlan_client(VLANClientState *vc);
31 32 int qemu_can_send_packet(VLANClientState *vc);
32 33 void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
33 34 void qemu_handler_true(void *opaque);
... ...
... ... @@ -3870,6 +3870,19 @@ VLANClientState *qemu_new_vlan_client(VLANState *vlan,
3870 3870 return vc;
3871 3871 }
3872 3872  
  3873 +void qemu_del_vlan_client(VLANClientState *vc)
  3874 +{
  3875 + VLANClientState **pvc = &vc->vlan->first_client;
  3876 +
  3877 + while (*pvc != NULL)
  3878 + if (*pvc == vc) {
  3879 + *pvc = vc->next;
  3880 + free(vc);
  3881 + break;
  3882 + } else
  3883 + pvc = &(*pvc)->next;
  3884 +}
  3885 +
3873 3886 int qemu_can_send_packet(VLANClientState *vc1)
3874 3887 {
3875 3888 VLANState *vlan = vc1->vlan;
... ...