From: Mark McLoughlin <[email protected]>

If you do e.g. "set_link virtio.0 down" and there are packets
pending on the tap interface, we currently buffer a packet
and constantly try and send it until the link is up again.

We actually just want to drop the packet if the NIC is down.
Upstream qemu already does this, we just differ because we
buffer packets from the tap interface.

Reported-by: Yan Vugenfirer <[email protected]>
Signed-off-by: Mark McLoughlin <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>

diff --git a/net.c b/net.c
index 36fa354..16f6e48 100644
--- a/net.c
+++ b/net.c
@@ -411,8 +411,10 @@ qemu_deliver_packet(VLANClientState *sender, const uint8_t 
*buf, int size)
     int ret = -EAGAIN;
 
     for (vc = sender->vlan->first_client; vc != NULL; vc = vc->next) {
-        if (vc != sender && !vc->link_down) {
-            if (!vc->fd_can_read || vc->fd_can_read(vc->opaque)) {
+        if (vc != sender) {
+            if (vc->link_down) {
+                ret = 0;
+            } else if (!vc->fd_can_read || vc->fd_can_read(vc->opaque)) {
                 vc->fd_read(vc->opaque, buf, size);
                 ret = 0;
             }
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to