summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2019-05-03 20:38:15 +0000
committerkrw <krw@openbsd.org>2019-05-03 20:38:15 +0000
commit00cfe70824ab42a0dd09ab0e762c18fd22f86fa7 (patch)
treeb0a5a27de192fca3cf2419a50762ac894a9902cb
parentFurther removal of differences (using install instead of cp, sorting (diff)
downloadwireguard-openbsd-00cfe70824ab42a0dd09ab0e762c18fd22f86fa7.tar.xz
wireguard-openbsd-00cfe70824ab42a0dd09ab0e762c18fd22f86fa7.zip
Bring v6_config() into the modern age. Remember
'autoconf' if install restarts. Be more careful to keep things clean. Remove unnecessary checks left over from rtsol days. Started by claudio@ noticing 'autoconf' is not remembered. ok florian@ kn@ (mostly)
-rw-r--r--distrib/miniroot/install.sub62
1 files changed, 28 insertions, 34 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 6a16e6694d0..1dcb731f751 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1119 2019/05/02 06:19:33 florian Exp $
+# $OpenBSD: install.sub,v 1.1120 2019/05/03 20:38:15 krw Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -1117,53 +1117,47 @@ v6_config() {
# Preset the default answers by preserving possibly existing
# configuration from previous runs.
set -- $(v6_info $_if)
- [[ -n $2 ]] && { _addr=$2; _prefixlen=$3; }
+ if [[ $1 == *AUTOCONF6* ]]; then
+ _addr=autoconf
+ elif [[ -n $2 ]]; then
+ _addr=$2
+ _prefixlen=$3
+ fi
- ifconfig $_if inet6 >/dev/null 2>&1 && _prompt="or 'autoconf' "
- _prompt="IPv6 address for $_if? (${_prompt}or 'none')"
+ _prompt="IPv6 address for $_if? (or 'autoconf' or 'none')"
while :; do
ask_until "$_prompt" "${_addr:-none}"
case $resp in
- none) return
+ none) ifconfig $_if -inet6
+ return
;;
autoconf)
- if ! ifconfig $_if inet6 >/dev/null 2>&1; then
- echo "No INET6 support."
- $AI && exit 1 || return
+ # Nuke any existing address before enabling autoconf.
+ ifconfig $_if -inet6
+ ifconfig $_if inet6 autoconf up
+ echo "inet6 autoconf" >>$_hn
+ return
+ ;;
+ *) ifconfig $_if inet6 -autoconf
+ _addr=${resp%%/*}
+ if [[ $resp == */* ]]; then
+ _prefixlen=${resp##$_addr/}
+ else
+ ask_until "IPv6 prefix length for $_if?" "64"
+ _prefixlen=$resp
fi
- if ifconfig $_if inet6 autoconf; then
- echo "inet6 autoconf" >>$_hn
+ if ifconfig $_if inet6 $_addr/$_prefixlen up; then
+ echo "inet6 $_addr $_prefixlen" >>$_hn
+ add_hostent "$_addr" "$_name"
+ v6_defroute $_if
return
- else
- echo "inet6 autoconf failed."
- $AI && exit 1 || return
fi
;;
- *) _addr=$resp
- ;;
esac
- # Ask for prefix length if the user did not use CIDR notation.
- if [[ $_addr == */* ]]; then
- _prefixlen=
- else
- ask_until "IPv6 prefix length for $_if?" "${_prefixlen:=64}"
- _prefixlen=$resp
- fi
-
- if ifconfig $_if inet6 $_addr ${_prefixlen:+prefixlen $_prefixlen} up; then
- echo "inet6 $_addr $_prefixlen" >>$_hn
- add_hostent "${_addr%%/*}" "$_name"
- break
- else
- _addr=
- _prefixlen=
- $AI && exit 1
- fi
+ $AI && exit 1
done
-
- v6_defroute $_if
}
# Perform an 802.11 network scan on interface $1 and cache the result a file.