From ac9930e270d69995983025fe3e91eb550e9dd294 Mon Sep 17 00:00:00 2001 From: Ludvig Strigeus Date: Sun, 21 Oct 2018 17:21:25 +0200 Subject: [PATCH] IPv6 endpoint was printed incorrectly on the Advanced tab --- tunsafe_win32.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tunsafe_win32.cpp b/tunsafe_win32.cpp index 1ca7944..0503f99 100644 --- a/tunsafe_win32.cpp +++ b/tunsafe_win32.cpp @@ -1521,7 +1521,11 @@ static const char *GetAdvancedInfoValue(char buffer[256], int i) { if (ps->endpoint.sin.sin_family == 0) return ""; PrintIpAddr(ps->endpoint, ip); - snprintf(buffer, 256, "%s:%d", ip, htons(ps->endpoint.sin.sin_port)); + if (ps->endpoint.sin.sin_family == AF_INET6) { + snprintf(buffer, 256, "[%s]:%d", ip, htons(ps->endpoint.sin.sin_port)); + } else { + snprintf(buffer, 256, "%s:%d", ip, htons(ps->endpoint.sin.sin_port)); + } return buffer; }