qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] virtio-net VLAN filtering bug
@ 2014-02-05 21:06 Stefan Fritsch
  2014-02-12 21:46 ` [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN Stefan Fritsch
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Fritsch @ 2014-02-05 21:06 UTC (permalink / raw)
  To: qemu-devel

Hi,

if the feature VIRTIO_NET_F_CTRL_VLAN is not negotiated, virtio-net should 
not filter VLANs. That means it should send all packets to the guest 
instead of dropping all packets that have any VLAN id. The following patch 
fixes the issue.

Cheers,
Stefan


--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -312,13 +312,16 @@ static void virtio_net_reset(VirtIODevice *vdev)
     n->mac_table.first_multi = 0;
     n->mac_table.multi_overflow = 0;
     n->mac_table.uni_overflow = 0;
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
     memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
     qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
-    memset(n->vlans, 0, MAX_VLAN >> 3);
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN))
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    else
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
 }
 
 static void peer_test_vnet_hdr(VirtIONet *n)
 {
     NetClientState *nc = qemu_get_queue(n->nic);
     if (!nc->peer) {
@@ -512,12 +515,17 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
         }
         if (!tap_get_vhost_net(nc->peer)) {
             continue;
         }
         vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
     }
+
+    if (vdev->guest_features & (1 << VIRTIO_NET_F_CTRL_VLAN))
+        memset(n->vlans, 0, MAX_VLAN >> 3);
+    else
+        memset(n->vlans, 0xff, MAX_VLAN >> 3);
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
                                      struct iovec *iov, unsigned int iov_cnt)
 {
     uint8_t on;

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-03-25 10:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-05 21:06 [Qemu-devel] virtio-net VLAN filtering bug Stefan Fritsch
2014-02-12 21:46 ` [Qemu-devel] [PATCH] virtio-net: Do not filter VLANs without F_CTRL_VLAN Stefan Fritsch
2014-02-16 10:33   ` Michael S. Tsirkin
2014-02-17 14:57     ` Eric Blake
2014-02-17 21:31     ` Stefan Fritsch
2014-02-21  9:58   ` Amos Kong
2014-02-23  8:27     ` Stefan Fritsch
2014-02-25  3:06       ` Amos Kong
2014-03-19 22:38         ` Stefan Fritsch
2014-03-25  9:39           ` Amos Kong
2014-03-25 10:08             ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).