@@ -3498,8 +3498,10 @@ void vnc_display_open(const char *id, Error **errp)
const char *websocket = qemu_opt_get(opts, "websocket");
int to = qemu_opt_get_number(opts, "to", 0);
- bool has_ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
- bool has_ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
+ bool has_ipv4 = qemu_opt_get(opts, "ipv4");
+ bool has_ipv6 = qemu_opt_get(opts, "ipv6");
+ bool ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
+ bool ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
saddr = g_new0(SocketAddress, 1);
if (websocket) {
@@ -3547,8 +3549,10 @@ void vnc_display_open(const char *id, Error **errp)
saddr->inet->has_to = true;
saddr->inet->to = to;
}
- saddr->inet->ipv4 = saddr->inet->has_ipv4 = has_ipv4;
- saddr->inet->ipv6 = saddr->inet->has_ipv6 = has_ipv6;
+ saddr->inet->ipv4 = ipv4;
+ saddr->inet->has_ipv4 = has_ipv4;
+ saddr->inet->ipv6 = ipv6;
+ saddr->inet->has_ipv6 = has_ipv6;
if (vs->ws_enabled) {
wsaddr->kind = SOCKET_ADDRESS_KIND_INET;
@@ -3560,8 +3564,10 @@ void vnc_display_open(const char *id, Error **errp)
wsaddr->inet->has_to = true;
wsaddr->inet->to = to;
}
- wsaddr->inet->ipv4 = wsaddr->inet->has_ipv4 = has_ipv4;
- wsaddr->inet->ipv6 = wsaddr->inet->has_ipv6 = has_ipv6;
+ wsaddr->inet->ipv4 = ipv4;
+ wsaddr->inet->has_ipv4 = has_ipv4;
+ wsaddr->inet->ipv6 = ipv6;
+ wsaddr->inet->has_ipv6 = has_ipv6;
}
}
} else {
The VNC code for interpreting QemuOpts does not currently distinguish between ipv4/ipv6 being omitted, and being set to 'off', because historically the 'ipv4' and 'ipv6' options were just flags which did not accept a value. The upshot is that if someone runs $QEMU -vnc localhost:1,ipv6=off QEMU still uses PF_UNSPEC and thus may still bind to IPv6, when it should use PF_INET. This is another instance of the problem previously fixed for chardevs in commit b77e7c8e99f9ac726c4eaa2fc3461fd886017dc0 Author: Paolo Bonzini <pbonzini@redhat.com> Date: Mon Oct 12 15:35:16 2015 +0200 qemu-sockets: fix conversion of ipv4/ipv6 JSON to QemuOpts Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- ui/vnc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)