::1 magically replaced with other address (2)

Pieter de Boer pieter at thedarkside.nl
Thu Apr 1 20:20:40 UTC 2010

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)

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?


More information about the freebsd-net mailing list