Bug 165769 - [rc][jai][ipv6] IPv6 Initialization on external iface is too slow for jail
Summary: [rc][jai][ipv6] IPv6 Initialization on external iface is too slow for jail
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 9.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-rc mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-06 05:20 UTC by olevole
Modified: 2018-05-28 19:44 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description olevole 2012-03-06 05:20:09 UTC
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

Fix: 

sorry
How-To-Repeat: ifconfig <ext_iface> inet6 <ipv6> && jail -c path=/ ip6.addr=<ipv6> command=nc -6 -l 1234
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2012-03-12 00:29:07 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-jail

probably needs to be worked around in the jail infrastructure.
Comment 2 Bjoern A. Zeeb freebsd_committer 2012-03-12 11:25:37 UTC
Responsible Changed
From-To: freebsd-jail->freebsd-rc

/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.
Comment 3 Bjoern A. Zeeb freebsd_committer 2012-03-12 12:21:01 UTC
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!
Comment 4 Steve Wills freebsd_committer 2014-10-25 20:23:47 UTC
I've just run into this issue myself. I have a jail with two IPs, one ipv4 and one ipv6, and apache starts up in the jail. Apache is supposed to listed on both IPs but the v6 address isn't up before the apache rc script is called, so it fails. Adding a "sleep 1" to the top of the apache rc script works as a temporary work around, or adding "sleep 1" in rc.conf. Given netwait has "KEYWORD: nojail" now, I think Mark's comment that this should be worked around in the jail infrastructure is probably right.
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:44:57 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.