From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZldT4-00078A-K9 for qemu-devel@nongnu.org; Mon, 12 Oct 2015 09:48:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZldT1-0006Nr-CT for qemu-devel@nongnu.org; Mon, 12 Oct 2015 09:48:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZldT1-0006Ng-8A for qemu-devel@nongnu.org; Mon, 12 Oct 2015 09:48:43 -0400 Date: Mon, 12 Oct 2015 14:48:39 +0100 From: "Daniel P. Berrange" Message-ID: <20151012134839.GN21855@redhat.com> References: <1444656941-17038-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1444656941-17038-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qemu-sockets: fix conversion of ipv4/ipv6 JSON to QemuOpts Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Umair_Sair@mentor.com On Mon, Oct 12, 2015 at 03:35:41PM +0200, Paolo Bonzini wrote: > The QemuOpts-based code treats "option not set" and "option set > to false" the same way for the ipv4 and ipv6 options, because it > is meant to handle only the ",ipv4" and ",ipv6" substrings in > hand-crafted option parsers. > > When converting InetSocketAddress to QemuOpts, however, it is > necessary to handle all three cases (not set, set to true, set > to false). Currently we are not handling all cases correctly. > The rules are: > > * if none or both options are absent, leave things as is > > * if the single present option is Y, the other should be N. > This can be implemented by leaving things as is, or by setting > the other option to N as done in this patch. > > * if the single present option is N, the other should be Y. > This is handled by the "else if" branch of this patch. > > This ensures that the ipv4 option has an effect on Windows, > where creating the socket with PF_UNSPEC makes an ipv6 > socket. With this patch, ",ipv4" will result in a PF_INET > socket instead. > > Reported-by: Sair, Umair > Tested-by: Sair, Umair > Signed-off-by: Paolo Bonzini > --- > util/qemu-sockets.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) Reviewed-by: Daniel P. Berrange I look forward to formally submitting the remainder of my patches to kill off QemuOpts from this qemu-sockets.c code :-) 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 :|