From nobody@FreeBSD.org  Tue Mar  6 05:11:25 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BDA441065686
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  6 Mar 2012 05:11:25 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id A8C358FC22
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  6 Mar 2012 05:11:25 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q265BPNo096662
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 6 Mar 2012 05:11:25 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q265BP6D096661;
	Tue, 6 Mar 2012 05:11:25 GMT
	(envelope-from nobody)
Message-Id: <201203060511.q265BP6D096661@red.freebsd.org>
Date: Tue, 6 Mar 2012 05:11:25 GMT
From: Oleg Ginzburg <olevole@olevole.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: IPv6 Initialization on external iface is too slow for jail
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         165769
>Category:       conf
>Synopsis:       [rc][jai][ipv6] IPv6 Initialization on external iface is too slow for jail
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-rc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 06 05:20:09 UTC 2012
>Closed-Date:    
>Last-Modified:  Mon Jun 18 14:18:20 UTC 2012
>Originator:     Oleg Ginzburg
>Release:        9.0-RELEASE, STABLE and 10.0-CURRENT
>Organization:
>Environment:
FreeBSD gizmo.my.domain 9.0-STABLE FreeBSD 9.0-STABLE #1: Thu Feb 23 21:52:05 MSK 2012     root@gizmo.my.domain:/usr/obj/usr/src/sys/G  amd64
>Description:
I have found that at start JAIL creating IPv6 the address on the interface,
inet6  stack isn't ready, therefore programs in automatic loading usually
aren't capable to listen to a socket. It is reproduced on external interfaces
(I tested on nfe and msk), but not for loopback.

Delay in 1 seconds between setup ip and jail start is enough.

good for lo0:
% ifconfig lo0 inet6 fd9c:8e81:4e64:a6e6::10/64 ; jail -c path=/ ip6.addr=fd9c:8e81:4e64:a6e6::10 command=nc -6 -l 1234
^C
% ifconfig lo0 inet6 fd9c:8e81:4e64:a6e6::10 -alias

good with delay:
% ifconfig msk0 inet6 fd9c:8e81:4e64:a6e6::10/64 ; sleep 1; jail -c path=/ ip6.addr=fd9c:8e81:4e64:a6e6::10 command=nc -6 -l 1234
^C
% ifconfig msk0 inet6 fd9c:8e81:4e64:a6e6::10 -alias

good wihtout jail:
% ifconfig msk0 ifdisabled
% ifconfig msk0 inet6 fd9c:8e81:4e64:a6e6::10/64 ; nc -6 -l 1234
^C
% ifconfig msk0 inet6 fd9c:8e81:4e64:a6e6::10/64

bind error:
% ifconfig msk0 inet6 fd9c:8e81:4e64:a6e6::10/64  ; jail -c path=/ ip6.addr=fd9c:8e81:4e64:a6e6::10 command=nc -6 -l 1234
% ifconfig msk0 inet6 fd9c:8e81:4e64:a6e6::10/64

bind error (In a case when ipv6 it is not initialized, delays in 1
second don't suffice):
% ifconfig msk0 inet6 ifdisabled
% ifconfig msk0 inet6 fd9c:8e81:4e64:a6e6::10/64 ; sleep 1 ; jail -c path=/ ip6.addr=fd9c:8e81:4e64:a6e6::10 command=nc -6 -l 1234

>How-To-Repeat:
ifconfig <ext_iface> inet6 <ipv6> && jail -c path=/ ip6.addr=<ipv6> command=nc -6 -l 1234
>Fix:
sorry

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-jail 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Mar 12 00:29:07 UTC 2012 
Responsible-Changed-Why:  
probably needs to be worked around in the jail infrastructure. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165769 
Responsible-Changed-From-To: freebsd-jail->freebsd-rc 
Responsible-Changed-By: bz 
Responsible-Changed-When: Mon Mar 12 11:25:37 UTC 2012 
Responsible-Changed-Why:  
/etc/rc.d/netwait  needs to learn about IPv6. 

This has nothing to do with jails, just with interfaces, possibly 
switch ports and spanning tree. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165769 

From: "Bjoern A. Zeeb" <bz@freebsd.org>
To: Oleg Ginzburg <olevole@olevole.ru>,
 bug-followup@FreeBSD.org
Cc: freebsd-jail <freebsd-jail@freebsd.org>
Subject: Re: kern/165769: [rc][jai][ipv6] IPv6 Initialization on external iface is too slow for jail
Date: Mon, 12 Mar 2012 12:21:01 +0000

 On 12. Mar 2012, at 12:01 , Oleg Ginzburg wrote:
 
 > =D0=97=D0=B4=D1=80=D0=B0=D0=B2=D1=81=D1=82=D0=B2=D1=83=D0=B9=D1=82=D0=B5=
 ,
 >=20
 > On Monday 12 March 2012 15:27:32 bz@freebsd.org wrote:
 >> This has nothing to do with jails, just with interfaces, possibly
 >> switch ports and spanning tree.
 >=20
 > /etc/rc.d/netwait the script concerns only in a case "complete"-type =
 jail, not=20
 > for "service"-type as is written in my example
 
 I don't see a difference but I see what you mean with "on start" which I =
 treated
 as "on boot".  The answer unfortunately is - DAD is not supposed to take =
 that
 long that it would matter, so the NIC drivers are probably silly or are =
 required
 to do silly things.  I wonder if you might even see a DOWN/UP cycle.
 
 The workaround you can apply is to use the prestart option to the jail =
 to add that
 sleep 1 you need and let the startup script configure the IP addresses =
 for you.
 See jail_exec_prestart<n> in man 5 rc.conf.
 
 
 /bz
 
 --=20
 Bjoern A. Zeeb                                 You have to have visions!
    It does not matter how good you are. It matters what good you do!
 
>Unformatted:
