--- apps/s_socket.c.orig 2016-05-27 20:37:22.000000000 +0200 +++ apps/s_socket.c 2016-05-27 20:44:30.000000000 +0200 @@ -590,7 +590,12 @@ } *(p++) = '\0'; - if ((ip != NULL) && !host_ip(str, ip, AF_INET)) + if ((*h == '[') && (*(p-2) == ']')) { + h++; + *(p-2) = '\0'; + } + + if ((ip != NULL) && !host_ip(h, ip, AF_INET)) goto err; if (host_ptr != NULL) *host_ptr = h;