Re: [Qemu-devel] [PATCH RFC 4/4] net/slirp: add ipv6-hostfwd option for user netdev type
On 10/25/18 7:03 PM, Maxim Samoylov wrote: This allows forwarding TCP6 and UDP6 connections down to netdev=user connected guests. Signed-off-by: Maxim Samoylov --- hmp-commands.hx | 31 include/net/slirp.h | 2 + net/slirp.c | 214 qapi/net.json | 3 +- 4 files changed, 249 insertions(+), 1 deletion(-) +++ b/qapi/net.json @@ -201,7 +201,8 @@ '*smbserver': 'str', '*hostfwd': ['String'], '*guestfwd': ['String'], -'*tftp-server-name': 'str' } } +'*tftp-server-name': 'str', +'*ipv6-hostfwd': ['String']} } Missing documentation of the new member. Don't forget a '(since 3.1)' comment (if this is still appropriate for the current release; which may be doubtful since we are in soft freeze, in which case it will be 3.2 or 4.0, depending on what the next release is numbered). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH RFC 4/4] net/slirp: add ipv6-hostfwd option for user netdev type
On 26.10.2018 09:14, Thomas Huth wrote: On 2018-10-26 01:03, Maxim Samoylov wrote: This allows forwarding TCP6 and UDP6 connections down to netdev=user connected guests. Signed-off-by: Maxim Samoylov --- hmp-commands.hx | 31 include/net/slirp.h | 2 + net/slirp.c | 214 qapi/net.json | 3 +- 4 files changed, 249 insertions(+), 1 deletion(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index db0c681..b0e1a08 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1448,6 +1448,37 @@ STEXI Remove host-to-guest TCP or UDP redirection. ETEXI +#ifdef CONFIG_SLIRP +{ +.name = "ipv6_hostfwd_add", +.args_type = "arg1:s,arg2:s?,arg3:s?", +.params = "[hub_id name]|[netdev_id] [tcp|udp]:[hostaddr6]:hostport-guestaddr6:guestport", +.help = "redirect TCP6 or UDP6 connections from host to guest (requires -net user)", +.cmd= hmp_ipv6_hostfwd_add, +}, +#endif +STEXI +@item hostfwd_add +@findex hostfwd_add +Redirect TCP6 or UDP6 connections from host to guest (requires -net user). +ETEXI + +#ifdef CONFIG_SLIRP +{ +.name = "ipv6_hostfwd_remove", +.args_type = "arg1:s,arg2:s?,arg3:s?", +.params = "[hub_id name]|[netdev_id] [tcp|udp]:[hostaddr6]:hostport", +.help = "remove host-to-guest TCP6 or UDP6 redirection", +.cmd= hmp_ipv6_hostfwd_remove, +}, Hi, could you please remove the "[hub_id name]" touple here? I recently sent a patch to deprecate it for the IPv4 version, too: https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg03198.html Ok Also I think it would make sense if you mention in the help text that IPv6 addresses have to be given with square brackets? Thanks, Thomas Sure, missed that thing. --- Maxim Samoylov, max7...@yandex-team.ru
Re: [Qemu-devel] [PATCH RFC 4/4] net/slirp: add ipv6-hostfwd option for user netdev type
Maxim Samoylov, le ven. 26 oct. 2018 03:03:43 +0300, a ecrit: > +void hmp_ipv6_hostfwd_remove(Monitor *mon, const QDict *qdict) > +{ Similarly, a lot can be shared, by introducing const char *hmp_hostfwd_lookup(Monitor *mon, const QDict *qdict, int is_v6) which will contain all the lookup and tcp/udp parsing part, and just return the src_str (is_v6 to avoid testing only arg1). hmp_hostfwd_remove and hmp_ipv6_hostfwd_remove can then just start by calling it and get src_str that it can then use to parse the IPs. > +struct in6_addr host_addr = in6addr_any; > +if (*(p++) != '[') { > +goto fail_syntax; > +} As mentioned, better explicit this in the helper message. > +static int slirp_ipv6_hostfwd(SlirpState *s, const char *redir_str, > + Error **errp) For this one I wouldn't bother factorizing, though. Samuel
Re: [Qemu-devel] [PATCH RFC 4/4] net/slirp: add ipv6-hostfwd option for user netdev type
On 2018-10-26 01:03, Maxim Samoylov wrote: > This allows forwarding TCP6 and UDP6 connections down to > netdev=user connected guests. > > Signed-off-by: Maxim Samoylov > --- > hmp-commands.hx | 31 > include/net/slirp.h | 2 + > net/slirp.c | 214 > > qapi/net.json | 3 +- > 4 files changed, 249 insertions(+), 1 deletion(-) > > diff --git a/hmp-commands.hx b/hmp-commands.hx > index db0c681..b0e1a08 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -1448,6 +1448,37 @@ STEXI > Remove host-to-guest TCP or UDP redirection. > ETEXI > > +#ifdef CONFIG_SLIRP > +{ > +.name = "ipv6_hostfwd_add", > +.args_type = "arg1:s,arg2:s?,arg3:s?", > +.params = "[hub_id name]|[netdev_id] > [tcp|udp]:[hostaddr6]:hostport-guestaddr6:guestport", > +.help = "redirect TCP6 or UDP6 connections from host to guest > (requires -net user)", > +.cmd= hmp_ipv6_hostfwd_add, > +}, > +#endif > +STEXI > +@item hostfwd_add > +@findex hostfwd_add > +Redirect TCP6 or UDP6 connections from host to guest (requires -net user). > +ETEXI > + > +#ifdef CONFIG_SLIRP > +{ > +.name = "ipv6_hostfwd_remove", > +.args_type = "arg1:s,arg2:s?,arg3:s?", > +.params = "[hub_id name]|[netdev_id] > [tcp|udp]:[hostaddr6]:hostport", > +.help = "remove host-to-guest TCP6 or UDP6 redirection", > +.cmd= hmp_ipv6_hostfwd_remove, > +}, Hi, could you please remove the "[hub_id name]" touple here? I recently sent a patch to deprecate it for the IPv4 version, too: https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg03198.html Also I think it would make sense if you mention in the help text that IPv6 addresses have to be given with square brackets? Thanks, Thomas