[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] virtio-net VLAN filtering bug
From: |
Stefan Fritsch |
Subject: |
[Qemu-devel] virtio-net VLAN filtering bug |
Date: |
Wed, 5 Feb 2014 22:06:09 +0100 (CET) |
User-agent: |
Alpine 2.02 (DEB 1266 2009-07-14) |
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;
- [Qemu-devel] virtio-net VLAN filtering bug,
Stefan Fritsch <=