Skip to contentSkip to conversation

Add support for ipv6 host forwarding

PATCH In review Doug Evans via 5 participants 10 messages Feb 20, 2021 – Feb 26, 2021 Networking

lore
Share & tools
lore
#0 lore raw

v5 cover Add support for ipv6 host forwarding

This patchset takes the original patch from Maxim,
https://www.mail-archive.com/[email protected]/msg569573.html
and updates it.

Option hostfwd is extended to support ipv6 addresses. Commands hostfwd_add, hostfwd_remove are extended as well.

The libslirp part of the patch has been committed upstream, and is now in qemu. See patch 1/5.

Changes from v4:

1/5 slirp: Advance libslirp submodule to add ipv6 host-forward support NOTE TO REVIEWERS: I need some hand-holding to know what The Right way to submit this particular patch is.

- no change

2/5 util/qemu-sockets.c: Split host:port parsing out of inet_parse

- move recognition of "[]:port" to separate patch
- allow passing NULL for ip_v6
- fix some formatting issues

3/5 inet_parse_host_and_addr: Recognize []:port (empty ipv6 address)

- new in this patchset revision

4/5 net/slirp.c: Refactor address parsing

- was 3/4 in v4
- fix some formatting issues

5/5 net: Extend host forwarding to support IPv6

- was 4/4 in v4
- fix some formatting issues

Changes from v3:

1/4 slirp: Advance libslirp submodule to add ipv6 host-forward support

- pick up latest libslirp patch to reject ipv6 addr-any for guest address
- libslirp currently only provides a stateless DHCPv6 server, which means it can't know in advance what the guest's IP address is, and thus cannot do the "addr-any -> guest ip address" translation that is done for ipv4

2/4 util/qemu-sockets.c: Split host:port parsing out of inet_parse

- this patch is new in v4
- provides new utility: inet_parse_host_and_port, updates inet_parse to use it

3/4 net/slirp.c: Refactor address parsing

- this patch renamed from 2/3 to 3/4
- call inet_parse_host_and_port from util/qemu-sockets.c
- added tests/acceptance/hostfwd.py

4/4 net: Extend host forwarding to support IPv6

- this patch renamed from 3/3 to 4/4
- ipv6 support added to existing hostfwd option, commands
- instead of creating new ipv6 option, commands
- added tests to tests/acceptance/hostfwd.py

Changes from v2:
- split out libslirp commit
- clarify spelling of ipv6 addresses in docs
- tighten parsing of ipv6 addresses

Change from v1:
- libslirp part is now upstream
- net/slirp.c changes split into two pieces (refactor, add ipv6)
- added docs

Doug Evans (5):
slirp: Advance libslirp submodule to add ipv6 host-forward support util/qemu-sockets.c: Split host:port parsing out of inet_parse
inet_parse_host_and_addr: Recognize []:port (empty ipv6 address) net/slirp.c: Refactor address parsing
net: Extend host forwarding to support IPv6

 hmp-commands.hx             |  15 +++
 include/qemu/sockets.h      |   3 +
 net/slirp.c                 | 196 ++++++++++++++++++++++++------------
 slirp                       |   2 +-
 tests/acceptance/hostfwd.py | 174 ++++++++++++++++++++++++++++++++
 util/qemu-sockets.c         |  84 ++++++++++++----
 6 files changed, 390 insertions(+), 84 deletions(-)
 create mode 100644 tests/acceptance/hostfwd.py
Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
#1 lore raw

PATCH v5 1/5 slirp: Advance libslirp submodule to add ipv6 host-forward support

---

Changes from v4:
NOTE TO REVIEWERS: I need some hand-holding to know what The Right way to submit this particular patch is.

- no change

Changes from v3:
- pick up latest libslirp patch to reject ipv6 addr-any for guest address
- libslirp currently only provides a stateless DHCPv6 server, which means it can't know in advance what the guest's IP address is, and thus cannot do the "addr-any -> guest ip address" translation that is done for ipv4

Changes from v2:
- this patch is new in v3, split out from v2

 slirp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
slirp +1 -1
index 8f43a99191..26ae658a83 160000
@@ -1 +1 @@
-Subproject commit 8f43a99191afb47ca3f3c6972f6306209f367ece
+Subproject commit 26ae658a83eeca16780cf5615c8247cbb151c3fa
Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
#2 lore raw

Re: [PATCH v5 1/5] slirp: Advance libslirp submodule to add ipv6 host-forward support

Hi Doug,

On 2/20/21 1:13 AM, Doug Evans via wrote:

When updating submodules, the commit description is a good good place to include the output of:

  $ git shortlog 8f43a99..26ae658

See for example QEMU commit f350d78f102 ("Update SLOF").

Anyhow up to the maintainer merging your patch.

Quoted 30 lines

---

Changes from v4:
NOTE TO REVIEWERS: I need some hand-holding to know what The Right way to submit this particular patch is.

- no change

Changes from v3:
- pick up latest libslirp patch to reject ipv6 addr-any for guest address
- libslirp currently only provides a stateless DHCPv6 server, which means it can't know in advance what the guest's IP address is, and thus cannot do the "addr-any -> guest ip address" translation that is done for ipv4

Changes from v2:
- this patch is new in v3, split out from v2

 slirp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
slirp +1 -1
index 8f43a99191..26ae658a83 160000
@@ -1 +1 @@
-Subproject commit 8f43a99191afb47ca3f3c6972f6306209f367ece
+Subproject commit 26ae658a83eeca16780cf5615c8247cbb151c3fa
#3 lore raw

Re: [PATCH v5 1/5] slirp: Advance libslirp submodule to add ipv6 host-forward support

Quoted 4 lines · Philippe Mathieu-Daudé

Hi Doug,

On 2/20/21 1:13 AM, Doug Evans via wrote:

Quoted 9 lines

When updating submodules, the commit description is a good good place to include the output of:

  $ git shortlog 8f43a99..26ae658

See for example QEMU commit f350d78f102 ("Update SLOF").

Anyhow up to the maintainer merging your patch.

Thanks, that helps a little.
The issue here is that qemu is using branch 4.2 of libslirp, whereas the patch is currently just on libslirp's master branch.
Part of the problem is the commit description, which you've helped with. But what about the functional part of the patch?
I can only get git format-patch to include a commit id, and the only commit id available is on the libslirp master branch.

Is there an additional step I need to do like submit libslirp changes in three parts?
Step 1: Submit patch to libslirp's repo (not qemu's copy, but the libslirp master repo)
Step 2: Submit a patch to libslirp's repo to add the patch to its 4.2 branch Step 2b: Wait for qemu's copy of libslirp's 4.2 branch to appear in qemu's libslirp repo
Step 3: Submit patch to advance qemu's libslirp submodule

I've done steps 1,3, it's just effecting the equivalent of step2 that I'm fuzzy on.

Quoted 33 lines
Quoted 7 lines

---

Changes from v4:
NOTE TO REVIEWERS: I need some hand-holding to know what The Right way to submit this particular patch is.

Quoted 5 lines

- no change

Changes from v3:
- pick up latest libslirp patch to reject ipv6 addr-any for guest address
- libslirp currently only provides a stateless DHCPv6 server, which

means

Quoted 18 lines

it can't know in advance what the guest's IP address is, and thus cannot do the "addr-any -> guest ip address" translation that is done for ipv4

Changes from v2:
- this patch is new in v3, split out from v2

 slirp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
slirp +1 -1
index 8f43a99191..26ae658a83 160000
@@ -1 +1 @@
-Subproject commit 8f43a99191afb47ca3f3c6972f6306209f367ece
+Subproject commit 26ae658a83eeca16780cf5615c8247cbb151c3fa
#4 lore raw

Re: [PATCH v5 1/5] slirp: Advance libslirp submodule to add ipv6 host-forward support

Hi

Quoted 36 lines · Doug Evans
Quoted 4 lines · Philippe Mathieu-Daudé

Hi Doug,

On 2/20/21 1:13 AM, Doug Evans via wrote:

Quoted 9 lines

When updating submodules, the commit description is a good good place to include the output of:

  $ git shortlog 8f43a99..26ae658

See for example QEMU commit f350d78f102 ("Update SLOF").

Anyhow up to the maintainer merging your patch.

Thanks, that helps a little.
The issue here is that qemu is using branch 4.2 of libslirp, whereas the patch is currently just on libslirp's master branch.
Part of the problem is the commit description, which you've helped with. But what about the functional part of the patch?
I can only get git format-patch to include a commit id, and the only commit id available is on the libslirp master branch.

Is there an additional step I need to do like submit libslirp changes in three parts?
Step 1: Submit patch to libslirp's repo (not qemu's copy, but the libslirp master repo)
Step 2: Submit a patch to libslirp's repo to add the patch to its 4.2 branch
Step 2b: Wait for qemu's copy of libslirp's 4.2 branch to appear in qemu's libslirp repo
Step 3: Submit patch to advance qemu's libslirp submodule

Quoted 3 lines

I've done steps 1,3, it's just effecting the equivalent of step2 that I'm fuzzy on.

Only bug fixes should go in libslirp 4.2 branch. You can submit MR against the stable-4.2 branch in gitlab.

We may update qemu to libslirp master while not in freeze (as long as feature versioning is handled correctly, which may be error prone).

I tried to update QEMU to libslirp master some time ago, unfortunately it failed to pass the merge because of the next commit changing the build system (
https://patchew.org/QEMU/[email protected]/[email protected]/).
But just updating libslirp to master should be fine. You can see in the commit message that I use a git tool "cherry-diff" to highlight the differences between the branches.

Quoted 36 lines
Quoted 36 lines
Quoted 4 lines

---

Quoted 8 lines

Changes from v4:
NOTE TO REVIEWERS: I need some hand-holding to know what The Right way to submit this particular patch is.

- no change

Changes from v3:
- pick up latest libslirp patch to reject ipv6 addr-any for guest

address

Quoted 1 line

- libslirp currently only provides a stateless DHCPv6 server, which

means

Quoted 2 lines

it can't know in advance what the guest's IP address is, and thus cannot do the "addr-any -> guest ip address" translation that is

done

Quoted 16 lines

for ipv4

Changes from v2:
- this patch is new in v3, split out from v2

 slirp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
slirp +1 -1
index 8f43a99191..26ae658a83 160000
@@ -1 +1 @@
-Subproject commit 8f43a99191afb47ca3f3c6972f6306209f367ece
+Subproject commit 26ae658a83eeca16780cf5615c8247cbb151c3fa
Signature · 1 line
Marc-André Lureau
#5 lore raw

PATCH v5 2/5 util/qemu-sockets.c: Split host:port parsing out of inet_parse

In reply to Doug Evans via

The parsing is moved into new function inet_parse_host_and_port. This is done in preparation for using the function in net/slirp.c.

---

Changes from v4:
- move recognition of "[]:port" to separate patch
- allow passing NULL for ip_v6
- fix some formatting issues

Changes from v3:
- this patch is new in v4
- provides new utility: inet_parse_host_and_port, updates inet_parse to use it

 include/qemu/sockets.h |  3 ++
 util/qemu-sockets.c    | 80 +++++++++++++++++++++++++++++++-----------
 2 files changed, 62 insertions(+), 21 deletions(-)
include/qemu/sockets.h +3 -0
index 7d1f813576..b1448cfa24 100644
@@ -31,6 +31,9 @@ int socket_set_fast_reuse(int fd);
 
 int inet_ai_family_from_address(InetSocketAddress *addr,
                                 Error **errp);
+const char *inet_parse_host_and_port(const char *str, int terminator,
+                                     char **hostp, char **portp, bool *is_v6,
+                                     Error **errp);
 int inet_parse(InetSocketAddress *addr, const char *str, Error **errp);
 int inet_connect(const char *str, Error **errp);
 int inet_connect_saddr(InetSocketAddress *saddr, Error **errp);
util/qemu-sockets.c +59 -21

103 lines not on this page · raw message

Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
#6 lore raw

PATCH v5 3/5 inet_parse_host_and_addr: Recognize []:port (empty ipv6 address)

In reply to Doug Evans via

Some callers need to distinguish empty ipv4 addresses from ipv6.

---

Changes from v4:
- new in this patchset revision

 util/qemu-sockets.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
util/qemu-sockets.c +6 -2
index 3ca6a6fb3d..062f0eb074 100644
@@ -620,7 +620,8 @@ static int inet_parse_flag(const char *flagname, const char *optstr, bool *val,
  * Terminator may be '\0'.
  * The syntax for IPv4 addresses is: address:port. "address" is optional,
  * and may be empty (i.e., str is ":port").
- * The syntax for IPv6 addresses is: [address]:port. Upon return the wrapping
+ * The syntax for IPv6 addresses is: [address]:port. "address" is optional,
+ * and may be empty (i.e., str is "[]:port"). Upon return the wrapping
  * [] brackets are removed.
  * Host names are also supported as hostname:port. It is up to the caller to
  * distinguish host names from numeric IPv4 addresses.
@@ -654,7 +655,10 @@ const char *inet_parse_host_and_port(const char *str, int terminator,
         }
     } else if (buf[0] == '[') {
         /* IPv6 addr */
-        if (sscanf(buf, "[%64[^]]]:%32s", host, port) != 2) {
+        /* Note: sscanf %[ doesn't recognize empty contents. */
+        if (sscanf(buf, "[]:%32s", port) == 1) {
+            host[0] = '\0';
+        } else if (sscanf(buf, "[%64[^]]]:%32s", host, port) != 2) {
             error_setg(errp, "error parsing IPv6 address '%s'", buf);
             return NULL;
         }
Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
#7 lore raw

PATCH v5 4/5 net/slirp.c: Refactor address parsing

In reply to Doug Evans via

... in preparation for adding ipv6 host forwarding support.

New test: avocado run tests/acceptance/hostfwd.py

---

Changes from v4:
- was 3/4 in v4
- fix some formatting issues

Changes from v3:
- this patch renamed from 2/3 to 3/4
- call inet_parse_host_and_port from util/qemu-sockets.c
- added tests/acceptance/hostfwd.py

Changes from v2:
- nothing of consequence

Changes from v1:
- this patch is new in v2
- address parsing refactor split out, ipv4 changes here
- libslirp part is now upstream in libslirp repo

 net/slirp.c                 | 165 ++++++++++++++++++++++--------------
 tests/acceptance/hostfwd.py |  94 ++++++++++++++++++++
 2 files changed, 196 insertions(+), 63 deletions(-)
 create mode 100644 tests/acceptance/hostfwd.py
net/slirp.c +102 -63
index be914c0be0..e0284492b9 100644
@@ -631,15 +631,91 @@ static SlirpState *slirp_lookup(Monitor *mon, const char *id)
     }
 }
 
+/*
+ * Parse a protocol name of the form "name<sep>".
+ * Valid protocols are "tcp" and "udp". An empty string means "tcp".
+ * Returns a pointer to the end of the parsed string on success, and stores
+ * the result in *is_udp.
+ * Otherwise returns NULL and stores the error in *errp.
+ */
+static const char *parse_protocol(const char *str, int sep, bool *is_udp,
+                                  Error **errp)
+{
+    char buf[10];
+    const char *p = str;
+
+    if (get_str_sep(buf, sizeof(buf), &p, sep) < 0) {
+        error_setg(errp, "Missing protocol name separator");
+        return NULL;
+    }
+
+    if (!strcmp(buf, "tcp") || buf[0] == '\0') {
+        *is_udp = false;
+    } else if (!strcmp(buf, "udp")) {
+        *is_udp = true;
+    } else {
+        error_setg(errp, "Bad protocol name");
+        return NULL;
+    }
+
+    return p;
+}
+
+/*
+ * Parse an ip address/port of the form "address:port<terminator>".
+ * An empty address means INADDR_ANY.
+ * Returns a pointer to after the terminator, unless it was '\0' in which case
+ * the result points to the '\0'.
+ * The parsed results are stored in *addr, *port.
+ * On error NULL is returned and stores the error in *errp.
+ */
+static const char *parse_ip_addr_and_port(const char *str, int terminator,
+                                          struct in_addr *addr, int *port,
+                                          Error **errp)
+{
+    g_autofree char *addr_str = NULL;
+    g_autofree char *port_str = NULL;
+    bool is_v6;
+    const char *p = inet_parse_host_and_port(str, terminator, &addr_str,
+                                             &port_str, &is_v6, errp);
+
+    if (p == NULL) {
+        return NULL;
+    }
+
+    /* Ignore is_v6 for the moment, if inet_aton fails let it. */
+    if (addr_str[0] == '\0') {
+        addr->s_addr = INADDR_ANY;
+    } else if (!inet_aton(addr_str, addr)) {
+        error_setg(errp, "Bad address");
+        return NULL;
+    }
+
+    if (qemu_strtoi(port_str, NULL, 10, port) < 0 ||
+        *port < 0 || *port > 65535) {
+        error_setg(errp, "Bad port");
+        return NULL;
+    }
+
+    /*
+     * At this point "p" points to the terminator or trailing NUL if the
+     * terminator is not present.
+     */
+    if (*p) {
+        ++p;
+    }
+    return p;
+}
+
 void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict)
 {
-    struct in_addr host_addr = { .s_addr = INADDR_ANY };
+    struct in_addr host_addr;
     int host_port;
-    char buf[256];
     const char *src_str, *p;
     SlirpState *s;
-    int is_udp = 0;
+    bool is_udp;
     int err;
+    Error *error = NULL;
     const char *arg1 = qdict_get_str(qdict, "arg1");
     const char *arg2 = qdict_get_try_str(qdict, "arg2");
 
@@ -654,30 +730,18 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict)
         return;
     }
 
+    g_assert(src_str != NULL);
     p = src_str;
-    if (!p || get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
-        goto fail_syntax;
-    }
-
-    if (!strcmp(buf, "tcp") || buf[0] == '\0') {
-        is_udp = 0;
-    } else if (!strcmp(buf, "udp")) {
-        is_udp = 1;
-    } else {
-        goto fail_syntax;
-    }
 
-    if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
-        goto fail_syntax;
-    }
-    if (buf[0] != '\0' && !inet_aton(buf, &host_addr)) {
+    p = parse_protocol(p, ':', &is_udp, &error);
+    if (p == NULL) {
         goto fail_syntax;
     }
 
-    if (qemu_strtoi(p, NULL, 10, &host_port)) {
+    if (parse_ip_addr_and_port(p, '\0', &host_addr, &host_port,
+                               &error) == NULL) {
         goto fail_syntax;
     }
-
     err = slirp_remove_hostfwd(s->slirp, is_udp, host_addr, host_port);
 
     monitor_printf(mon, "host forwarding rule for %s %s\n", src_str,
@@ -685,65 +749,39 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict)
     return;
 
  fail_syntax:
-    monitor_printf(mon, "invalid format\n");
+    monitor_printf(mon, "Invalid format: %s\n", error_get_pretty(error));
+    error_free(error);
 }
 
 static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp)
 {
-    struct in_addr host_addr = { .s_addr = INADDR_ANY };
-    struct in_addr guest_addr = { .s_addr = 0 };
+    struct in_addr host_addr, guest_addr;
     int host_port, guest_port;
     const char *p;
-    char buf[256];
-    int is_udp;
-    char *end;
-    const char *fail_reason = "Unknown reason";
+    bool is_udp;
+    Error *error = NULL;
 
+    g_assert(redir_str != NULL);
     p = redir_str;
-    if (!p || get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
-        fail_reason = "No : separators";
-        goto fail_syntax;
-    }
-    if (!strcmp(buf, "tcp") || buf[0] == '\0') {
-        is_udp = 0;
-    } else if (!strcmp(buf, "udp")) {
-        is_udp = 1;
-    } else {
-        fail_reason = "Bad protocol name";
-        goto fail_syntax;
-    }
 
-    if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
-        fail_reason = "Missing : separator";
-        goto fail_syntax;
-    }
-    if (buf[0] != '\0' && !inet_aton(buf, &host_addr)) {
-        fail_reason = "Bad host address";
+    p = parse_protocol(p, ':', &is_udp, &error);
+    if (p == NULL) {
         goto fail_syntax;
     }
 
-    if (get_str_sep(buf, sizeof(buf), &p, '-') < 0) {
-        fail_reason = "Bad host port separator";
-        goto fail_syntax;
-    }
-    host_port = strtol(buf, &end, 0);
-    if (*end != '\0' || host_port < 0 || host_port > 65535) {
-        fail_reason = "Bad host port";
+    p = parse_ip_addr_and_port(p, '-', &host_addr, &host_port, &error);
+    if (p == NULL) {
+        error_prepend(&error, "For host address: ");
         goto fail_syntax;
     }
 
-    if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
-        fail_reason = "Missing guest address";
+    if (parse_ip_addr_and_port(p, '\0', &guest_addr, &guest_port,
+                               &error) == NULL) {
+        error_prepend(&error, "For guest address: ");
         goto fail_syntax;
     }
-    if (buf[0] != '\0' && !inet_aton(buf, &guest_addr)) {
-        fail_reason = "Bad guest address";
-        goto fail_syntax;
-    }
-
-    guest_port = strtol(p, &end, 0);
-    if (*end != '\0' || guest_port < 1 || guest_port > 65535) {
-        fail_reason = "Bad guest port";
+    if (guest_port == 0) {
+        error_setg(&error, "For guest address: Bad port");
         goto fail_syntax;
     }
 
@@ -757,7 +795,8 @@ static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp)
 
  fail_syntax:
     error_setg(errp, "Invalid host forwarding rule '%s' (%s)", redir_str,
-               fail_reason);
+               error_get_pretty(error));
+    error_free(error);
     return -1;
 }
 
tests/acceptance/hostfwd.py new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
#8 lore raw

PATCH v5 5/5 net: Extend host forwarding to support IPv6

In reply to Doug Evans via

Net option "-hostfwd" now supports IPv6 addresses. Commands hostfwd_add, hostfwd_remove now support IPv6 addresses.

---

Changes from v4:
- was 4/4 in v4
- fix some formatting issues

Differences from v3:
- this patch renamed from 3/3 to 4/4
- ipv6 support added to existing hostfwd option, commands
- instead of creating new ipv6 option, commands
- added tests to tests/acceptance/hostfwd.py

Differences from v2:
- clarify spelling of ipv6 addresses in docs
- tighten parsing of ipv6 addresses

Differences from v1:
- parsing refactor split out into separate patch (2/3)

 hmp-commands.hx             | 15 +++++++
 net/slirp.c                 | 77 +++++++++++++++++++++++++----------
 tests/acceptance/hostfwd.py | 80 +++++++++++++++++++++++++++++++++++++
 3 files changed, 150 insertions(+), 22 deletions(-)
hmp-commands.hx +15 -0
index d4001f9c5d..4de4e4979d 100644
@@ -1375,6 +1375,16 @@ ERST
 SRST
 ``hostfwd_add``
   Redirect TCP or UDP connections from host to guest (requires -net user).
+  IPV6 addresses are wrapped in square brackes, 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
+
+  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:[::1]:10022-:22
 ERST
 
 #ifdef CONFIG_SLIRP
@@ -1390,6 +1400,11 @@ ERST
 SRST
 ``hostfwd_remove``
   Remove host-to-guest TCP or UDP redirection.
+  IPV6 addresses are wrapped in square brackes, IPV4 addresses are not.
+
+  Examples:
+  hostfwd_remove net0 tcp:127.0.0.1:10022
+  hostfwd_remove net0 tcp:[::1]:10022
 ERST
 
     {
net/slirp.c +55 -22

150 lines not on this page · raw message

tests/acceptance/hostfwd.py +80 -0

83 lines not on this page · raw message

Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
#9 lore raw
In reply to Doug Evans via
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH v5 0/5] Add support for ipv6 host forwarding

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
9d33831 net: Extend host forwarding to support IPv6
2b79933 net/slirp.c: Refactor address parsing
5090008 inet_parse_host_and_addr: Recognize []:port (empty ipv6 address) 5c2dcad util/qemu-sockets.c: Split host:port parsing out of inet_parse 79b77c4 slirp: Advance libslirp submodule to add ipv6 host-forward support

=== OUTPUT BEGIN ===
1/5 Checking commit 79b77c431b30 (slirp: Advance libslirp submodule to add ipv6 host-forward support)
ERROR: Author email address is mangled by the mailing list
#2:
Author: Doug Evans via <[email protected]>

total: 1 errors, 0 warnings, 2 lines checked

Patch 1/5 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

2/5 Checking commit 5c2dcad2990c (util/qemu-sockets.c: Split host:port parsing out of inet_parse)
ERROR: Author email address is mangled by the mailing list
#2:
Author: Doug Evans via <[email protected]>

total: 1 errors, 0 warnings, 117 lines checked

Patch 2/5 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

3/5 Checking commit 509000883fbd (inet_parse_host_and_addr: Recognize []:port (empty ipv6 address))
ERROR: Author email address is mangled by the mailing list
#2:
Author: Doug Evans via <[email protected]>

total: 1 errors, 0 warnings, 20 lines checked

Patch 3/5 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

4/5 Checking commit 2b7993354518 (net/slirp.c: Refactor address parsing)
ERROR: Author email address is mangled by the mailing list #2:
Author: Doug Evans via <[email protected]>

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #248:
new file mode 100644

WARNING: line over 80 characters
#334: FILE: tests/acceptance/hostfwd.py:82:
+ "host address: error parsing port in address ':')\r\n")

total: 1 errors, 2 warnings, 315 lines checked

Patch 4/5 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

5/5 Checking commit 9d3383170e32 (net: Extend host forwarding to support IPv6)
ERROR: Author email address is mangled by the mailing list
#2:
Author: Doug Evans via <[email protected]>

WARNING: line over 80 characters
#225: FILE: tests/acceptance/hostfwd.py:101:
+ self.assertEquals(self.hmc('hostfwd_add vnet tcp:[::1]:65022-[fe80::1]:22'),

WARNING: line over 80 characters
#228: FILE: tests/acceptance/hostfwd.py:104:
+ 'host forwarding rule for tcp:[::1]:65022 removed\r\n')

WARNING: line over 80 characters
#236: FILE: tests/acceptance/hostfwd.py:112:
+ 'host forwarding rule for udp:[::1]:65042 removed\r\n')

WARNING: line over 80 characters
#254: FILE: tests/acceptance/hostfwd.py:130:
+ 'host forwarding rule for udp:[::1]:65042 removed\r\n')

WARNING: line over 80 characters
#256: FILE: tests/acceptance/hostfwd.py:132:
+ 'host forwarding rule for udp:[::1]:65042 not found\r\n')

WARNING: line over 80 characters
#266: FILE: tests/acceptance/hostfwd.py:142:
+ "(For host address: error parsing IPv6 address '[::1')\r\n")

WARNING: line over 80 characters
#276: FILE: tests/acceptance/hostfwd.py:152:
+ "(For host address: error parsing IPv6 address '[::1]')\r\n")

WARNING: line over 80 characters
#279: FILE: tests/acceptance/hostfwd.py:155:
+ "(For guest address: error parsing IPv6 address '[foo]')\r\n")

WARNING: line over 80 characters
#285: FILE: tests/acceptance/hostfwd.py:161:
+ "':[::1]:66-[fe80::1]:-1' (For guest address: Bad port)\r\n")

WARNING: line over 80 characters
#288: FILE: tests/acceptance/hostfwd.py:164:
+ "':[::1]:66-[fe80::1]:66666' (For guest address: Bad port)\r\n")

WARNING: line over 80 characters
#291: FILE: tests/acceptance/hostfwd.py:167:
+ "':[::1]:66-[fe80::1]:0' (For guest address: Bad port)\r\n")

total: 1 errors, 11 warnings, 260 lines checked

Patch 5/5 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]