1
0
mirror of https://passt.top/passt synced 2024-09-28 10:05:47 +00:00

passt, qrap, README: Update notes and documentation for AF_UNIX support in qemu

We can't get rid of qrap quite yet, but at least we should start
telling users it's not going to be needed anymore starting from qemu
7.2.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-11-04 02:38:31 +01:00
parent 6c1697764c
commit 11efaefa1e
5 changed files with 18 additions and 28 deletions

View File

@ -368,13 +368,11 @@ speeding up local connections, and usually requiring NAT. _pasta_:
## Interfaces and Environment ## Interfaces and Environment
_passt_ exchanges packets with _qemu_ via UNIX domain socket, using the `socket` _passt_ exchanges packets with _qemu_ via UNIX domain socket, using the `socket`
back-end in qemu. Currently, qemu can only connect to a listening process via back-end in qemu. This is supported since qemu 7.2.
TCP. Two temporary solutions are available:
* a [patch](/passt/tree/qemu) for qemu For older versions, the [qrap](/passt/tree/qrap.c) wrapper can be used to
* a wrapper, [qrap](/passt/tree/qrap.c), that connects to a connect to a UNIX domain socket and to start qemu, which can now use the file
UNIX domain socket and starts qemu, which can now use the file descriptor descriptor that's already opened.
that's already opened
This approach, compared to using a _tap_ device, doesn't require any security This approach, compared to using a _tap_ device, doesn't require any security
capabilities, as we don't need to create any interface. capabilities, as we don't need to create any interface.

View File

@ -51,12 +51,8 @@ one peer's observed parameters (congestion window size, acknowledged data, etc.)
to the corresponding peer. to the corresponding peer.
Currently, the only supported hypervisor is \fBqemu\fR(1), connecting to Currently, the only supported hypervisor is \fBqemu\fR(1), connecting to
\fBpasst\fR by means of a UNIX domain socket. This configuration can be obtained \fBpasst\fR by means of a UNIX domain socket. This is supported starting from
via out-of-tree qemu patches, available at: qemu 7.2. For older qemu versions, see the \fBqrap\fR(1) wrapper.
\fIhttps://passt.top/passt/tree/contrib/qemu\fR
or with the \fBqrap\fR(1) wrapper.
.SS pasta .SS pasta

13
qrap.1
View File

@ -5,7 +5,7 @@
.SH NAME .SH NAME
.B qrap .B qrap
\- qemu wrapper connecting UNIX domain socket to file descriptor \- temporary qemu wrapper connecting UNIX domain socket to file descriptor
.SH SYNOPSIS .SH SYNOPSIS
.B qrap .B qrap
@ -47,13 +47,10 @@ $ ./qrap test.qcow2 -m 1024 -display none -nodefaults -nographic
.SH NOTES .SH NOTES
This wrapper is temporary and needed only as long as \fBqemu\fR(1) does not This wrapper is temporary: qemu commit 13c6be96618c ("net: stream: add unix
directly support a UNIX domain socket as \fInetdev\fR back-end. socket") introduces native AF_UNIX socket support, and it should be included in
qemu starting from the 7.2 release. It will be around for a little bit longer to
Out-of-tree patches for \fBqemu\fR(1) introducing support for a UNIX domain give users enough time to switch.
socket back-end are available at:
\fIhttps://passt.top/passt/tree/contrib/qemu\fR
.SH AUTHOR .SH AUTHOR

5
qrap.c
View File

@ -7,8 +7,9 @@
* Copyright (c) 2020-2021 Red Hat GmbH * Copyright (c) 2020-2021 Red Hat GmbH
* Author: Stefano Brivio <sbrivio@redhat.com> * Author: Stefano Brivio <sbrivio@redhat.com>
* *
* TODO: Implement this functionality directly in qemu: we have TCP and UDP * TODO: Drop this implementation once qemu commit 13c6be96618c ("net: stream:
* socket back-ends already. * add unix socket") is included in a release (7.2), and once we can reasonably
* assume existing users switched to it.
*/ */
#include <stdio.h> #include <stdio.h>

10
tap.c
View File

@ -944,13 +944,11 @@ static void tap_sock_unix_init(struct ctx *c)
ev.events = EPOLLIN | EPOLLET | EPOLLRDHUP; ev.events = EPOLLIN | EPOLLET | EPOLLRDHUP;
epoll_ctl(c->epollfd, EPOLL_CTL_ADD, c->fd_tap_listen, &ev); epoll_ctl(c->epollfd, EPOLL_CTL_ADD, c->fd_tap_listen, &ev);
info("You can now start qrap:"); info("You can now start qemu (>= 7.2, with commit 13c6be96618c):");
info(" ./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio"); info(" kvm ... -device virtio-net-pci,netdev=s -netdev stream,id=s,server=off,addr.type=unix,addr.path=%s",
info("or directly qemu, patched with:");
info(" qemu/0001-net-Allow-also-UNIX-domain-sockets-to-be-used-as-net.patch");
info("as follows:");
info(" kvm ... -net socket,connect=%s -net nic,model=virtio",
addr.sun_path); addr.sun_path);
info("or qrap, for earlier qemu versions:");
info(" ./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio");
} }
/** /**