qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Samuel Thibault <samuel.thibault@gnu.org>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Marc-André Lureau" <marcandre.lureau@gmail.com>
Subject: Re: [PATCH v4 2/4] util/qemu-sockets.c: Split host:port parsing out of inet_parse
Date: Fri, 5 Mar 2021 13:51:25 -0800	[thread overview]
Message-ID: <CADPb22S+zaLrGb8ht05p6SosmJKAJUrBfUD5K9FUxSvJuvouLA@mail.gmail.com> (raw)
In-Reply-To: <20210305212806.kx62ycfr7k4wxdlq@begin>

[-- Attachment #1: Type: text/plain, Size: 3256 bytes --]

On Fri, Mar 5, 2021 at 1:28 PM Samuel Thibault <samuel.thibault@gnu.org>
wrote:

> Daniel P. Berrangé, le mer. 03 mars 2021 18:11:41 +0000, a ecrit:
> > On Wed, Mar 03, 2021 at 10:06:50AM -0800, Doug Evans wrote:
> > > On Sun, Feb 28, 2021 at 1:40 PM Samuel Thibault <
> samuel.thibault@gnu.org>
> > > wrote:
> > >
> > > > > +  Examples:
> > > > > +  hostfwd_add net0 tcp:127.0.0.1:10022-:22
> > > > > +  hostfwd_add net0 tcp:[::1]:10022-[fe80::1:2:3:4]:22
> > > >
> > > > Yep, that looks good to me.
> > >
> > > Daniel, you wanted me to use inet_parse().
> > > Is the above syntax ok with you?
> > > You must have had some expectation that at least some of
> > > the various flags that inet_parse() recognizes would be needed here.
> >
> > It feels like the ,ipv4=on|off,ipv6=on|off flags are relevant here,
> > especially in the empty address case. eg
> >
> >    tcp::10022          - attempt to listen on both ipv4 + ipv6
> >    tcp::10022,ipv4=off - listen on default address, but only for ipv6
> >    tcp::10022,ipv6=off - listen on default address, but only for ipv4
> >
> > Basically this ends up bringing the hostfwd stuff into alignment with
> > the way other backends deal with this
>
> I'm fine with this yes, better have a coherent user interface.
>

Cool. Here's the current help text I have:

---snip---
#ifdef CONFIG_SLIRP
    {
        .name       = "hostfwd_add",
        .args_type  = "arg1:s,arg2:s?",
        .params     = "[netdev_id]
[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport",
        .help       = "redirect TCP or UDP connections from host to guest
(requires -net user)",
        .cmd        = hmp_hostfwd_add,
    },
#endif
SRST
``hostfwd_add``
  Redirect TCP or UDP connections from host to guest (requires -net user).
  IPv6 addresses are wrapped in square brackets, IPv4 addresses are not.

  Examples:
  hostfwd_add net0 tcp:127.0.0.1:10022-:22
  hostfwd_add net0 tcp:[::1]:10022-[fe80::1:2:3:4]:22

  Empty host addresses:
  An empty address for the host, expressed as either "" or "[]", is
  interpreted as listen at any address for both IPv4 and IPv6. To listen on
  only IPv4 one can use "0.0.0.0". The equivalent IPv6 address, "[::]", is
  interpreted as listen on both IPv4 and IPv6 addresses. To listen on only
  IPv6 addresses, add ",ipv4=off" to the address. E.g.,
  hostfwd_add net0 tcp::10022,ipv4=off-[fe80::1:2:3:4]:22
  hostfwd_add net0 tcp:[]:10022,ipv4=off-[fe80::1:2:3:4]:22
  hostfwd_add net0 tcp:[::]:10022,ipv4=off-[fe80::1:2:3:4]:22
  And similarly for IPv4 only:
  hostfwd_add net0 tcp::10022,ipv6=off-[fe80::1:2:3:4]:22
  hostfwd_add net0 tcp:[]:10022,ipv6=off-[fe80::1:2:3:4]:22

  Empty guest addresses:
  An empty guest address for IPv4 is translated to the guest's address,
  assuming that the guest is using DHCP to acquire its address.
  Note that Libslirp currently only provides a "stateless" DHCPv6 server, a
  consequence of which is that it cannot do the "addr-any" translation to
the
  guest address that is done for IPv4. In other words, the following is
  currently not supported: hostfwd_add net0 tcp::10022-:22, the guest
  address is required.
ERST
---snip---

Any corrections or suggestions?

[-- Attachment #2: Type: text/html, Size: 4567 bytes --]

  reply	other threads:[~2021-03-05 21:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 20:15 [PATCH v4 0/4] Add support for ipv6 host forwarding Doug Evans via
2021-02-18 20:15 ` [PATCH v4 1/4] slirp: Advance libslirp submodule to add ipv6 host-forward support Doug Evans via
2021-02-19  9:38   ` Daniel P. Berrangé
2021-02-19 21:43     ` Doug Evans
2021-02-18 20:15 ` [PATCH v4 2/4] util/qemu-sockets.c: Split host:port parsing out of inet_parse Doug Evans via
2021-02-19 10:00   ` Daniel P. Berrangé
2021-02-19 22:17     ` Doug Evans
2021-02-22  9:39       ` Daniel P. Berrangé
2021-02-23 18:23         ` Doug Evans
2021-02-28 21:39         ` Samuel Thibault
2021-02-28 22:20           ` Samuel Thibault
2021-03-01  8:15           ` Markus Armbruster
2021-03-01  8:31             ` Samuel Thibault
2021-03-01 16:07           ` Doug Evans
2021-03-01 16:26             ` Samuel Thibault
2021-03-01 20:39               ` Samuel Thibault
2021-03-01 16:23           ` Doug Evans
2021-03-01 16:27             ` Samuel Thibault
2021-03-01 21:05               ` Samuel Thibault
2021-03-03 18:06           ` Doug Evans
2021-03-03 18:11             ` Daniel P. Berrangé
2021-03-05 21:28               ` Samuel Thibault
2021-03-05 21:51                 ` Doug Evans [this message]
2021-03-05 22:21                   ` Doug Evans
2021-03-06  0:05                 ` Doug Evans
2021-03-06  0:10                   ` Samuel Thibault
2021-03-06  1:00                     ` Doug Evans
2021-03-06 19:29                       ` Samuel Thibault
2021-03-14 19:52                         ` Doug Evans
2021-02-18 20:15 ` [PATCH v4 3/4] net/slirp.c: Refactor address parsing Doug Evans via
2021-02-18 20:15 ` [PATCH v4 4/4] net: Extend host forwarding to support IPv6 Doug Evans via
2021-02-18 20:34 ` [PATCH v4 0/4] Add support for ipv6 host forwarding no-reply

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=CADPb22S+zaLrGb8ht05p6SosmJKAJUrBfUD5K9FUxSvJuvouLA@mail.gmail.com \
    --to=dje@google.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=samuel.thibault@gnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).