On 14.02.2016 18:47, Samuel Thibault wrote:
> From: Guillaume Subiron <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Samuel Thibault <[email protected]>
> ---
> 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))
?
Thomas