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