#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1214 2022/11/06 21:32:54 kn Exp $
+# $OpenBSD: install.sub,v 1.1215 2022/12/05 20:12:00 afresh1 Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
local _if=$1 _hn=/mnt/etc/hostname.$1 _cmds _i=0 _line
set -A _cmds
+ if [[ $_if == ??:??:??:??:??:?? ]]; then
+ _if=$(ifconfig -M $_if)
+ [[ -z $_if ]] && return # invalid interface
+ [[ -e /mnt/etc/hostname.$_if ]] && return # duplicate config
+ fi
+
# Create interface if it does not yet exist.
{ ifconfig $_if || ifconfig $_if create; } >/dev/null 2>&1 || return
svlan) _svlans="$_svlans $_if";;
vlan) _vlans="$_vlans $_if";;
esac
+ elif [[ $_if == ??:??:??:??:??:?? ]]; then
+ # start by lladdr
+ ifstart $_if
else
# 'Real' interfaces (if available) are done now.
ifconfig $_if >/dev/null 2>&1 && ifstart $_if
#!/bin/sh -
#
-# $OpenBSD: netstart,v 1.229 2022/11/05 12:06:05 kn Exp $
+# $OpenBSD: netstart,v 1.230 2022/12/05 20:12:00 afresh1 Exp $
# Turn off Strict Bourne shell mode.
set +o sh
local _if=$1 _hn=/etc/hostname.$1 _cmds _i=0 _line _stat
set -A _cmds
+ if [[ $_if == ??:??:??:??:??:?? ]]; then
+ if ! _line=$( ifconfig -M $_if ); then
+ print -u2 "${0##*/}: $_if is not unique."
+ return
+ fi
+
+ [[ -z $_line ]] && return
+ _if=$_line
+ _line=
+
+ if [[ -e /etc/hostname.$_if ]]; then
+ print -u2 "${0##*/}: $_hn: /etc/hostname.$_if overrides"
+ return
+ fi
+ fi
+
# Interface names must be alphanumeric only. We check to avoid
# configuring backup or temp files, and to catch the "*" case.
[[ $_if != +([[:alpha:]])+([[:digit:]]) ]] && return
local _sifs=$1 _xifs=$2 _hn _if _sif _xif
for _sif in ${_sifs:-ALL}; do
- for _hn in /etc/hostname.+([[:alpha:]])+([[:digit:]]); do
+ for _hn in /etc/hostname.@(+([[:alpha:]])+([[:digit:]])|??:??:??:??:??:??); do
[[ -f $_hn ]] || continue
_if=${_hn#/etc/hostname.}
- # Skip unwanted ifs.
- for _xif in $_xifs; do
- [[ $_xif == ${_if%%[0-9]*} ]] && continue 2
- done
+ if [[ $_if == +([[:alpha:]])+([[:digit:]]) ]]; then
+ # Skip unwanted ifs.
+ for _xif in $_xifs; do
+ [[ $_xif == ${_if%%[0-9]*} ]] && continue 2
+ done
+ fi
# Start wanted ifs.
[[ $_sif == @(ALL|${_if%%[0-9]*}) ]] && ifstart $_if
-.\" $OpenBSD: hostname.if.5,v 1.79 2022/07/26 00:36:54 kn Exp $
+.\" $OpenBSD: hostname.if.5,v 1.80 2022/12/05 20:12:00 afresh1 Exp $
.\" $NetBSD: hosts.5,v 1.4 1994/11/30 19:31:20 jtc Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\"
.\" @(#)hosts.5 8.2 (Berkeley) 12/11/93
.\"
-.Dd $Mdocdate: July 26 2022 $
+.Dd $Mdocdate: December 5 2022 $
.Dt HOSTNAME.IF 5
.Os
.Sh NAME
The
.Nm hostname.*\&
files contain information regarding the configuration of each network interface.
-One file should exist for each interface that is to be configured, such as
-.Pa hostname.fxp0
+The interface can be referenced by name or lladdr, such as
+.Pa hostname.fxp0 ,
+.Pa hostname.00:00:5e:00:53:af ,
or
.Pa hostname.bridge0 .
+One file should exist for each interface that is to be configured,
+with priority given to configuration by interface name over lladdr.
A configuration file is not needed for lo0.
.Pp
The configuration information is expressed in a line-by-line packed format