diff options
author | dteske <dteske@FreeBSD.org> | 2014-04-14 01:44:56 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2014-04-14 01:44:56 +0000 |
commit | 4f557eb9380e350e00df186d627969b28ea499a8 (patch) | |
tree | 00bb6a6eea5764702d03d61c8ace4e43d4b012aa /etc/network.subr | |
parent | 7c94aa998b99433249dd333543dac870e358fee1 (diff) | |
download | FreeBSD-src-4f557eb9380e350e00df186d627969b28ea499a8.zip FreeBSD-src-4f557eb9380e350e00df186d627969b28ea499a8.tar.gz |
MFC r264243:
Loosen the processing of *_IF_aliasN vars to be less strict. Previously,
the first alias had to be _alias0 and processing stopped at the first non-
defined variable (preventing gaps). Allowing gaps gives the administrator
the ability to group aliases in an adhoc manner and also lifts the
requirement to renumber aliases simply to comment-out an existing one.
Aliases are processed in numerical ascending order.
NB: Also Patches mdconfig{,2} rc(8) boot scripts to loosen the numbering
scheme for mdconfig_mdN settings to be less strict in the same manner.
Discussed on: -rc
Diffstat (limited to 'etc/network.subr')
-rw-r--r-- | etc/network.subr | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/etc/network.subr b/etc/network.subr index f92cab1..7a289cf 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -285,10 +285,8 @@ get_if_var() fi _if=$1 - _punct=". - / +" - for _punct_c in $_punct; do - _if=`ltr ${_if} ${_punct_c} '_'` - done + _punct=".-/+" + ltr ${_if} "${_punct}" '_' _if _var=$2 _default=$3 @@ -1081,6 +1079,7 @@ ifalias_af_common_handler() ifalias_af_common() { local _ret _if _af _action alias ifconfig_args _aliasn _c _tmpargs _iaf + local _punct=".-/+" _ret=1 _aliasn= @@ -1088,10 +1087,14 @@ ifalias_af_common() _af=$2 _action=$3 + # Normalize $_if before using it in a pattern to list_vars() + ltr "$_if" "$_punct" "_" _if + # ifconfig_IF_aliasN which starts with $_af - alias=0 - while : ; do - ifconfig_args=`get_if_var $_if ifconfig_IF_alias${alias}` + for alias in `list_vars ifconfig_${_if}_alias[0-9]\* | + sort_lite -nk1.$((9+${#_if}+7))` + do + eval ifconfig_args=\"\$$alias\" _iaf= case $ifconfig_args in inet\ *) _iaf=inet ;; @@ -1113,15 +1116,15 @@ ifalias_af_common() warn "\$ifconfig_${_if}_alias${alias} needs " \ "\"inet\" keyword for an IPv4 address." esac - alias=$(($alias + 1)) done # backward compatibility: ipv6_ifconfig_IF_aliasN. case $_af in inet6) - alias=0 - while : ; do - ifconfig_args=`get_if_var $_if ipv6_ifconfig_IF_alias${alias}` + for alias in `list_vars ipv6_ifconfig_${_if}_alias[0-9]\* | + sort_lite -nk1.$((14+${#_if}+7))` + do + eval ifconfig_args=\"\$$alias\" case ${_action}:"${ifconfig_args}" in *:"") break @@ -1133,7 +1136,6 @@ ifalias_af_common() "instead." ;; esac - alias=$(($alias + 1)) done esac |