From: Paolo Bonzini <pbonzini@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] socket: treat ipv4=on, ipv6=on uniformly
Date: Fri, 28 Feb 2014 13:44:43 +0100 [thread overview]
Message-ID: <531084BB.9010108@redhat.com> (raw)
In-Reply-To: <1393590201.3364.44.camel@nilsson.home.kraxel.org>
Il 28/02/2014 13:23, Gerd Hoffmann ha scritto:
> On Fr, 2014-02-28 at 11:16 +0100, Paolo Bonzini wrote:
>> In some cases, "ipv4=on,ipv6=on" means "try both kinds of address";
>> in others, it means "try IPv6 only" just by virtue of how the code
>> is structured.
>
>> @@ -127,10 +127,13 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
>
>> - if (qemu_opt_get_bool(opts, "ipv4", 0))
>> - ai.ai_family = PF_INET;
>> - if (qemu_opt_get_bool(opts, "ipv6", 0))
>> - ai.ai_family = PF_INET6;
>> + if (qemu_opt_get_bool(opts, "ipv4", 0) != qemu_opt_get_bool(opts, "ipv6", 0)) {
>> + if (qemu_opt_get_bool(opts, "ipv4", 0)) {
>> + ai.ai_family = PF_INET;
>> + } else {
>> + ai.ai_family = PF_INET6;
>> + }
>> + }
>
> This is wrong for the listening side.
>
> ipv6 sockets can listen on both ipv4 and ipv6. qemu configures ipv6
> sockets to do that, unconditionally.
>
> So ipv4=yes,ipv6=no works correctly.
> ipv4=yes,ipv6=yes works too.
> ipv4=no,ipv6=yes doesn't work, but to fix that you have to set the
> IPV6_V6ONLY socket option according to the ipv4 option.
>
> Canevat: Listening on both ipv4+ipv6 with a single file handle works for
> the wildcard address only. Specifying -- say --
> host=localhost,ipv4=yes,ipv6=yes, then expect qemu to listen on both
> 127.0.0.1 and ::1 doesn't work.
>
> This can only be fixed by allowing multiple listening filehandles.
> Which is a non-trivial change as this also affects the public api (which
> will have to report a list of listening addresses instead of a single
> address).
Thanks for teaching me!
Do you think patch 2 is okay alone?
Paolo
next prev parent reply other threads:[~2014-02-28 12:45 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 [this message]
2014-02-28 10:16 ` [Qemu-devel] [PATCH 2/2] socket: handle ipv4/ipv6 in socket_dgram Paolo Bonzini
2014-02-28 13:05 ` 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=531084BB.9010108@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.