From: florian Date: Sun, 26 Jun 2022 09:36:13 +0000 (+0000) Subject: Wait for autoconf interfaces to come up in netstart(8) instead of X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f96b97a3cb70f83e9d497334dbead51ba5f41b92;p=openbsd Wait for autoconf interfaces to come up in netstart(8) instead of rc(8). This makes tunnel interfaces work that depend on working autoconf interfaces. OK deraadt --- diff --git a/etc/netstart b/etc/netstart index 5fcb77568db..33e9689a819 100644 --- a/etc/netstart +++ b/etc/netstart @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: netstart,v 1.217 2022/02/22 06:44:40 dlg Exp $ +# $OpenBSD: netstart,v 1.218 2022/06/26 09:36:13 florian Exp $ # Turn off Strict Bourne shell mode. set +o sh @@ -272,6 +272,17 @@ ip6routes() { unset _cmds } +# wait for autoconf interfaces +wait_autoconf_default() { + if ifconfig | grep -q ': flags=.*<.*AUTOCONF.*>'; then + count=0 + while ((count++ < 20)); do + route -n show | grep -q ^default && break + sleep .5 + done + fi +} + # 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 @@ -359,6 +370,9 @@ else route -qn add -net 127 127.0.0.1 -reject fi +# If interface autoconf exists, pause a little for at least one default route +wait_autoconf_default + # Configure interfaces that rely on routing ifmstart "tun tap gif etherip gre egre nvgre eoip vxlan pflow wg" diff --git a/etc/rc b/etc/rc index a0325c74508..ac57a67676c 100644 --- a/etc/rc +++ b/etc/rc @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.557 2022/06/26 08:08:23 florian Exp $ +# $OpenBSD: rc,v 1.558 2022/06/26 09:36:13 florian Exp $ # System startup script run by init on autoboot or after single-user. # Output and error are redirected to console by init, and the console is the @@ -462,15 +462,6 @@ random_seed reorder_libs -# If interface autoconf exists, pause a little for at least one default route -if ifconfig | grep -q ': flags=.*<.*AUTOCONF.*>'; then - count=0 - while ((count++ < 20)); do - route -n show | grep -q ^default && break - sleep .5 - done -fi - # Load pf rules and bring up pfsync interface. if [[ $pf != NO ]]; then if [[ -f /etc/pf.conf ]]; then