HomeFreeBSD

bhyve: Add a slirp network backend

Description

bhyve: Add a slirp network backend

This enables a subset of the functionality provided by QEMU's user
networking implementation. In particular, it uses net/libslirp, the
same library as QEMU.

libslirp is permissively licensed but has some dependencies which make
it impractical to bring into the base system (glib in particular). I
thus opted to make bhyve dlopen the libslirp.so, which can be installed
via pkg. The library header is imported into bhyve.

The slirp backend takes a "hostfwd" which is identical to QEMU's
hostfwd. When configured, bhyve opens a host socket and listens for
connections, which get forwarded to the guest. For instance,
"hostfwd=tcp::1234-:22" allows one to ssh into the guest by ssh'ing to
port 1234 on the host, e.g., via 127.0.0.1. I didn't try to hook up
guestfwd support since I don't personally have a use-case for it yet,
and I think it won't interact nicely with the capsicum sandbox.

Reviewed by: jhb
Tested by: rew
MFC after: 1 month
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D42510

(cherry picked from commit c5359e2af5ab582f9a0b862ce90ad3962f9f1d03)

Details

Provenance
markjAuthored on Nov 22 2023, 7:11 PM
Reviewer
jhb
Differential Revision
D42510: bhyve: Add a slirp network backend
Parents
rGac83f3fa44f3: tcp: properly unroll SACK transmission on TX error with LRD
Branches
Unknown
Tags
Unknown