Hi,

On 07/12/2018 22:33, Gert Doering wrote:
> For whatever reason, this function never printed port numbers for
> IPv6 addresses (but it did for IPv4) - which creates a bit of
> confusion for IPv6-mapped v4 addresses on a dual stack socket,
> that will have ports numbers printed or not, depending on whether
> it's a dual-stack v6 socket or single-stack v4.
> 
> This will not(!) add printing of port numbers for "proper" v6
> addresses yet, because that might have adverse side effects to address
> parsing elsewhere.
> 
> Signed-off-by: Gert Doering <g...@greenie.muc.de>
> ---
>  src/openvpn/mroute.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
> index 28940a8d..134f4c00 100644
> --- a/src/openvpn/mroute.c
> +++ b/src/openvpn/mroute.c
> @@ -477,6 +477,13 @@ mroute_addr_print_ex(const struct mroute_addr *ma,
>                  {
>                      buf_printf(&out, "%s", 
> print_in_addr_t(maddr.v4mappedv6.addr,
>                                                             IA_NET_ORDER, 
> gc));
> +                 /* we only print port numbers for v4mapped v6 as of
> +                  * today, because "v6addr:port" is too ambiguous
> +                  */

The comments above are indented with tab+spaces, while the code below is
just all spaces. Please use the all spaces everywhere.

> +                    if (maddr.type & MR_WITH_PORT)
> +                    {
> +                        buf_printf(&out, ":%d", ntohs(maddr.v6.port));
> +                    }

I don't understand how is this solving the ambiguity? Or you are just
saying: "we can't do much, let's just print the port anyway"? My
suggestion would be to surround the address with [], so basically change
the printf format above from %s to [%s]. Does it make sense?


Cheers,

>                  }
>                  else
>                  {
> 

-- 
Antonio Quartulli

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to