From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] socket: handle ipv4/ipv6 in socket_dgram
Date: Fri, 28 Feb 2014 11:16:19 +0100 [thread overview]
Message-ID: <1393582579-10366-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1393582579-10366-1-git-send-email-pbonzini@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 <pbonzini@redhat.com>
---
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
next prev parent reply other threads:[~2014-02-28 10:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 10:16 [Qemu-devel] [PATCH 0/2] Small fixes for qemu-sockets ipv4/ipv6 logic Paolo Bonzini
2014-02-28 10:16 ` [Qemu-devel] [PATCH 1/2] socket: treat ipv4=on,ipv6=on uniformly Paolo Bonzini
2014-02-28 11:56 ` [Qemu-devel] [PATCH 1/2] socket: treat ipv4=on, ipv6=on uniformly Markus Armbruster
2014-02-28 12:23 ` Gerd Hoffmann
2014-02-28 12:44 ` Paolo Bonzini
2014-02-28 10:16 ` Paolo Bonzini [this message]
2014-02-28 13:05 ` [Qemu-devel] [PATCH 2/2] socket: handle ipv4/ipv6 in socket_dgram Gerd Hoffmann
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=1393582579-10366-3-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).