From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKm7m-0006Ko-Mi for qemu-devel@nongnu.org; Thu, 30 Jul 2015 07:35:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKm7j-0002hm-7y for qemu-devel@nongnu.org; Thu, 30 Jul 2015 07:35:46 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:48993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKm7i-0002hZ-62 for qemu-devel@nongnu.org; Thu, 30 Jul 2015 07:35:42 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 30 Jul 2015 05:35:41 -0600 From: Michael Roth Date: Thu, 30 Jul 2015 06:32:18 -0500 Message-Id: <1438255988-10418-4-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1438255988-10418-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1438255988-10418-1-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 03/53] Strip brackets from vnc host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?J=C3=A1n=20Tomko?= , qemu-stable@nongnu.org, Gerd Hoffmann From: Ján Tomko Commit v2.2.0-1530-ge556032 vnc: switch to inet_listen_opts bypassed the use of inet_parse in inet_listen, making literal IPv6 addresses enclosed in brackets fail: qemu-kvm: -vnc [::1]:0: Failed to start VNC server on `(null)': address resolution failed for [::1]:5900: Name or service not known Strip the brackets to make it work again. Signed-off-by: Ján Tomko Reviewed-by: Eric Blake Signed-off-by: Gerd Hoffmann (cherry picked from commit 274c3b52e10466a4771d591f6298ef61e8354ce0) Signed-off-by: Michael Roth --- ui/vnc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/vnc.c b/ui/vnc.c index cffb5b7..f989dfb 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3482,7 +3482,14 @@ void vnc_display_open(const char *id, Error **errp) h = strrchr(vnc, ':'); if (h) { - char *host = g_strndup(vnc, h - vnc); + char *host; + size_t hlen = h - vnc; + + if (vnc[0] == '[' && vnc[hlen - 1] == ']') { + host = g_strndup(vnc + 1, hlen - 2); + } else { + host = g_strndup(vnc, hlen); + } qemu_opt_set(sopts, "host", host, &error_abort); qemu_opt_set(wsopts, "host", host, &error_abort); qemu_opt_set(sopts, "port", h+1, &error_abort); -- 1.9.1