From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJN8a-0001yx-R2 for qemu-devel@nongnu.org; Fri, 28 Feb 2014 08:06:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJN8T-0000fB-Da for qemu-devel@nongnu.org; Fri, 28 Feb 2014 08:06:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:65168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJN8T-0000f1-42 for qemu-devel@nongnu.org; Fri, 28 Feb 2014 08:05:53 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1SD5pml024906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 28 Feb 2014 08:05:51 -0500 Message-ID: <1393592747.3364.51.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Fri, 28 Feb 2014 14:05:47 +0100 In-Reply-To: <1393582579-10366-3-git-send-email-pbonzini@redhat.com> References: <1393582579-10366-1-git-send-email-pbonzini@redhat.com> <1393582579-10366-3-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] socket: handle ipv4/ipv6 in socket_dgram List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com On Fr, 2014-02-28 at 11:16 +0100, Paolo Bonzini wrote: > - case SOCKET_ADDRESS_KIND_INET: > + case SOCKET_ADDRESS_KIND_INET: { > + bool ipv4 = remote->inet->ipv4 || !remote->inet->has_ipv4; > + bool ipv6 = remote->inet->ipv6 || !remote->inet->has_ipv6; > qemu_opt_set(opts, "host", remote->inet->host); > qemu_opt_set(opts, "port", remote->inet->port); > if (local) { > qemu_opt_set(opts, "localaddr", local->inet->host); > qemu_opt_set(opts, "localport", local->inet->port); > } > + if (!ipv4 || !ipv6) { > + qemu_opt_set_bool(opts, "ipv4", ipv4); > + qemu_opt_set_bool(opts, "ipv6", ipv6); > + } I'd go for a simple if (remote->inet->has_ipv4) { qemu_opt_set_bool(opts, "ipv4", remote->inet->ipv4) } cheers, Gerd