958e1b
From e892a0cc154fecadbd209c4cac1ebcc9208173d9 Mon Sep 17 00:00:00 2001
2382db
From: Amos Kong <akong@redhat.com>
2382db
Date: Mon, 4 Aug 2014 04:12:07 +0200
958e1b
Subject: [PATCH 1/4] virtio-net: Do not filter VLANs without F_CTRL_VLAN
2382db
2382db
Message-id: <1407125528-27862-2-git-send-email-akong@redhat.com>
2382db
Patchwork-id: 60415
2382db
O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 1/2] virtio-net: Do not filter VLANs without F_CTRL_VLAN
958e1b
Bugzilla: 1065724
2382db
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
2382db
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
2382db
RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com>
2382db
2382db
From: Stefan Fritsch <sf@sfritsch.de>
2382db
2382db
If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all
2382db
VLAN-tagged packets but send them to the guest.
2382db
2382db
This fixes VLANs with OpenBSD guests (and probably NetBSD, too, because
2382db
the OpenBSD driver started as a port from NetBSD).
2382db
2382db
Signed-off-by: Stefan Fritsch <sf@sfritsch.de>
2382db
Signed-off-by: Amos Kong <akong@redhat.com>
2382db
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
2382db
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2382db
(cherry picked from commit 0b1eaa8803e680de9a05727355dfe3d306b81e17)
958e1b
---
958e1b
 hw/net/virtio-net.c |    6 ++++++
958e1b
 1 files changed, 6 insertions(+), 0 deletions(-)
958e1b
2382db
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
2382db
---
2382db
 hw/net/virtio-net.c |    6 ++++++
2382db
 1 files changed, 6 insertions(+), 0 deletions(-)
2382db
2382db
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
2382db
index f72be9f..8e58139 100644
2382db
--- a/hw/net/virtio-net.c
2382db
+++ b/hw/net/virtio-net.c
2382db
@@ -490,6 +490,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
2382db
         }
2382db
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
2382db
     }
2382db
+
2382db
+    if ((1 << VIRTIO_NET_F_CTRL_VLAN) & features) {
2382db
+        memset(n->vlans, 0, MAX_VLAN >> 3);
2382db
+    } else {
2382db
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
2382db
+    }
2382db
 }
2382db
 
2382db
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
2382db
-- 
2382db
1.7.1
2382db