On Mon, Jul 07, 2025 at 10:15:04AM +0200, Laurent Vivier wrote: > This commit introduces support for passt as a new network backend. > passt is an unprivileged, user-mode networking solution that provides > connectivity for virtual machines by launching an external helper process. > > The implementation reuses the generic stream data handling logic. It > launches the passt binary using GSubprocess, passing it a file > descriptor from a socketpair() for communication. QEMU connects to > the other end of the socket pair to establish the network data stream. > > The PID of the passt daemon is tracked via a temporary file to > ensure it is terminated when QEMU exits. > > Signed-off-by: Laurent Vivier <lviv...@redhat.com> > --- > docs/system/devices/net.rst | 40 +++++- > hmp-commands.hx | 3 + > meson.build | 6 + > meson_options.txt | 2 + > net/clients.h | 4 + > net/hub.c | 3 + > net/meson.build | 3 + > net/net.c | 4 + > net/passt.c | 241 ++++++++++++++++++++++++++++++++++ > qapi/net.json | 25 ++++ > qemu-options.hx | 44 ++++++- > scripts/meson-buildoptions.sh | 3 + > 12 files changed, 374 insertions(+), 4 deletions(-) > create mode 100644 net/passt.c
snip > +There is no need to start the daemon as QEMU will do it for you. > + > +passt is started in the socket-based mode. > + > +.. parsed-literal:: > + |qemu_system| [...OPTIONS...] -nic passt > + > + (qemu) info network > + e1000e.0: index=0,type=nic,model=e1000e,macaddr=52:54:00:12:34:56 > + \ #net071: index=0,type=passt,stream,connected to pid 24846 > + > +.. parsed-literal:: > + |qemu_system| [...OPTIONS...] -net nic -net > passt,param=--tcp-ports=10001,param=udp-ports=10001 Missing '--' before 'udp-ports=', but ... > diff --git a/qapi/net.json b/qapi/net.json > index 97ea1839813b..8a8528ba1f47 100644 > --- a/qapi/net.json > +++ b/qapi/net.json > @@ -112,6 +112,26 @@ > 'data': { > 'str': 'str' } } > > +## > +# @NetDevPasstOptions: > +# > +# Unprivileged user-mode network connectivity using passt > +# > +# @path: Filename of the passt program to run (by default 'passt', and use > PATH) > +# > +# @quiet: don't print informational messages (default, passed as '--quiet') > +# > +# @param: parameter to pass to passt command > +# > +# Since: 10.1 > +## > +{ 'struct': 'NetDevPasstOptions', > + 'data': { > + '*path': 'str', > + '*quiet': 'bool', > + '*param': ['String'] }, > + 'if': 'CONFIG_PASST' } .... IMHO this is a really horrible way to wire this up into QEMU, which largely defeats the benefit of having a passt network backend. It throws away all type validation of passt parameters at the QEMU level, which is one of the more compelling aspects of using QAPI/QMP, especially on the JSON side. One the CLI side, the argv is really horrible to read, even by QEMU's low-standards. I'd much rather see v2 of this patchset. If users need to have full control over every conceivable passt option at all times, then the existing way passt is used with QEMU continues to exist and isn't significantly more complicated than this v3 series. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|