All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Doug Evans <dje@google.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH v3 0/3]
Date: Thu, 11 Feb 2021 09:12:03 +0000	[thread overview]
Message-ID: <20210211091203.GA1302824@redhat.com> (raw)
In-Reply-To: <CADPb22Sdk1Ao5wGFBEiJ2mNqeRfo81vp1U1gXYA9caf9Ht1n4g@mail.gmail.com>

On Wed, Feb 10, 2021 at 02:40:17PM -0800, Doug Evans wrote:
> On Wed, Feb 10, 2021 at 8:49 AM Daniel P. Berrangé <berrange@redhat.com>
> wrote:
> 
> > On Wed, Feb 10, 2021 at 08:31:40AM -0800, Doug Evans wrote:
> > > On Wed, Feb 10, 2021 at 1:31 AM Daniel P. Berrangé <berrange@redhat.com>
> > > wrote:
> > >
> > > > On Tue, Feb 09, 2021 at 06:16:57PM -0800, Doug Evans wrote:
> > > > > On Thu, Feb 4, 2021 at 10:25 AM Doug Evans <dje@google.com> wrote:
> > > > >
> > > > > > On Thu, Feb 4, 2021 at 2:03 AM Daniel P. Berrangé <
> > berrange@redhat.com
> > > > >
> > > > > > wrote:
> > > > > >
> > > > > >> On Wed, Feb 03, 2021 at 03:35:36PM -0800, dje--- via wrote:
> > > > > >> > Add support for ipv6 host forwarding
> > > > > >> >
> > > > > >> > This patchset takes the original patch from Maxim,
> > > > > >> >
> > https://www.mail-archive.com/qemu-devel@nongnu.org/msg569573.html
> > > > > >> > and updates it.
> > > > > >> >
> > > > > >> > New option: -ipv6-hostfwd
> > > > > >> >
> > > > > >> > New commands: ipv6_hostfwd_add, ipv6_hostfwd_remove
> > > > > >> >
> > > > > >> > These are the ipv6 equivalents of their ipv4 counterparts.
> > > > > >>
> > > > > >> Before I noticed this v3, I send a reply to your v2 sugesting
> > > > > >> that we don't need to add any new commands/options. We can
> > > > > >> use existing inet_parse() helper function to parse the address
> > > > > >> info and transparently support IPv4/6 in the existing commands
> > > > > >> and options. This matches normal practice elsewhere in QEMU
> > > > > >> for IP dual stack.
> > > > > >>
> > > > > >
> > > > > > I'm all for this, fwiw.
> > > > > >
> > > > >
> > > > >
> > > > > I should say I'm all for not adding new commands/options.
> > > > > Looking at inet_parse() it cannot be used as-is.
> > > > > The question then becomes: Will refactoring it buy enough?
> > > >
> > > > What's the problem your hitting with inet_parse ?
> > > >
> > >
> > >
> > > First, this is the inet_parse() function we're talking about, right?
> > >
> > > int inet_parse(InetSocketAddress *addr, const char *str, Error **errp)
> > >
> > >
> > https://gitlab.com/qemu-project/qemu/-/blob/master/util/qemu-sockets.c#L618
> >
> > Yes, that's right.
> >
> 
> 
> Thanks, just wanted to be sure.
> 
> The syntax it supports is not the same as what's needed for host forwarding.
> inet_parse: address:port,option1,option2 (where options are to=,ipv4,etc).
> hostfwd: address:port-address:port
> If we wanted to have a utility that parsed "address:port" for v4+v6 then
> we'd have to split the "address:port" part out of inet_parse.
> 
> Plus the way inet_parse() parses the address, which is fine for its
> purposes, is with sscanf.
> Alas the terminating character is not the same (',' vs '-').
> IWBN to retain passing sscanf a constant format string so that the compiler
> can catch various errors,
> and if one keeps that then any kind of refactor loses some appeal.
> [Though one could require all callers to accept either ',' or '-' as the
> delimiter.]

I think the key useful part to keep common impl for is the handling
of the [] brackets for IPv6 raw addrs. I'd suggest we try to pull the
"address:port" part out into a new inet_addr_parse() helper that can be
called from inet_pase and from slirp.

inet_parse() can split on the first ",", and then call inet_addr_parse
on the first segment.

slirp can split on "-", and call inet_addr_parse with both segments.


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 :|



  reply	other threads:[~2021-02-11  9:14 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 23:35 [PATCH v3 0/3] dje--- via
2021-02-03 23:35 ` [PATCH v3 1/3] slirp: Placeholder for libslirp ipv6 hostfwd support dje--- via
2021-02-04 16:02   ` Eric Blake
2021-02-04 16:40     ` Doug Evans
2021-02-04 16:40   ` Marc-André Lureau
2021-02-03 23:35 ` [PATCH v3 2/3] net/slirp.c: Refactor address parsing dje--- via
2021-02-03 23:35 ` [PATCH v3 3/3] net: Add -ipv6-hostfwd option, ipv6_hostfwd_add/remove commands dje--- via
2021-02-03 23:45 ` [PATCH v3 0/3] no-reply
2021-02-04 10:03 ` Daniel P. Berrangé
2021-02-04 18:25   ` Doug Evans
2021-02-10  2:16     ` Doug Evans
2021-02-10  9:31       ` Daniel P. Berrangé
2021-02-10 16:31         ` Doug Evans
2021-02-10 16:49           ` Daniel P. Berrangé
2021-02-10 22:40             ` Doug Evans
2021-02-11  9:12               ` Daniel P. Berrangé [this message]
2021-02-18 20:30                 ` Doug Evans
  -- strict thread matches above, loose matches on Subject: below --
2024-10-07 15:19 Abhash Jha
2021-06-21 15:16 [PATCH v2 0/3] bundle.c: remove "ref_list" in favor of string-list.c API Ævar Arnfjörð Bjarmason
2021-06-30 14:06 ` [PATCH v3 0/3] Ævar Arnfjörð Bjarmason
2021-06-30 17:34   ` Jeff King
2021-06-30 17:45     ` Jeff King
2021-06-30 18:00       ` Ævar Arnfjörð Bjarmason
2021-07-01 10:53         ` Ævar Arnfjörð Bjarmason
2020-05-08 15:22 Yordan Karadzhov (VMware)
2018-11-11 23:58 [PATCH v2 0/2] refactoring branch colorization to ref-filter nbelakovski
2018-12-16 21:57 ` [PATCH v3 0/3] nbelakovski
2018-12-18 17:25   ` Jeff King
2016-07-15 11:01 Kefeng Wang
2016-08-09 16:01 ` Andy Shevchenko
2016-08-10  5:36   ` Kefeng Wang
2016-08-19  6:26     ` Kefeng Wang
2016-08-22 11:32       ` Andy Shevchenko
2012-11-26 15:19 Jacob Pan
2012-02-16 22:14 [PATCH v2 1/3] Move the user-facing test library to test-lib-functions.sh Junio C Hamano
2012-02-17 10:25 ` [PATCH v3 0/3] Thomas Rast
2012-02-17 17:03   ` Junio C Hamano
2012-02-17 23:28     ` Junio C Hamano
2012-02-18  0:51       ` Jeff King
2012-02-18  7:27         ` Junio C Hamano
2012-02-18  8:52           ` Jeff King

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=20210211091203.GA1302824@redhat.com \
    --to=berrange@redhat.com \
    --cc=dje@google.com \
    --cc=qemu-devel@nongnu.org \
    --cc=samuel.thibault@ens-lyon.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.