summaryrefslogtreecommitdiffstats
path: root/distrib
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2021-03-12 11:32:03 +0000
committerkn <kn@openbsd.org>2021-03-12 11:32:03 +0000
commit13c27aa6861b5ddf2842a257786779b4fea490af (patch)
treea5946cebcc5f6500edf03948bb36efdaacd39108 /distrib
parentspelling (diff)
downloadwireguard-openbsd-13c27aa6861b5ddf2842a257786779b4fea490af.tar.xz
wireguard-openbsd-13c27aa6861b5ddf2842a257786779b4fea490af.zip
Emulate "[inet] autoconf" hostname.if(5) lines with "dhcp"
With dhcpleased(8) in base, netstart(8) and ifconfig(8) understand both "autoconf" and "inet autoconf" lines in hostname.if(5) files to signal the new daemon. The installer however currently has only dhclient(8), hence manual upgrades with "[inet] autoconf" instead of "dhcp" in hostname.if files would fail to establish IPv4 connectivity. Make install.sub's netstart clone treat autoconf lines like old fashioned dhcp lines such users^Wearly testers of the new approach don't get stuck in nyetwork land. Note that this is only relevant for manual upgrades; installation always creates working hostname.if files and automated upgrades with sysupgrade(8) do not care about network/hostname.if files. Idea from deraadt OK deraadt krw ajacoutot
Diffstat (limited to 'distrib')
-rw-r--r--distrib/miniroot/install.sub10
1 files changed, 9 insertions, 1 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 4bef00617cc..81b001f7029 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1161 2021/01/30 18:21:06 krw Exp $
+# $OpenBSD: install.sub,v 1.1162 2021/03/12 11:32:03 kn Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -2343,6 +2343,14 @@ parse_hn_line() {
ifconfig $_if inet6 >/dev/null 2>&1 && _has_inet6=true
[[ -x /sbin/dhclient ]] && _has_dhclient=true
+ # XXX Reverse when dhcpleased is made the default.
+ if { [[ ${_c[_af]} == inet ]] && [[ ${_c[_name]} == autoconf ]]; } ||
+ { [[ ${_c[_af]} == autoconf ]]; }; then
+ # emulate "[inet] autoconf" with "dhcp"
+ [[ ${_c[_af]} == inet ]] && shift 2 || shift 1
+ set -A _c -- dhcp "$@"
+ fi
+
case ${_c[_af]} in
''|*([[:blank:]])'#'*)
return