From: "Daniel P. Berrange" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/5] sockets: don't block IPv4 clients when listening on "::"
Date: Mon, 22 May 2017 16:34:38 +0100 [thread overview]
Message-ID: <20170522153438.GC25655@redhat.com> (raw)
In-Reply-To: <cfb86d90-8a74-ed2c-ae15-feb7d628f197@redhat.com>
On Mon, May 22, 2017 at 10:30:55AM -0500, Eric Blake wrote:
> On 05/19/2017 01:03 PM, Daniel P. Berrange wrote:
> > When inet_parse() parses the hostname, it is forcing the
> > has_ipv6 && ipv6 flags if the address contains a ":". This
> > means that if the user had set the ipv4=on flag, to try to
> > restrict the listener to just ipv4, an error would not have
> > been raised. eg
> >
> > -incoming tcp:[::]:9000,ipv4
> >
> > should have raised an error because listening for IPv4
> > on "::" is a non-sensical combination.
>
> If I understand correctly, the correct response (and post-patch
> behavior) is an error (mismatch between requesting IPv4-only usage while
> giving an IPv6 address), but the buggy response (pre-patch behavior) is
> that we ended up setting ipv6 in addition to the user-set ipv4 (because
> we found a ':'), and then end up listening on IPv6 after all contrary to
> the user's request.
Yes, with this patch you get this error:
qemu-system-x86_64: -incoming tcp:[::]:9000,ipv4: address resolution
failed for :::9000: Address family for hostname not supported
because it now (correctly) tries to resolve "::" as an IPv4 address
and fails (just like -chardev and -vnc already do)
>
>
> > With this removed,
> > we now call getaddrinfo() on "::" passing PF_INET and
> > so getaddrinfo reports an error about the hostname being
> > incompatible with the requested protocol.
> >
> > Likewise it is explicitly setting the has_ipv4 & ipv4
> > flags when the address contains only digits + '.'. This
> > has no ill-effect, but also has no benefit, so is removed.
> >
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> > util/qemu-sockets.c | 4 ----
> > 1 file changed, 4 deletions(-)
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc. +1-919-301-3266
> Virtualization: qemu.org | libvirt.org
>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2017-05-22 15:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 18:03 [Qemu-devel] [PATCH v2 0/5] Fix handling of IPv4/IPv6 dual stack Daniel P. Berrange
2017-05-19 18:03 ` [Qemu-devel] [PATCH v2 1/5] sockets: ensure we can bind to both ipv4 & ipv6 separately Daniel P. Berrange
2017-05-19 23:27 ` Philippe Mathieu-Daudé
2017-05-22 15:26 ` Eric Blake
2017-05-22 15:33 ` Daniel P. Berrange
2017-05-19 18:03 ` [Qemu-devel] [PATCH v2 2/5] sockets: don't block IPv4 clients when listening on "::" Daniel P. Berrange
2017-05-19 23:49 ` Philippe Mathieu-Daudé
2017-05-22 15:30 ` Eric Blake
2017-05-22 15:34 ` Daniel P. Berrange [this message]
2017-05-19 18:03 ` [Qemu-devel] [PATCH v2 3/5] sockets: ensure we don't accept IPv4 clients when IPv4 is disabled Daniel P. Berrange
2017-05-22 15:32 ` Eric Blake
2017-05-19 18:03 ` [Qemu-devel] [PATCH v2 4/5] io: preserve ipv4/ipv6 flags when resolving InetSocketAddress Daniel P. Berrange
2017-05-19 23:53 ` Philippe Mathieu-Daudé
2017-05-22 15:33 ` Eric Blake
2017-05-19 18:03 ` [Qemu-devel] [PATCH v2 5/5] tests: add functional test validating ipv4/ipv6 address flag handling Daniel P. Berrange
2017-05-22 16:00 ` Eric Blake
2017-05-22 16:56 ` Daniel P. Berrange
2017-05-22 17:30 ` Eric Blake
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=20170522153438.GC25655@redhat.com \
--to=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--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).