From 5ee650a7ce63e132742c8500d2e6bfef38af6c07 Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 11 Jan 2022 00:48:45 +0000 Subject: [PATCH] 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 --- distrib/miniroot/install.sub | 40 +++++++++++++++++++++--------------- 1 file 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 @@ -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. -- 2.20.1