From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
Anthony Liguori <aliguori@amazon.com>,
patches@linaro.org
Subject: [Qemu-devel] [PATCH v2 2/5] util/qemu-sockets.c: Support specifying IPv4 or IPv6 in socket_dgram()
Date: Tue, 2 Sep 2014 11:24:14 +0100 [thread overview]
Message-ID: <1409653457-27863-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1409653457-27863-1-git-send-email-peter.maydell@linaro.org>
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 <peter.maydell@linaro.org>
---
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 5d38395..4a25585 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
next prev parent reply other threads:[~2014-09-02 10:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 10:24 [Qemu-devel] [PATCH v2 0/5] Convert remaining legacy chardevs to QAPI Peter Maydell
2014-09-02 10:24 ` [Qemu-devel] [PATCH v2 1/5] qemu-char: Convert socket backend " Peter Maydell
2014-09-02 10:24 ` Peter Maydell [this message]
2014-09-02 10:24 ` [Qemu-devel] [PATCH v2 3/5] qemu-char: Convert udp " Peter Maydell
2014-09-02 20:04 ` Eric Blake
2014-09-02 20:30 ` Peter Maydell
2014-09-02 10:24 ` [Qemu-devel] [PATCH v2 4/5] qemu-char: Remove register_char_driver() machinery Peter Maydell
2014-09-02 10:24 ` [Qemu-devel] [PATCH v2 5/5] qemu-char: Rename register_char_driver_qapi() to register_char_driver() Peter Maydell
2014-09-09 6:47 ` [Qemu-devel] [PATCH v2 0/5] Convert remaining legacy chardevs to QAPI Paolo Bonzini
2014-09-09 8:11 ` Peter Maydell
2014-09-16 23:43 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409653457-27863-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=aliguori@amazon.com \
--cc=armbru@redhat.com \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).