qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: "Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"Daniel P . Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH v6 3/4] net/slirp.c: Refactor address parsing
Date: Thu, 15 Apr 2021 08:36:32 -0700	[thread overview]
Message-ID: <CADPb22QwStkJ_M+E08fAid457+UxmCxdCQ86RgqwBRe3w_zHGQ@mail.gmail.com> (raw)
In-Reply-To: <20210415033925.1290401-4-dje@google.com>

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

On Wed, Apr 14, 2021 at 8:40 PM Doug Evans <dje@google.com> wrote:

> ... in preparation for adding ipv6 host forwarding support.
>
> Tested:
> avocado run tests/acceptance/hostfwd.py
>
> Signed-off-by: Doug Evans <dje@google.com>
> ---
>
> [...]
>
> diff --git a/tests/acceptance/hostfwd.py b/tests/acceptance/hostfwd.py
> new file mode 100644
> index 0000000000..9b9db142c3
> --- /dev/null
> +++ b/tests/acceptance/hostfwd.py
> @@ -0,0 +1,91 @@
> [...]
> +
> +    def test_qmp_hostfwd_ipv4_parsing_errors(self):
> +        """Verify handling of various kinds of parsing errors."""
> +        self.vm.add_args('-nodefaults',
> +                         '-netdev', 'user,id=vnet',
> +                         '-device', 'virtio-net,netdev=vnet')
> +        self.vm.launch()
> +        self.assertEquals(self.hmc('hostfwd_remove abc::42'),
> +                          "Invalid format: bad protocol name 'abc'\r\n")
> +        self.assertEquals(self.hmc('hostfwd_add abc::65022-:22'),
> +                          "Invalid host forwarding rule 'abc::65022-:22'"
> + \
> +                          " (bad protocol name 'abc')\r\n")
> +        self.assertEquals(self.hmc('hostfwd_add :foo'),
> +                          "Invalid host forwarding rule ':foo'" + \
> +                          " (missing host-guest separator)\r\n")
> +        self.assertEquals(self.hmc('hostfwd_add :a.b.c.d:66-:66'),
> +                          "Invalid host forwarding rule
> ':a.b.c.d:66-:66'" + \
> +                          " (For host address: address resolution failed
> for" \
> +                          " 'a.b.c.d:66': Name or service not known)\r\n")
> +        self.assertEquals(self.hmc('hostfwd_add ::66-a.b.c.d:66'),
> +                          "Invalid host forwarding rule
> '::66-a.b.c.d:66'" + \
> +                          " (For guest address: address resolution
> failed" + \
> +                          " for 'a.b.c.d:66': Name or service not
> known)\r\n")
> +        self.assertEquals(self.hmc('hostfwd_add ::-1-foo'),
> +                          "Invalid host forwarding rule '::-1-foo'" + \
> +                          " (For host address: error parsing port in" + \
> +                          " address ':')\r\n")
> +        self.assertEquals(self.hmc('hostfwd_add ::66-foo'),
> +                          "Invalid host forwarding rule '::66-foo' (For"
> + \
> +                          " guest address: error parsing address
> 'foo')\r\n")
> +        self.assertEquals(self.hmc('hostfwd_add ::66-:0'),
> +                          "Invalid host forwarding rule '::66-:0'" + \
> +                          " (For guest address: invalid port '0')\r\n")
>


One improvement I think I'd like to make here is that I'm not sure how
portable the text of the result of, e.g., gai_strerror() is,
and relax the expected text of the error messages in the potentially
host-specific part.
But I'll wait until everything else is reviewed.

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

  reply	other threads:[~2021-04-15 15:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15  3:39 [PATCH v6 0/4] Add support for ipv6 host forwarding Doug Evans
2021-04-15  3:39 ` [PATCH v6 1/4] slirp: Advance libslirp submodule to add ipv6 host-forward support Doug Evans
2021-05-07 15:23   ` Marc-André Lureau
2021-05-07 15:46     ` Doug Evans
2021-05-12 16:42       ` Doug Evans
2021-05-12 17:18         ` Marc-André Lureau
2021-05-12 19:50           ` Doug Evans
2021-05-12 20:14             ` Marc-André Lureau
2021-04-15  3:39 ` [PATCH v6 2/4] util/qemu-sockets.c: Split host:port parsing out of inet_parse Doug Evans
2021-05-07 15:23   ` Marc-André Lureau
2021-05-25 19:37     ` RFC: IPv6 hostfwd command line syntax [was Re: [PATCH v6 2/4] util/qemu-sockets.c: Split host:port parsing out of inet_parse] Doug Evans
2021-05-26 13:57       ` Daniel P. Berrangé
2021-05-26 15:26         ` Doug Evans
2021-05-26 15:29           ` Daniel P. Berrangé
2021-04-15  3:39 ` [PATCH v6 3/4] net/slirp.c: Refactor address parsing Doug Evans
2021-04-15 15:36   ` Doug Evans [this message]
2021-05-07 15:29   ` Marc-André Lureau
2021-04-15  3:39 ` [PATCH v6 4/4] net: Extend host forwarding to support IPv6 Doug Evans
2021-04-29  3:37 ` [PATCH v6 0/4] Add support for ipv6 host forwarding Doug Evans
2021-05-05 15:21   ` Doug Evans
2021-05-05 16:13     ` Philippe Mathieu-Daudé
2021-05-05 16:15       ` Philippe Mathieu-Daudé

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=CADPb22QwStkJ_M+E08fAid457+UxmCxdCQ86RgqwBRe3w_zHGQ@mail.gmail.com \
    --to=dje@google.com \
    --cc=berrange@redhat.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 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).