Skip to content

Commit

Permalink
virtio-net: Do not filter VLANs without F_CTRL_VLAN
Browse files Browse the repository at this point in the history
If VIRTIO_NET_F_CTRL_VLAN is not negotiated, do not filter out all
VLAN-tagged packets but send them to the guest.

This fixes VLANs with OpenBSD guests (and probably NetBSD, too, because
the OpenBSD driver started as a port from NetBSD).

Signed-off-by: Stefan Fritsch <sf@sfritsch.de>
Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 0b1eaa8)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
s-fritsch authored and mdroth committed Jun 25, 2014
1 parent 0fd56fb commit 11088ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/net/virtio-net.c
Expand Up @@ -515,6 +515,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
}
vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
}

if ((1 << VIRTIO_NET_F_CTRL_VLAN) & features) {
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,
Expand Down

0 comments on commit 11088ab

Please sign in to comment.