[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv7 8/9] slirp: Adding IPv6 address for DNS relay
From: |
Samuel Thibault |
Subject: |
Re: [Qemu-devel] [PATCHv7 8/9] slirp: Adding IPv6 address for DNS relay |
Date: |
Wed, 17 Feb 2016 10:36:35 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Thomas Huth, on Wed 17 Feb 2016 10:28:26 +0100, wrote:
> On 14.02.2016 18:47, Samuel Thibault wrote:
> > From: Guillaume Subiron <address@hidden>
> >
> > 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 <address@hidden>
> > Signed-off-by: Samuel Thibault <address@hidden>
> > ---
> > 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