@@ -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;