Page MenuHomeFreeBSD

bhyve: add support for ng_device network backend
ClosedPublic

Authored by quentin.thebault_defenso.fr on Sep 15 2025, 3:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 4, 3:49 AM
Unknown Object (File)
Tue, Dec 2, 2:10 AM
Unknown Object (File)
Mon, Dec 1, 9:08 AM
Unknown Object (File)
Sun, Nov 30, 9:20 PM
Unknown Object (File)
Sat, Nov 29, 5:10 AM
Unknown Object (File)
Fri, Nov 28, 8:07 PM
Unknown Object (File)
Thu, Nov 27, 5:25 PM
Unknown Object (File)
Thu, Nov 27, 3:26 PM

Details

Summary

Signed-off-by: Quentin Thébault <quentin.thebault@defenso.fr>
Sponsored by: Defenso

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 67034
Build 63917: arc lint + arc unit

Event Timeline

The bhyve.8 man page needs to be updated to mention the new backend.

usr.sbin/bhyve/net_backends.c
123

The && should be on the previous line.

Added bhyve.8 changes and fixed if syntax.

quentin.thebault_defenso.fr added inline comments.
usr.sbin/bhyve/net_backends.c
123

Done, thank you.

quentin.thebault_defenso.fr marked an inline comment as done.

Removed superfluous Xo and Xc in bhyve.8

tap_init() will open the device and add it to the mevent loop, which uses kevent() under the hood. But, ng_device doesn't implement d_kqfilter, i.e., ngd_cdevsw doesn't have a d_kqfilter implementation, in contrast with tap devices. How does bhyve know when to read packets from the device?

usr.sbin/bhyve/bhyve.8
551 ↗(On Diff #162128)

New sentences should start on new lines.

tap_init() will open the device and add it to the mevent loop, which uses kevent() under the hood. But, ng_device doesn't implement d_kqfilter, i.e., ngd_cdevsw doesn't have a d_kqfilter implementation, in contrast with tap devices. How does bhyve know when to read packets from the device?

Please have a look at parent revision D52541, which adds kevent support to ng_device.

tap_init() will open the device and add it to the mevent loop, which uses kevent() under the hood. But, ng_device doesn't implement d_kqfilter, i.e., ngd_cdevsw doesn't have a d_kqfilter implementation, in contrast with tap devices. How does bhyve know when to read packets from the device?

Please have a look at parent revision D52541, which adds kevent support to ng_device.

Aha! :) I left some comments there.

This diff looks ok to me.

usr.sbin/bhyve/bhyve.8
549 ↗(On Diff #162128)
quentin.thebault_defenso.fr marked an inline comment as done.

Add reference to netgraph(4)

This looks ok to me, but it depends on the other revision, which is as-yet unfinished.

This revision is now accepted and ready to land.Oct 17 2025, 4:55 PM