From owner-freebsd-net@FreeBSD.ORG  Fri Apr  2 09:25:08 2010
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A3A551065693
	for <freebsd-net@freebsd.org>; Fri,  2 Apr 2010 09:25:08 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3])
	by mx1.freebsd.org (Postfix) with ESMTP id 343DF8FC20
	for <freebsd-net@freebsd.org>; Fri,  2 Apr 2010 09:25:08 +0000 (UTC)
Received: from localhost (amavis.fra.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id 4E84C41C796;
	Fri,  2 Apr 2010 11:25:06 +0200 (CEST)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([192.168.74.103])
	by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id cPmLkBhnjFyD; Fri,  2 Apr 2010 11:25:05 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id C688841C7A7; Fri,  2 Apr 2010 11:25:05 +0200 (CEST)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id F32D54448EC;
	Fri,  2 Apr 2010 09:22:53 +0000 (UTC)
Date: Fri, 2 Apr 2010 09:22:53 +0000 (UTC)
From: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: Pieter de Boer <pieter@thedarkside.nl>
In-Reply-To: <4BB4FB93.8020108@thedarkside.nl>
Message-ID: <20100402092153.M40281@maildrop.int.zabbadoz.net>
References: <4BB4FB93.8020108@thedarkside.nl>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: freebsd-net@freebsd.org
Subject: Re: ::1 magically replaced with other address (2)
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Apr 2010 09:25:08 -0000

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.