#!/bin/sh -
#
-# $OpenBSD: netstart,v 1.194 2018/02/19 23:42:29 rpe Exp $
+# $OpenBSD: netstart,v 1.195 2018/02/21 19:57:21 rpe Exp $
# Turn off Strict Bourne shell mode.
set +o sh
}
# Create interface $1 if it does not yet exist.
+# Usage: ifcreate if1
ifcreate() {
local _if=$1
}
# Create interfaces for network pseudo-devices referred to by hostname.if files.
+# Usage: vifscreate
vifscreate() {
local _vif _hn _if
done
}
-# Parse /etc/mygate and add default routes for IPv4 and IPv6
+# Parse /etc/mygate and add default routes for IPv4 and IPv6.
# Usage: defaultroute
defaultroute() {
local _cmd;
exit 1
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 ]] ||
sysctl -q "net.inet6.ip6.soiikey=$(</etc/soii.key)"
# automatically invokes the IPv6 address ::1.
ifconfig lo0 inet 127.0.0.1/8
+# IPv6 configuration.
if ifconfig lo0 inet6 >/dev/null 2>&1; then
- # IPv6 configurations.
ip6kernel=YES
# Disallow link-local unicast dest without outgoing scope identifiers.
ip6kernel=NO
fi
-# Create all the pseudo interfaces up front
+# Create all the pseudo interfaces up front.
vifscreate
# Configure all the non-loopback interfaces which we know about, but
# Configure all the carp interfaces which we know about before default route.
ifmstart "trunk svlan vlan carp pppoe"
-# Look for default routes in /etc/mygate.
+# Set default routes for IPv4 and IPv6.
defaultroute
# Multicast routing.
ifmstart "tun tap gif etherip gre egre mobileip pflow"
if [[ $ip6kernel == YES ]]; then
- # This is to make sure DAD is completed before going further.
+ # Ensure IPv6 Duplicate Address Detection (DAD) is completed.
count=0
while ((count++ < 10 && $(sysctl -n net.inet6.ip6.dad_pending) != 0)); do
sleep 1