From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJKUm-0002bv-9d for qemu-devel@nongnu.org; Fri, 28 Feb 2014 05:16:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJKUb-0002hv-KG for qemu-devel@nongnu.org; Fri, 28 Feb 2014 05:16:44 -0500 Received: from mail-ee0-x230.google.com ([2a00:1450:4013:c00::230]:62813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJKUb-0002hm-D4 for qemu-devel@nongnu.org; Fri, 28 Feb 2014 05:16:33 -0500 Received: by mail-ee0-f48.google.com with SMTP id e51so1008860eek.7 for ; Fri, 28 Feb 2014 02:16:32 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 28 Feb 2014 11:16:19 +0100 Message-Id: <1393582579-10366-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1393582579-10366-1-git-send-email-pbonzini@redhat.com> References: <1393582579-10366-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] socket: handle ipv4/ipv6 in socket_dgram List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com We were forgetting to set the ipv4 and ipv6 QemuOpts properties, so socket_dgram was always trying _both_ ipv4 and ipv6. Forward the properties correctly. Signed-off-by: Paolo Bonzini --- util/qemu-sockets.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 7a9065b..7391aee 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -958,15 +958,22 @@ int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp) opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); switch (remote->kind) { - case SOCKET_ADDRESS_KIND_INET: + case SOCKET_ADDRESS_KIND_INET: { + bool ipv4 = remote->inet->ipv4 || !remote->inet->has_ipv4; + bool ipv6 = remote->inet->ipv6 || !remote->inet->has_ipv6; qemu_opt_set(opts, "host", remote->inet->host); qemu_opt_set(opts, "port", remote->inet->port); if (local) { qemu_opt_set(opts, "localaddr", local->inet->host); qemu_opt_set(opts, "localport", local->inet->port); } + if (!ipv4 || !ipv6) { + qemu_opt_set_bool(opts, "ipv4", ipv4); + qemu_opt_set_bool(opts, "ipv6", ipv6); + } fd = inet_dgram_opts(opts, errp); break; + } default: error_setg(errp, "socket type unsupported for datagram"); -- 1.8.5.3