FreeBSD The Power to Serve

VirtIO Sockets and AF_VSOCK support

Contact: Danilo Egea Gondolfo <danilo@FreeBSD.org>

The VirtIO Socket device is used to enable communication between guests and host without networking. The AF_VSOCK protocol family enables it to be used through the sockets API.

For the past many months I have been working on a guest driver for the VirtIO Socket device and an implementation of the AF_VSOCK protocol family. Originally, I wanted to get the lxd-agent daemon working on FreeBSD but the communication with the LXD host daemon is done through VSOCKs. LXD is a nice container and virtual machine manager based on Linux/KVM and my end goal is to make FreeBSD a LXD first-class citizen.

At the moment I have it working well enough to enable the lxd-agent to work. I adapted the golang.org/x/sys library and the lxd-agent to support AF_VSOCK on FreeBSD. Features such as command execution, interactive consoles and file transfer are working.

On Linux, AF_VSOCK can be used with VirtIO, HyperV and VMware sockets as transports. I am trying to design my implementation so it will also be possible to use it with different transports in the future.

After getting the current work in a good shape, ideas for future work include integration of AF_VSOCK and HyperV Sockets (which is already supported on FreeBSD through AF_HYPERV), VIRTIO_VSOCK_F_SEQPACKET, VirtIO Socket device for bhyve and the host side of the driver.

I will continue to slowly work on this on my limited free time and hopefully have something more concrete for the next time. There is still a lot of work to be done until it become ready for code review.


Last modified on: September 22, 2024 by Danilo Egea Gondolfo