[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 2/4] util/qemu-sockets.c: Split host:port parsing out of i
Re: [PATCH v4 2/4] util/qemu-sockets.c: Split host:port parsing out of inet_parse
Sun, 28 Feb 2021 22:39:57 +0100
Daniel P. Berrangé, le lun. 22 févr. 2021 09:39:41 +0000, a ecrit:
> In general callers shouldn't care about which format was parsed. The use
> of  is just a mechanism to reliably separate the port from the address.
> Once you have the address part getaddrinfo() will reliably parse the
> address into a sockaddr struct on its own.
> The is_v6 flag is only needed
> for the legacy compat needs in slirp, even that is only if we want to
> have strict equivalence with historical behaviour, as opposed to changing
> empty string to mean to listen on both IPv4+6 concurrently..
I would say that empty address meaning ipv4+6 looks better to me.
Doug Evans, le lun. 22 févr. 2021 09:55:09 -0800, a ecrit:
> Hi guys. I think before I submit yet another patchset in this series I need
> someone with authority to define the user API for ipv6 host forwarding.
> Since the hostfwd syntax is parsed in net/slirp.c, Samuel I think that means
> you (based on what I'm reading in MAINTAINERS).
Well, I'm not maintainer of the user API actually. That'd rather be
Markus Armbruster, now Cc-ed, who devises the command-line options,
> Based on what Maxim originally wrote I was going with addresses wrapped in 
> mean ipv6, but Daniel does not want that.
Specifying [127.0.0.1] would be odd, but for instance
ssh localhost -D '[127.0.0.1]':23456
happens to listen on 127.0.0.1. So I would say that common practice
really is that  only matters for syntax, and not semantic.
> There are issues to consider of course.
> Note that one issue I am leaving for later (i.e., I don't want to drag this
> patch series out to include it), is whether and how to support ipv4-host->
> ipv6-guest forwarding and vice versa. Can libslirp support this?
That would be feasible yes: since the data flow is completely rebuilt
between the host and the guest, there is no remnant of the IP version.
It was simpler to have e.g. udp_listen and udp6_listen separate to keep
uint32_t / in6_addr parameters, but there is no strict reason for this:
the haddr is only passed to the bind() call, and the laddr is only
recorded in the so. Put another way, a refactoring patch could be to
just hand udp_listen two sockaddrs, and it will just work fine. We'd
then introduce a slirp_add_hostfwd that takes two sockaddr instead of
> Setting cross-forwarding aside, we can't break existing uses of course, so
> means that one issue is that if  is not used to identify ipv6 addresses then
> something like ",ipv6" will be needed as a separate argument; otherwise the
> empty address "" will be ambiguous.
(as I mentioned above, I'd say empty address "" should mean ipv4+ipv6)
> + 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.
Re: [PATCH v4 0/4] Add support for ipv6 host forwarding, no-reply, 2021/02/18
- [PATCH v4 1/4] slirp: Advance libslirp submodule to add ipv6 host-forward support, (continued)