Index | Thread | Search

From:
Andrew Hewus Fresh <andrew@afresh1.com>
Subject:
Re: installer: default to IPv6 autoconf if IPv4 is not configured
To:
Klemens Nanni <kn@openbsd.org>
Cc:
OpenBSD tech <tech@openbsd.org>
Date:
Sat, 15 Nov 2025 20:01:03 -0800

Download raw body.

Thread
On Fri, Nov 14, 2025 at 04:14:06PM +0000, Klemens Nanni wrote:
> When you opt out of IPv4, the only sane default for IPv6 becomes 'autoconf'
> as we cannot magically guess an address and 'none' means no network at all,
> which is equivalent to not configuring the interface in the first place:
> 
> 	 Available network interfaces are: vio0 vlan0.
> 	 Network interface to configure? (name, lladdr, '?', or 'done') [vio0] 
> 	 IPv4 address for vio0? (or 'autoconf' or 'none') [autoconf] none
> 	-IPv6 address for vio0? (or 'autoconf' or 'none') [none] 
> 	+IPv6 address for vio0? (or 'autoconf' or 'none') [autoconf] 
> 
> The diff is trivial and the result is typing convenience for installs
> (upgrades don't run these questions) in IPv6-mostly or -only networks.
> 
> Feedback? OK?

I didn't have time to test this, but it looks OK to me and seems like a
nice idea.  I wonder if we will ever get to the point where it makes
sense to always default this to on.

 
> Index: install.sub
> ===================================================================
> RCS file: /cvs/src/distrib/miniroot/install.sub,v
> diff -u -p -U9 -r1.1280 install.sub
> --- install.sub	1 Nov 2025 12:54:17 -0000	1.1280
> +++ install.sub	14 Nov 2025 15:34:26 -0000
> @@ -1101,36 +1101,38 @@ v4_config() {
>  	while :; do
>  		ask_until "IPv4 address for $_if? (or 'autoconf' or 'none')" \
>  			  "${_addr:-autoconf}"
>  		case $resp in
>  		none)	return
>  			;;
>  		a|autoconf|dhcp)
>  			dhcp_request $_if
>  			echo "inet autoconf" >>$_hn
> +			USES_IPV4=true
>  			return
>  			;;
>  		esac
>  
>  		_newaddr=$resp
>  
>  		# Ask for the netmask if the user did not use CIDR notation.
>  		if [[ $_newaddr == */* ]]; then
>  			ifconfig $_if $_newaddr up
>  		else
>  			ask_until "Netmask for $_if?" "${_mask:-255.255.255.0}"
>  			ifconfig $_if $_newaddr netmask $resp
>  		fi
>  
>  		set -- $(v4_info $_if)
>  		if [[ -n $2 ]]; then
>  			echo "inet $2 $3" >>$_hn
>  			add_hostent "$2" "$_name"
> +			USES_IPV4=true
>  			return
>  		fi
>  
>  		$AI && exit 1
>  	done
>  }
>  
>  # Obtain and output the inet6 information related to interface $1.
>  # <flags>\n<addr> <prefixlen> <rest of inet6 line>[\n<more inet6 lines>]
> @@ -1215,19 +1217,19 @@ v6_defroute() {
>  # unless he chooses 'autoconf'.
>  v6_config() {
>  	local _if=$1 _name=$2 _hn=$3 _addr _newaddr _prefixlen
>  
>  	ifconfig lo0 inet6 >/dev/null 2>&1 || return
>  
>  	# Preset the default answers by preserving possibly existing
>  	# configuration from previous runs.
>  	set -- $(v6_info $_if)
> -	if [[ $1 == *AUTOCONF6* ]]; then
> +	if [[ $1 == *AUTOCONF6* ]] || ! $USES_IPV4; then
>  		_addr=autoconf
>  	elif [[ -n $2 ]]; then
>  		_addr=$2
>  		_prefixlen=$3
>  	fi
>  
>  	# Nuke existing inet6 configuration.
>  	ifconfig $_if -inet6
>  
> @@ -3657,18 +3659,19 @@ HTTP_LIST=/tmp/i/httplist
>  HTTP_SEC=/tmp/i/httpsec
>  INSTALL_METHOD=
>  NIFS=0
>  export PS1="$MODE# "
>  PUB_KEY=/etc/signify/openbsd-${VERSION}-base.pub
>  ROOTDEV=
>  ROOTDISK=
>  SETDIR="$VNAME/$ARCH"
>  UPGRADE_BSDRD=false
> +USES_IPV4=false
>  V4_AUTOCONF=false
>  V6_AUTOCONF=false
>  WLANLIST=/tmp/i/wlanlist
>  
>  # Are we in a real release, or a snapshot?  If this is a snapshot
>  # install media, default us to a snapshot directory.
>  HTTP_SETDIR=$SETDIR
>  set -- $(scan_dmesg "/^OpenBSD $VNAME\([^ ]*\).*$/s//\1/p")
>  [[ $1 == -!(stable) ]] && HTTP_SETDIR=snapshots/$ARCH
> 

-- 
andrew

Whatever happened to the days when hacking started at the cerebral cortex 
and not the keyboard?
                      -- Sid from UserFriendly.org