Howdy,

I was looking into trunking VLANs into a virtual machine via bridging, and 
noted that transmit of 802.1q tagged packets worked from the guest VM, but upon 
reception, the VLAN tag seemed to be stripped before the packets hit the 
guest's interface.

Taking a look at the netgraph-based bridging implementation, it looks like the 
VLAN tag is not being re-inserted at the head of the ethernet frame prior to 
handing off the to VirtualBox, and VBox doesn't seem to have an equivalent 
'ether_vtag' field in its INTNETSG struct to handle this.

Thus, to preserve the VLAN tag, I modified vboxNetFltFreeBSDMBufToSG() to 
ether_vlanencap() to insert the VLAN tag before handing off to VBox. With this 
in place, I was able to successfully trunk VLANs to a virtual machine. 

Some caveats:
        - If using virtio-kmod's if_vtnet, you must set vlanhwfilter (or 
promisc) flags on the guest interface before virtualbox will pass the VLAN 
tagged packets through. Otherwise, the VBox virtio-net device implementation 
will filter out the incoming packets before handing them to the VM hardware.
        - VBox's em(4) host implementation does not appear to support 
'hardware' VLAN tagging, but it does declare it. If using a em(4) virtualized 
NIC, you must set -vlanhwtag on the guest interface.

I welcome someone(s) with more experience than I eyeballing the (tiny) attached 
patch. I'm also especially concerned as to whether this should be considered 
supported functionality in VBox, or I'm just getting lucky with the virtio-net 
code path.

Thanks,
Landon

Attachment: patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c
Description: Binary data

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-emulation
To unsubscribe, send any mail to "[email protected]"

Reply via email to