* [Qemu-devel] [PATCH] Strip brackets from vnc host
@ 2015-04-27 12:06 Ján Tomko
2015-04-27 14:44 ` Eric Blake
0 siblings, 1 reply; 2+ messages in thread
From: Ján Tomko @ 2015-04-27 12:06 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel
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 <jtomko@redhat.com>
---
ui/vnc.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index cffb5b7..49af7c7 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);
--
2.0.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Strip brackets from vnc host
2015-04-27 12:06 [Qemu-devel] [PATCH] Strip brackets from vnc host Ján Tomko
@ 2015-04-27 14:44 ` Eric Blake
0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2015-04-27 14:44 UTC (permalink / raw)
To: Ján Tomko, qemu-devel; +Cc: kraxel
[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]
On 04/27/2015 06:06 AM, Ján Tomko wrote:
> 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 <jtomko@redhat.com>
> ---
> ui/vnc.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index cffb5b7..49af7c7 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);
Inconsistent spacing around operators (2 of the three '-'/'+' are
missing spacing).
With that fixed,
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-27 14:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-27 12:06 [Qemu-devel] [PATCH] Strip brackets from vnc host Ján Tomko
2015-04-27 14:44 ` Eric Blake
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).