From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahuLZ-0000yv-40 for qemu-devel@nongnu.org; Mon, 21 Mar 2016 03:33:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahuLV-00074t-Tb for qemu-devel@nongnu.org; Mon, 21 Mar 2016 03:33:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59555) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahuLV-00074g-OM for qemu-devel@nongnu.org; Mon, 21 Mar 2016 03:33:49 -0400 References: <1458473954-18583-1-git-send-email-samuel.thibault@ens-lyon.org> From: Thomas Huth Message-ID: <56EFA3D9.1090404@redhat.com> Date: Mon, 21 Mar 2016 08:33:45 +0100 MIME-Version: 1.0 In-Reply-To: <1458473954-18583-1-git-send-email-samuel.thibault@ens-lyon.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] slirp: Allow to disable IPv4 or IPv6 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Samuel Thibault , qemu-devel@nongnu.org Cc: jan.kiszka@siemens.com, jasowang@redhat.com, armbru@redhat.com On 20.03.2016 12:39, Samuel Thibault wrote: > Make net=0.0.0.0 disable IPv4 and ip6-net=:: disable IPv6, so the user can > setup IPv4-only and IPv6-only network environments. > > Signed-off-by: Samuel Thibault > --- > net/slirp.c | 8 +++++--- > qapi-schema.json | 4 ++-- > qemu-options.hx | 7 ++++--- > slirp/ip6.h | 9 +++++++++ > slirp/ip6_icmp.c | 10 ++++++++++ > slirp/ip6_input.c | 6 ++++++ > slirp/ip_input.c | 5 +++++ > slirp/slirp.c | 5 +++++ > 8 files changed, 46 insertions(+), 8 deletions(-) > > diff --git a/net/slirp.c b/net/slirp.c > index 95239bc..3151d4a 100644 > --- a/net/slirp.c > +++ b/net/slirp.c > @@ -244,13 +244,15 @@ static int net_slirp_init(NetClientState *peer, const char *model, > > #if defined(_WIN32) && (_WIN32_WINNT < 0x0600) > /* No inet_pton helper before Vista... */ > - if (vprefix6) { > + if (vprefix6 && strcmp(vprefix6, "::")) { > /* Unsupported */ > return -1; > } > memset(&ip6_prefix, 0, sizeof(ip6_prefix)); > - ip6_prefix.s6_addr[0] = 0xfe; > - ip6_prefix.s6_addr[1] = 0xc0; > + if (!vprefix6) { > + ip6_prefix.s6_addr[0] = 0xfe; > + ip6_prefix.s6_addr[1] = 0xc0; > + } > #else > if (!vprefix6) { > vprefix6 = "fec0::"; > diff --git a/qapi-schema.json b/qapi-schema.json > index 88f9b81..69eb6e7 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -2427,7 +2427,7 @@ > # > # @ip: #optional legacy parameter, use net= instead > # > -# @net: #optional IP address and optional netmask > +# @net: #optional IP address and optional netmask. Set to 0.0.0.0 to disable IPv4 completely > # > # @host: #optional guest-visible address of the host > # > @@ -2443,7 +2443,7 @@ > # @dnssearch: #optional list of DNS suffixes to search, passed as DHCP option > # to the guest > # > -# @ip6-prefix: #optional IPv6 network prefix (default is fec0::) (since 2.6) > +# @ip6-prefix: #optional IPv6 network prefix. Set to :: to disable IPv6 completely (default is fec0::) (since 2.6) The new lines here seem to be longer than 80 characters ... I think you should wrap them. Apart from that, the patch looks fine to me. Thomas