From: "Daniel P. Berrange" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1 2/5] sockets: remove use of QemuOpts from socket_listen
Date: Wed, 21 Oct 2015 17:49:46 +0100 [thread overview]
Message-ID: <20151021164946.GE21888@redhat.com> (raw)
In-Reply-To: <5627B523.9090409@redhat.com>
On Wed, Oct 21, 2015 at 05:54:11PM +0200, Paolo Bonzini wrote:
>
>
> On 21/10/2015 17:43, Daniel P. Berrange wrote:
> > + }
> > + if (addr->has_ipv6 && addr->ipv6) {
> > + g_printerr("One\n");
> > + return PF_INET6;
> > + }
> > + if (addr->has_ipv4 && addr->ipv4) {
> > + g_printerr("Two\n");
> > + return PF_INET;
> > + }
> > + if (addr->has_ipv6 && !addr->ipv6) {
> > + g_printerr("Three\n");
> > + return PF_INET;
> > + }
> > + if (addr->has_ipv4 && !addr->ipv4) {
> > + g_printerr("Four\n");
> > + return PF_INET6;
> > + }
> > + g_printerr("Five %d %d %d %d\n",
> > + addr->has_ipv4, addr->ipv4,
> > + addr->has_ipv6, addr->ipv6);
> > + return PF_UNSPEC;
> > +}
> > +
>
> Apart from the extra debugging output, I think you can merge as
>
> if ((addr->has_ipv6 && addr->ipv6) || (addr->has_ipv4 && !addr->ipv4)) {
> return PF_INET6;
> }
> if ((addr->has_ipv4 && addr->ipv4) || (addr->has_ipv6 && !addr->ipv6)) {
> return PF_INET;
> }
> return PF_UNSPEC;
>
> where the order of the first two is important.
Yes, and next time I'll remember to remove the debugging output before
posting :-)
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2015-10-21 16:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-21 15:43 [Qemu-devel] [PATCH v1 0/5] Convert qemu-socket to use QAPI exclusively Daniel P. Berrange
2015-10-21 15:43 ` [Qemu-devel] [PATCH v1 1/5] sockets: remove use of QemuOpts from header file Daniel P. Berrange
2015-10-21 17:23 ` Eric Blake
2015-10-21 15:43 ` [Qemu-devel] [PATCH v1 2/5] sockets: remove use of QemuOpts from socket_listen Daniel P. Berrange
2015-10-21 15:54 ` Paolo Bonzini
2015-10-21 16:49 ` Daniel P. Berrange [this message]
2015-10-21 15:43 ` [Qemu-devel] [PATCH v1 3/5] sockets: remove use of QemuOpts from socket_connect Daniel P. Berrange
2015-10-21 15:43 ` [Qemu-devel] [PATCH v1 4/5] sockets: remove use of QemuOpts from socket_dgram Daniel P. Berrange
2015-10-21 15:43 ` [Qemu-devel] [PATCH v1 5/5] vnc: distiguish between ipv4/ipv6 omitted vs set to off Daniel P. Berrange
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=20151021164946.GE21888@redhat.com \
--to=berrange@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).