summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-10-31 19:25:17 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-10-31 19:25:17 +0000
commitfbb55d12bd7b78e3e0efa0475167f68e17d7ceec (patch)
treefc61d9af66de6e80fbcfef849b1e785825069cf1 /etc
parentdc2be189e9c2d2a367329981458d27d9852df6a3 (diff)
Improve shell style wrt. variable naming/boolean convention
The mixed use of upper and lower case variables is neither obvious nor consistent. PRINT_ONLY is local to netstart. ip6kernel is local to netstart. multicast gets sourced from rc.subr(8). 1. uppercase ip6kernel as is common for global variables in base scripts 2. use the simpler true/false idiom and default with the rest of netstart-only variables, making it clearer that only `multicast=YES/NO' comes from the rc environment 3. hoist kernel feature detection such that a later diff can load the SOII key conditionally 4. zap obvious comment OK aja
Diffstat (limited to 'etc')
-rw-r--r--etc/netstart18
1 files changed, 8 insertions, 10 deletions
diff --git a/etc/netstart b/etc/netstart
index 2b9006d8248..e80a04b2e8c 100644
--- a/etc/netstart
+++ b/etc/netstart
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: netstart,v 1.222 2022/10/24 20:51:07 kn Exp $
+# $OpenBSD: netstart,v 1.223 2022/10/31 19:25:16 kn Exp $
# Turn off Strict Bourne shell mode.
set +o sh
@@ -313,6 +313,7 @@ _rc_parse_conf
PRINT_ONLY=false
V4_AUTOCONF=false
V6_AUTOCONF=false
+IP6KERNEL=false
while getopts ":n" opt; do
case $opt in
@@ -322,6 +323,11 @@ while getopts ":n" opt; do
done
shift $((OPTIND-1))
+if ifconfig lo0 inet6 >/dev/null 2>&1; then
+ IP6KERNEL=true
+ ip6routes
+fi
+
# Load key material for the generation of IPv6 Semantically Opaque Interface
# Identifiers (SOII) used for link local and SLAAC addresses.
$PRINT_ONLY || [[ ! -f /etc/soii.key ]] ||
@@ -349,14 +355,6 @@ else
ifconfig lo0 inet 127.0.0.1/8
fi
-# IPv6 configuration.
-if ifconfig lo0 inet6 >/dev/null 2>&1; then
- ip6kernel=YES
- ip6routes
-else
- ip6kernel=NO
-fi
-
# Create all the pseudo interfaces up front.
vifscreate
@@ -396,7 +394,7 @@ $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 == YES ]]; then
+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