From patchwork Wed Feb 17 09:36:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 583979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1BA4F140273 for ; Wed, 17 Feb 2016 20:37:06 +1100 (AEDT) Received: from localhost ([::1]:55653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVyXg-00040p-6Q for incoming@patchwork.ozlabs.org; Wed, 17 Feb 2016 04:37:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVyXK-0003FE-0A for qemu-devel@nongnu.org; Wed, 17 Feb 2016 04:36:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVyXE-0005GL-HM for qemu-devel@nongnu.org; Wed, 17 Feb 2016 04:36:41 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:52750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVyXE-0005GH-Bn for qemu-devel@nongnu.org; Wed, 17 Feb 2016 04:36:36 -0500 X-IronPort-AV: E=Sophos;i="5.22,459,1449529200"; d="scan'208";a="203461373" Received: from unknown (HELO var.youpi.perso.aquilenet.fr) ([193.50.110.86]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 17 Feb 2016 10:36:35 +0100 Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.86) (envelope-from ) id 1aVyXD-0002WD-6e; Wed, 17 Feb 2016 10:36:35 +0100 Date: Wed, 17 Feb 2016 10:36:35 +0100 From: Samuel Thibault To: Thomas Huth Message-ID: <20160217093635.GB3716@var.bordeaux.inria.fr> References: <043b3b699753317c270087536c8d239aae2432eb.1455471945.git.samuel.thibault@ens-lyon.org> <56C43D3A.1080100@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <56C43D3A.1080100@redhat.com> User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.134.164.83 Cc: zhanghailiang , Li Zhijian , Stefan Hajnoczi , Jason Wang , qemu-devel@nongnu.org, Vasiliy Tolstov , Dave Gilbert , Gonglei , Jan Kiszka , Huangpeng , Guillaume Subiron Subject: Re: [Qemu-devel] [PATCHv7 8/9] slirp: Adding IPv6 address for DNS relay X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Thomas Huth, on Wed 17 Feb 2016 10:28:26 +0100, wrote: > On 14.02.2016 18:47, Samuel Thibault wrote: > > From: Guillaume Subiron > > > > This patch adds an IPv6 address to the DNS relay. in6_equal_dns() is > > developed using this Slirp attribute. > > sotranslate_in/out/accept() are also updated to manage the IPv6 case so the > > guest can be able to join the host using one of the Slirp addresses. > > > > For now this only points to localhost. Further development will be needed to > > automatically fetch the IPv6 address from resolv.conf, and announce this via > > RDNSS. > > > > Signed-off-by: Guillaume Subiron > > Signed-off-by: Samuel Thibault > > --- > > slirp/ip6.h | 5 ++++- > > slirp/slirp.c | 1 + > > slirp/slirp.h | 1 + > > slirp/socket.c | 32 ++++++++++++++++++++++++++++++++ > > 4 files changed, 38 insertions(+), 1 deletion(-) > > > > diff --git a/slirp/ip6.h b/slirp/ip6.h > > index 9f7623f..ded6d78 100644 > > --- a/slirp/ip6.h > > +++ b/slirp/ip6.h > > @@ -70,7 +70,10 @@ static inline bool in6_equal_mach(const struct in6_addr *a, > > || (in6_equal_net(a, &(struct in6_addr)LINKLOCAL_ADDR, 64)\ > > && in6_equal_mach(a, &slirp->vhost_addr6, 64))) > > > > -#define in6_equal_dns(a) 0 > > +#define in6_equal_dns(a)\ > > + ((in6_equal_net(a, &slirp->vprefix_addr6, slirp->vprefix_len)\ > > + || in6_equal_net(a, &(struct in6_addr)LINKLOCAL_ADDR, 64))\ > > + && in6_equal_mach(a, &slirp->vnameserver_addr6, slirp->vprefix_len)) > > Does this work properly if vprefix_len < 64 ? I think this rather should > be done similar to in6_equal_router(), i.e. something like: > > #define in6_equal_dns(a)\ > ((in6_equal_net(a, &slirp->vprefix_addr6, slirp->vprefix_len) && \ > in6_equal_mach(a, &slirp->vnameserver_addr6, slirp->vprefix_len)) \ > || (in6_equal_net(a, &(struct in6_addr)LINKLOCAL_ADDR, 64)) && \ > in6_equal_mach(a, &slirp->vnameserver_addr6, 64)) > > ? Right, I guess the change in the in6_equal_router didn't get propagated to this patch. That's now like this in my tree: Samuel diff --git a/slirp/ip6.h b/slirp/ip6.h index 9f7623f..9e4844e 100644 --- a/slirp/ip6.h +++ b/slirp/ip6.h @@ -70,7 +70,11 @@ static inline bool in6_equal_mach(const struct in6_addr *a, || (in6_equal_net(a, &(struct in6_addr)LINKLOCAL_ADDR, 64)\ && in6_equal_mach(a, &slirp->vhost_addr6, 64))) -#define in6_equal_dns(a) 0 +#define in6_equal_dns(a)\ + ((in6_equal_net(a, &slirp->vprefix_addr6, slirp->vprefix_len)\ + && in6_equal_mach(a, &slirp->vnameserver_addr6, slirp->vprefix_len))\ + || (in6_equal_net(a, &(struct in6_addr)LINKLOCAL_ADDR, 64))\ + && in6_equal_mach(a, &slirp->vnameserver_addr6, 64)) #define in6_equal_host(a)\ (in6_equal_router(a) || in6_equal_dns(a))