summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/net.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/net.c b/net/net.c
index 6362d3077c..6a2c3d9567 100644
--- a/net/net.c
+++ b/net/net.c
@@ -412,10 +412,14 @@ void qemu_del_nic(NICState *nic)
qemu_macaddr_set_free(&nic->conf->macaddr);
- /* If this is a peer NIC and peer has already been deleted, free it now. */
- if (nic->peer_deleted) {
- for (i = 0; i < queues; i++) {
- qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
+ for (i = 0; i < queues; i++) {
+ NetClientState *nc = qemu_get_subqueue(nic, i);
+ /* If this is a peer NIC and peer has already been deleted, free it now. */
+ if (nic->peer_deleted) {
+ qemu_free_net_client(nc->peer);
+ } else if (nc->peer) {
+ /* if there are RX packets pending, complete them */
+ qemu_purge_queued_packets(nc->peer);
}
}