[vbox-dev] Host-only networking and INTNETTRUNKDIR_WIRE

Ed Maste emaste at freebsd.org
Thu Aug 30 18:54:02 GMT 2012


I have an issue with host-only networking that's a little confusing to
explain, so I'll provide the background first and then explain the
issue.

The configuration I'm testing is VirtualBox 4.1.18 on FreeBSD 9.1.
(The guest is also FreeBSD, but is unrelated to the issue.)  I've
created a host-only network, and am trying to communicate with my
virtual machine via libpcap and thus BPF reads and writes to the
vboxnet0 interface.  This mostly works, except that the BPF
"direction" is set based on the destination MAC of the packet.  If it
equals that of vboxnet0 the packet is reported by BPF as a received
packet, and if the MAC does not match it's reported as a transmitted
packet.  This doesn't really make sense: transmitted packets should
have come from the host's stack.

It appears that VirtualBox calls vboxNetFltPortOsXmit with fDst set to
INTNETTRUNKDIR_HOST if the MAC address matches that of the vboxnet
interface, or INTNETTRUNKDIR_WIRE otherwise.  To me this seems
undesirable in the case of a host-only network, where there really is
no 'wire' and all packets ought to be destined to/from the host.

I could implement something in the FreeBSD VBoxNetFlt and VBoxNetAdp
drivers for this, but it seems like it's a general issue.  Should
VirtualBox always set fDst to INTNETTRUNKDIR_HOST for host-only
interfaces?

-Ed




More information about the vbox-dev mailing list