Received: from eggs.gnu.org ([2001:4830:134:3::10]:43904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFnfa-0004WT-0A for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:09:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFnfY-0004PG-Rm for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:09:33 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48943) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFnfY-0004P9-LN for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:09:32 -0400 From: Peter Maydell Date: Fri, 8 Aug 2014 18:07:27 +0100 Message-Id: <1407517649-11257-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1407517649-11257-1-git-send-email-peter.maydell@linaro.org> References: <1407517649-11257-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 2/4] util/qemu-sockets.c: Support specifying IPv4 or IPv6 in socket_dgram() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster Currently you can specify whether you want a UDP chardev backend to be IPv4 or IPv6 using the ipv4 or ipv6 options if you use the QemuOpts parsing code in inet_dgram_opts(). However the QMP struct parsing code in socket_dgram() doesn't provide this flexibility (which in turn prevents us from converting the UDP backend handling to the new style QAPI framework). Use the existing inet_addr_to_opts() function to convert the remote->inet address to option strings; this handles ipv4 and ipv6 flags as well as host and port. (It will also convert any 'to' specification, which is harmless as it is ignored in this context.) Signed-off-by: Peter Maydell --- util/qemu-sockets.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 74cf078..25e5fd1 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -966,8 +966,7 @@ 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: - qemu_opt_set(opts, "host", remote->inet->host); - qemu_opt_set(opts, "port", remote->inet->port); + inet_addr_to_opts(opts, remote->inet); if (local) { qemu_opt_set(opts, "localaddr", local->inet->host); qemu_opt_set(opts, "localport", local->inet->port); -- 1.9.1