From mboxrd@z Thu Jan 1 00:00:00 1970 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 Date: Wed, 17 Feb 2016 10:36:35 +0100 From: Samuel Thibault 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56C43D3A.1080100@redhat.com> Subject: Re: [Qemu-devel] [PATCHv7 8/9] slirp: Adding IPv6 address for DNS relay List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: zhanghailiang , Li Zhijian , Stefan Hajnoczi , Jason Wang , qemu-devel@nongnu.org, Vasiliy Tolstov , Dave Gilbert , Gonglei , Jan Kiszka , Huangpeng , Guillaume Subiron 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: 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)) Samuel