diff mbox

[PATCHv7,8/9] slirp: Adding IPv6 address for DNS relay

Message ID 20160217093635.GB3716@var.bordeaux.inria.fr
State New
Headers show

Commit Message

Samuel Thibault Feb. 17, 2016, 9:36 a.m. UTC
Thomas Huth, on Wed 17 Feb 2016 10:28:26 +0100, wrote:
> On 14.02.2016 18:47, Samuel Thibault wrote:
> > From: Guillaume Subiron <maethor@subiron.org>
> > 
> > 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 <maethor@subiron.org>
> > Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> > ---
> >  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

Comments

Samuel Thibault Feb. 19, 2016, 12:26 a.m. UTC | #1
Samuel Thibault, on Wed 17 Feb 2016 10:36:35 +0100, wrote:
> 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))

Oops, I meant

+#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)))
diff mbox

Patch

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))