On Wed, Oct 26, 2022 at 05:37:33PM +0000, Klemens Nanni wrote:
> There is no point in waiting when only printing would-be commands.
Updated diff:
- do not wait for DAD completion in dry-mode
- now that we have a proper true/false IP6KERNEL
- with feedback from claudio@ to move DAD completion to wait_dad() just
like the existing wait_autoconf_default()
- use local `_count' in each function as usual rather then the same
global `count'
Feedback? OK?
Index: netstart
===================================================================
RCS file: /cvs/src/etc/netstart,v
retrieving revision 1.225
diff -u -p -r1.225 netstart
--- netstart 31 Oct 2022 20:14:45 -0000 1.225
+++ netstart 31 Oct 2022 20:27:19 -0000
@@ -290,15 +290,25 @@ ip6routes() {
# wait for autoconf interfaces
wait_autoconf_default() {
+ local _count=0
+
if ifconfig | grep -q ': flags=.*<.*AUTOCONF.*>'; then
- count=0
- while ((count++ < 20)); do
+ while ((_count++ < 20)); do
route -n show | grep -q ^default && break
sleep .5
done
fi
}
+# Ensure IPv6 Duplicate Address Detection (DAD) is completed.
+wait_dad() {
+ local _count=0
+
+ while ((_count++ < 10 && $(sysctl -n net.inet6.ip6.dad_pending) != 0));
do
+ sleep 1
+ done
+}
+
# Make sure the invoking user has the right privileges. Check for presence of
# id(1) to avoid problems with diskless setups.
if [[ -x /usr/bin/id ]] && (($(id -u) != 0)); then
@@ -397,10 +407,6 @@ $PRINT_ONLY || wait_autoconf_default
# Configure interfaces that rely on routing
ifmstart "tun tap gif etherip gre egre nvgre eoip vxlan pflow wg"
-if $IP6KERNEL; then
- # Ensure IPv6 Duplicate Address Detection (DAD) is completed.
- count=0
- while ((count++ < 10 && $(sysctl -n net.inet6.ip6.dad_pending) != 0));
do
- sleep 1
- done
+if $IP6KERNEL && ! $PRINT_ONLY; then
+ wait_dad
fi