Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Apr 2010 09:22:53 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
To:        Pieter de Boer <pieter@thedarkside.nl>
Cc:        freebsd-net@freebsd.org
Subject:   Re: ::1 magically replaced with other address (2)
Message-ID:  <20100402092153.M40281@maildrop.int.zabbadoz.net>
In-Reply-To: <4BB4FB93.8020108@thedarkside.nl>
References:  <4BB4FB93.8020108@thedarkside.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 1 Apr 2010, Pieter de Boer wrote:

> Hi folks,
>
> A couple of days ago I sent a mail to this list detailing an issue I have. To 
> summarize: every once in a while my ::1 address on lo0 is replaced with 
> another ipv6-address that's configured on lo3 and used in a child jail of a 
> jail. I've been digging a bit through the FreeBSD source code and found a 
> possible spot where this may occur.
>
> In the function in6_selectsrc() in /sys/netinet6/in6_src.c the following code 
> can be found:
>
>
> TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
> ...
>
> 	prison_local_ip6(cred, &ia->ia_addr.sin6_addr,
> 	        (inp != NULL &&
> 	        (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0)
> 	        continue;
> ...
> }
>
> prison_local_ip6() appears to replace a loopback address with a jail's main 
> address:
> if (IN6_IS_ADDR_LOOPBACK(ia6)) {
> 	bcopy(&pr->pr_ip6[0], ia6, sizeof(struct in6_addr));
> ...
>
>
> The way I read this code is that it replaces the interface address 'ia' when 
> it is a loopback address with the prison's main address.
>
> Can anyone with more clue about this code tell if I read this correctly and 
> possibly even help with fixing the problem if that is the case?

You are reading this correctly. Good catch! I'll look how to fix that.

/bz

-- 
Bjoern A. Zeeb         It will not break if you know what you are doing.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100402092153.M40281>