summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2022-01-11 00:48:46 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2022-01-11 00:48:46 +0000
commit834999b52b6fd4e5a1945d3fcc3377f3ecfa3024 (patch)
tree34ec2217c0196e4b3422bf1a77ec946c9b2c0b84
parentc5d75818df75ee8048a06e94372011b801ea778d (diff)
Split 2nd half of enable_network() into a sub-function enable_ifs().
This is the piece which loops over hostname.* files and runs ifconfig like the inner loop of base /etc/netstart
-rw-r--r--distrib/miniroot/install.sub40
1 files changed, 23 insertions, 17 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index fa19e3bc456..e40e36423a0 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1187 2022/01/05 16:35:35 deraadt Exp $
+# $OpenBSD: install.sub,v 1.1188 2022/01/11 00:48:45 deraadt Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -2453,22 +2453,8 @@ ifstart() {
}
# Configure the network during upgrade based on the on-disk configuration.
-enable_network() {
- local _f _gw _v4set=false _v6set=false _hn _if _trunks _svlans _vlans
-
- # Use installed network configuration files during upgrade.
- for _f in dhclient.conf resolv.conf; do
- if [[ -f /mnt/etc/$_f ]]; then
- cp /mnt/etc/$_f /etc/$_f
- fi
- done
-
- # Create a minimal hosts file.
- echo "127.0.0.1\tlocalhost" >/tmp/i/hosts
- echo "::1\t\tlocalhost" >>/tmp/i/hosts
-
- _f=/mnt/etc/soii.key
- [[ -f $_f ]] && sysctl "net.inet6.ip6.soiikey=$(<$_f)"
+enable_ifs() {
+ local _gw _v4set=false _v6set=false _hn _if _trunks _svlans _vlans
# Set the address for the loopback interface. Bringing the
# interface up, automatically invokes the IPv6 address ::1.
@@ -2523,6 +2509,26 @@ enable_network() {
route -qn add -net 127 127.0.0.1 -reject >/dev/null
}
+enable_network() {
+ local _f
+
+ # Use installed network configuration files during upgrade.
+ for _f in dhclient.conf resolv.conf; do
+ if [[ -f /mnt/etc/$_f ]]; then
+ cp /mnt/etc/$_f /etc/$_f
+ fi
+ done
+
+ # Create a minimal hosts file.
+ echo "127.0.0.1\tlocalhost" >/tmp/i/hosts
+ echo "::1\t\tlocalhost" >>/tmp/i/hosts
+
+ _f=/mnt/etc/soii.key
+ [[ -f $_f ]] && sysctl "net.inet6.ip6.soiikey=$(<$_f)"
+
+ enable_ifs
+}
+
# Fetch the list of mirror servers and installer choices from previous runs if
# available from ftplist.cgi. Start the ftp process in the background, but kill
# it if it takes longer than 12 seconds.