Message ID | 20250117110422.921-1-gert@greenie.muc.de |
---|---|
State | New |
Headers | show |
Series | [Openvpn-devel,v2] IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified | expand |
Thanks for addressing this long-standing itch... not sure why we actually added a comment "back then" explaining why we don't do something, instead of finding a way to actually do it. I haven't actually looked at the output, only ran client-tests - but the code change is straightforward enough. Your patch has been applied to the master branch. commit 5cea4bc75e1b87ec7225a89b7cf5cadb85e77e8a Author: Marco Baffo Date: Fri Jan 17 12:04:22 2025 +0100 IPv6 MADDR LOG: Wrap IPv6 addresses in square brackets and print port when the port is specified Signed-off-by: Marco Baffo <marco@mandelbit.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20250117110422.921-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30480.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c index f4539dc..80e18b7 100644 --- a/src/openvpn/mroute.c +++ b/src/openvpn/mroute.c @@ -430,18 +430,19 @@ { 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 - */ - if (maddr.type & MR_WITH_PORT) - { - buf_printf(&out, ":%d", ntohs(maddr.v6.port)); - } + } + else if (maddr.type & MR_WITH_PORT) + { + buf_printf(&out, "[%s]", print_in6_addr(maddr.v6.addr, 0, gc)); } else { buf_printf(&out, "%s", print_in6_addr(maddr.v6.addr, 0, gc)); } + if (maddr.type & MR_WITH_PORT) + { + buf_printf(&out, ":%d", ntohs(maddr.v6.port)); + } if (maddr.type & MR_WITH_NETBITS) { buf_printf(&out, "/%d", maddr.netbits);