OpenWRT have apparently removed the
/etc/init.d/aiccu
start script in order not to violate the
SixXS terms of service regarding repeated and
unattended tunnel setup.
However, I want to have the router try one tunnel setup after I have manually switched it on.
Now, in order to have aiccu successfully set up a tunnel, we will have to ensure a set of conditions is met when we run `aiccu start´.
- IPv4 connectivity to
tic.sixxs.net
- IPv4 connectivity to my POP
- local system time must be accurate
In my case, I can reasonably guesstimate the IPv4 connectivity by the presence of a default route.
However, guessing wether the system time is accurate on a system without an RTC is not that trivial - at first glance.
Fortunately, the NTP daemon which comes with OpenWRT can run a program
when it receives a time update, so we can change its init script to
add -S /etc/ntp-hook
to the ntpd arguments.
1 2 3 4 5 6 7 8 9 |
|
The hook just writes the current time into a file /tmp/date
which
does not exist on bootup. So the presence of /tmp/date
indicates the
ntp-hook
has run at least once, which means that we have a proper
system time.
1 2 3 |
|
Note that we need to be careful to start aiccu
from rc.local
in
the background, so that the init startup process can continue.
1 2 3 4 5 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|