From: Samuel Thibault <samuel.thibault@gnu.org>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Gavin Li" <gavin.li@samsara.com>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Jason Wang" <jasowangio@gmail.com>
Subject: Re: [PATCH v1] net: add per-connection guestfwd unix support
Date: Sat, 14 Nov 2026 23:37:15 +0100 [thread overview]
Message-ID: <avjim5JwouXNASfm@end> (raw)
In-Reply-To: <avXZcIP3t8DExhse@redhat.com>
Hello,
Daniel P. Berrangé, le jeu. 12 nov. 2026 15:21:20 +0000, a ecrit:
> On Fri, Nov 06, 2026 at 11:42:25PM -0500, Gavin Li wrote:
> > For -netdev user,guestfwd=..., add support for unix-per-connection: in
> > addition to the currently supported tcp: and cmd:. With
> > unix-per-connection:, a new connection is opened to the given unix
> > socket. This is an improvement over the current unix: support, which
> > does not support 1:1 guest:host connections.
>
> I'm not familiar with guestfwd, but from the manpage, I would
> rather assume that it always opens a new connection to the host
> socket for each guest connection.
No, qemu opens the unix socket at initialization and just forwards data
to it.
> What are its current semantics when two guest connections are
> initiated on the same port, if that's not happening ?
It's just mixing the data coming from the connections into the unix
connection, and sending all data from the unix connection to one of the
tcp connection.
> > diff --git a/net/slirp.c b/net/slirp.c
> > index 451c0fd1ba..b0b03b2bf5 100644
> > --- a/net/slirp.c
> > +++ b/net/slirp.c
> > @@ -1159,6 +1159,12 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp)
> > "forwarding rule '%s'", config_str);
> > return -1;
> > }
> > + } else if (g_str_has_prefix(p, "unix-per-connection:")) {
>
> This is rather a mouthful as a parameter name,
It seemed a bit long to me too.
> and including '-' in the name is undesirable, since we're already
> using '-' as a general separator.
That's indeed a no-go.
> Could it be just 'unix' to match the use of 'unix' in hostfwd ?
That would prevent from being able to get the one-unix-connection
behavior.
Samuel
> > + if (slirp_add_unix(s->slirp, &p[20], &server, port) < 0) {
> > + error_setg(errp, "Conflicting/invalid host:port in guest "
> > + "forwarding rule '%s'", config_str);
> > + return -1;
> > + }
> > } else {
> > Error *err = NULL;
> > /*
> > diff --git a/qemu-options.hx b/qemu-options.hx
> > index 5fe9d73eaa..062cd39aa3 100644
> > --- a/qemu-options.hx
> > +++ b/qemu-options.hx
> > @@ -3553,6 +3553,15 @@ SRST
> > # and connect the TCP stream to its stdin/stdout
> > |qemu_system| -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
> >
> > + ``guestfwd=[tcp]:server:port-unix-per-connection:path``
> > + With ``unix-per-connection:``, a new connection is opened to the
> > + given unix socket per TCP connection made by the guest. The unix socket
> > + need not exist at startup time.
>
> I think the existing docs probably benefit from an update to
> better show how the new parmeter is different from what I
> would think was already the semantics.
>
> > +
> > + .. parsed-literal::
> > +
> > + |qemu_system| -nic user,guestfwd=tcp:10.0.2.100:1234-unix-per-connection:/tmp/socket
> > +
> > ``-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper]``
> > Configure a host TAP network backend with ID id.
> >
> >
> > base-commit: 71f25c75417d31c214ba2cd26b273c114fc99987
> > --
> > 2.55.0
> >
prev parent reply other threads:[~2026-11-14 22:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 4:42 [PATCH v1] net: add per-connection guestfwd unix support Gavin Li
2026-11-07 22:07 ` Samuel Thibault
2026-11-12 15:21 ` Daniel P. Berrangé
2026-11-14 22:37 ` Samuel Thibault [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avjim5JwouXNASfm@end \
--to=samuel.thibault@gnu.org \
--cc=berrange@redhat.com \
--cc=gavin.li@samsara.com \
--cc=jasowangio@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.