Here's an initial draft of a diff to allow configuring by lladdr in the installer. I'm not a super fan of how it works, but could use some feedback from folks trying it and suggesting improvements.
It's a larger diff than I first expected since I didn't want to include the lladdrs in the "available interfaces" list, but ask_which() doesn't allow two lists. Index: distrib/miniroot/install.sub =================================================================== RCS file: /cvs/src/distrib/miniroot/install.sub,v retrieving revision 1.1215 diff -u -p -r1.1215 install.sub --- distrib/miniroot/install.sub 5 Dec 2022 20:12:00 -0000 1.1215 +++ distrib/miniroot/install.sub 7 Dec 2022 02:08:03 -0000 @@ -356,6 +356,16 @@ get_ifs() { done } +get_ifs_and_lladdrs() { + local _if _lladdr + for _if in $(get_ifs); do + _lladdr=$(ifconfig $_if | + sed -n 's/^[[:space:]]*lladdr[[:space:]]//p' ) + [[ -n $_lladdr && -n $(ifconfig -M $_lladdr) ]] && + echo $_lladdr + done +} + # Return the device name of the disk device $1, which may be a disklabel UID. get_dkdev_name() { local _dev=${1#/dev/} _d @@ -1291,7 +1301,7 @@ ieee80211_config() { # Set up IPv4 and IPv6 interface configuration. configure_ifs() { - local _first _hn _if _name _p _vi _vn + local _first _hn _if _name _p _q _vi _vn # Always need lo0 configured. ifconfig lo0 inet 127.0.0.1/8 @@ -1306,12 +1316,33 @@ configure_ifs() { [[ -n $_vi ]] && ((_vi++)) [[ -n $(get_ifs) ]] && _vn="vlan${_vi:-0}" - ask_which "network interface" "do you wish to configure" \ - "\$(get_ifs) $_vn" \ - ${_p:-'$( (get_ifs netboot; get_ifs) | sed q )'} - [[ $resp == done ]] && break + echo "Available network interfaces are: $(get_ifs) $_vn." + _q="Which network interface do you wish to configure?" + ask_until "$_q (name, lladdr, '?', or 'done')" \ + ${_p:-$( (get_ifs netboot; get_ifs) | sed q )} + case $resp in + done) break + ;; + \?) for _name in $(get_ifs); do + ifconfig $_name | grep -e ^[^[:space:]] \ + -e ^[[:space:]]*lladdr[[:space:]] \ + -e ^[[:space:]]*status[[:space:]] + done + ;; + *) # Quote $resp to prevent user from confusing isin() by + # entering something like 'a a'. + if isin "$resp" $( get_ifs_and_lladdrs ) $_vn done; then + log_answers "$_q" "$resp" + _if=$resp + else + echo "'$resp' is not a valid choice." + $AI && [[ -n $AI_RESPFILE ]] && exit 1 + fi + ;; + esac + + [[ -z $_if ]] && continue - _if=$resp _hn=/tmp/i/hostname.$_if rm -f $_hn @@ -1319,6 +1350,15 @@ configure_ifs() { # questions and bring it up. if [[ $_if == vlan+([0-9]) ]]; then vlan_config $_if || continue + fi + + # Test if we're configuring by lladdr + if [[ $_if == ??:??:??:??:??:?? ]]; then + _if=$( ifconfig -M $_if ) + if [[ -z $_if ]]; then + echo "'${#/tmp/i/hostname.}' does not refer to a valid interface." + continue + fi fi # Test if it is an 802.11 interface.