From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyzhf-0004SM-Fi for qemu-devel@nongnu.org; Wed, 18 Nov 2015 05:11:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zyzhb-00065q-PO for qemu-devel@nongnu.org; Wed, 18 Nov 2015 05:11:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyzhb-00065i-K3 for qemu-devel@nongnu.org; Wed, 18 Nov 2015 05:10:59 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 3456D8C1A5 for ; Wed, 18 Nov 2015 10:10:59 +0000 (UTC) Date: Wed, 18 Nov 2015 10:10:55 +0000 From: "Daniel P. Berrange" Message-ID: <20151118101055.GC27591@redhat.com> References: <1447779624-21625-1-git-send-email-berrange@redhat.com> <1447779624-21625-4-git-send-email-berrange@redhat.com> <564BACFA.4070105@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <564BACFA.4070105@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 3/5] sockets: remove use of QemuOpts from socket_connect Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Paolo Bonzini , qemu-devel@nongnu.org, Gerd Hoffmann On Tue, Nov 17, 2015 at 03:40:58PM -0700, Eric Blake wrote: > On 11/17/2015 10:00 AM, Daniel P. Berrange wrote: > > The socket_connect method accepts a QAPI SocketAddress object > > which it then turns into QemuOpts before calling the > > inet_connect_opts/unix_connect_opts helper methods. By > > converting the latter to use QAPI SocketAddress directly, > > the QemuOpts conversion step can be eliminated > > > > This also fixes the problem where ipv4=off && ipv6=off > > would be treated the same as ipv4=on && ipv6=on > > > > Signed-off-by: Daniel P. Berrange > > --- > > util/qemu-sockets.c | 91 +++++++++++++++++++++-------------------------------- > > 1 file changed, 36 insertions(+), 55 deletions(-) > > > > > ai.ai_flags = AI_CANONNAME | AI_V4MAPPED | AI_ADDRCONFIG; > > - ai.ai_family = PF_UNSPEC; > > + ai.ai_family = inet_ai_family_from_address(saddr, &err); > > ai.ai_socktype = SOCK_STREAM; > > > > > > > - 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; > > I'm using the notation you used in 2/5, where - is unspecified, f is > explicitly false, and t is explicitly true. qemu_opt_get_bool(, 0) > cannot tell the difference between - and f. > > The old code treated 4=- and 6=- as PF_UNSPEC; 4=f and 6=f as PF_UNSPEC, > and 4=t and 6=t as PF_INET6. That doesn't quite jive with the commit > message claiming that 4=off (is that '4=-' or '4=f'?) and 6=off was the > same as 4=on (4=t) and 6=on. Yeah that commit message is wrong - i'll remove that bit 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 :|