aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bhyve
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r--usr.sbin/bhyve/bhyve.826
-rw-r--r--usr.sbin/bhyve/net_backends.c19
2 files changed, 41 insertions, 4 deletions
diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8
index c902c265da9e..27e067f50394 100644
--- a/usr.sbin/bhyve/bhyve.8
+++ b/usr.sbin/bhyve/bhyve.8
@@ -1,3 +1,6 @@
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
.\" Copyright (c) 2013 Peter Grehan
.\" All rights reserved.
.\"
@@ -22,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd August 21, 2024
+.Dd October 28, 2025
.Dt BHYVE 8
.Os
.Sh NAME
@@ -125,7 +128,7 @@ xAPIC mode is the default setting so this option is redundant.
It will be deprecated in a future version.
.It Fl C
Include guest memory in core files.
-.It Fl c Op Ar setting ...
+.It Fl c Oo Oo Cm cpus= Oc Ns Ar numcpus Oc Ns Oo Cm ,sockets= Ns Ar n Oc Ns Oo Cm ,cores= Ns Ar n Oc Ns Oo Cm ,threads= Ns Ar n Oc
Number of guest virtual CPUs
and/or the CPU topology.
The default value for each of
@@ -518,6 +521,8 @@ considered unconnected.
.Op Cm \&,mtu= Ar N
.Xc
.It
+.Cm ngd Ar N
+.It
.Xo
.Cm netgraph,path= Ar ADDRESS Cm \&,peerhook= Ar HOOK
.Op Cm \&,socket= Ar NAME
@@ -542,6 +547,19 @@ The MAC address is an ASCII string in
.Xr ethers 5
format.
.Pp
+A
+.Cm ngd
+device can be used to connect a guest to a
+.Xr netgraph 4
+through a
+.Xr ng_device 4
+node.
+This can be used to run bhyve in a
+.Xr VNET 9
+jail, and give it access to the host's netgraph, that cannot be reached
+directly, by exposing the ng_device through
+.Xr devfs 8 .
+.Pp
With
.Cm virtio-net
devices, the
@@ -572,7 +590,9 @@ must comply with
.Xr netgraph 4
addressing rules.
.Pp
-The slirp backend can be used to provide a NATed network to the guest.
+The
+.Cm slirp
+backend can be used to provide a NATed network to the guest.
This backend has poor performance but does not require any network
configuration on the host system.
It depends on the
diff --git a/usr.sbin/bhyve/net_backends.c b/usr.sbin/bhyve/net_backends.c
index 2d11c45f217a..95909d1f8ea2 100644
--- a/usr.sbin/bhyve/net_backends.c
+++ b/usr.sbin/bhyve/net_backends.c
@@ -119,7 +119,8 @@ tap_init(struct net_backend *be, const char *devname,
goto error;
}
- if (ioctl(be->fd, VMIO_SIOCSIFFLAGS, up)) {
+ if (strncmp("ngd", be->prefix, 3) &&
+ ioctl(be->fd, VMIO_SIOCSIFFLAGS, up)) {
EPRINTLN("tap device link up failed");
goto error;
}
@@ -273,8 +274,24 @@ static struct net_backend vmnet_backend = {
.set_cap = tap_set_cap,
};
+/* A clone of the tap backend, with a different prefix. */
+static struct net_backend ngd_backend = {
+ .prefix = "ngd",
+ .priv_size = sizeof(struct tap_priv),
+ .init = tap_init,
+ .cleanup = tap_cleanup,
+ .send = tap_send,
+ .peek_recvlen = tap_peek_recvlen,
+ .recv = tap_recv,
+ .recv_enable = tap_recv_enable,
+ .recv_disable = tap_recv_disable,
+ .get_cap = tap_get_cap,
+ .set_cap = tap_set_cap,
+};
+
DATA_SET(net_backend_set, tap_backend);
DATA_SET(net_backend_set, vmnet_backend);
+DATA_SET(net_backend_set, ngd_backend);
int
netbe_legacy_config(nvlist_t *nvl, const char *opts)