IPv6 endpoint was printed incorrectly on the Advanced tab

This commit is contained in:
Ludvig Strigeus 2018-10-21 17:21:25 +02:00
parent 15f5c2e0d4
commit ac9930e270

View file

@ -1521,7 +1521,11 @@ static const char *GetAdvancedInfoValue(char buffer[256], int i) {
if (ps->endpoint.sin.sin_family == 0) if (ps->endpoint.sin.sin_family == 0)
return ""; return "";
PrintIpAddr(ps->endpoint, ip); 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; return buffer;
} }