diff options
author | dteske <dteske@FreeBSD.org> | 2014-07-23 22:47:00 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2014-07-23 22:47:00 +0000 |
commit | d5c68f14ecad7bcd6772033ed2cb0142d4b1a5dc (patch) | |
tree | a95eb942596d8ffa17fe8d5044c061629db62e0b /etc | |
parent | aef31c62ce2878a7891dd4490adb5bc0b1c42c45 (diff) | |
download | FreeBSD-src-d5c68f14ecad7bcd6772033ed2cb0142d4b1a5dc.zip FreeBSD-src-d5c68f14ecad7bcd6772033ed2cb0142d4b1a5dc.tar.gz |
MFC r267812 (hrs): Fix ifname normalization. ifconfig_IF_alias{es,N} did not
work if ifname has any of [.-/+].
While here, also perform the following to reduce diff size between major
branches for etc/network.subr:
MFC r266475 (rea): Fix warning messages after r252015
$alias used to hold alias number, but now it carries full variable name,
so messages were tuned to account for that.
Other fixes:
- eliminate unneeded double spaces;
- tell user where inet/inet6 keywords are expected to be.
Reviewed by: hrs
Spotted by: jhay
PR: conf/191961
Diffstat (limited to 'etc')
-rw-r--r-- | etc/network.subr | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/etc/network.subr b/etc/network.subr index 7a289cf..b5c30fa 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -183,7 +183,7 @@ ifconfig_up() # backward compatibility: inet6 keyword case "${ifconfig_args}" in :*|[0-9a-fA-F]*:*) - warn "\$ifconfig_$1_ipv6 needs " \ + warn "\$ifconfig_$1_ipv6 needs leading" \ "\"inet6\" keyword for an IPv6 address." ifconfig_args="inet6 ${ifconfig_args}" ;; @@ -1079,7 +1079,7 @@ ifalias_af_common_handler() ifalias_af_common() { local _ret _if _af _action alias ifconfig_args _aliasn _c _tmpargs _iaf - local _punct=".-/+" + local _vif _punct=".-/+" _ret=1 _aliasn= @@ -1088,11 +1088,11 @@ ifalias_af_common() _action=$3 # Normalize $_if before using it in a pattern to list_vars() - ltr "$_if" "$_punct" "_" _if + ltr "$_if" "$_punct" "_" _vif # ifconfig_IF_aliasN which starts with $_af - for alias in `list_vars ifconfig_${_if}_alias[0-9]\* | - sort_lite -nk1.$((9+${#_if}+7))` + for alias in `list_vars ifconfig_${_vif}_alias[0-9]\* | + sort_lite -nk1.$((9+${#_vif}+7))` do eval ifconfig_args=\"\$$alias\" _iaf= @@ -1113,7 +1113,7 @@ ifalias_af_common() ;; inet:alias:"":*) _aliasn="$_aliasn inet $ifconfig_args" - warn "\$ifconfig_${_if}_alias${alias} needs " \ + warn "\$${alias} needs leading" \ "\"inet\" keyword for an IPv4 address." esac done @@ -1121,8 +1121,8 @@ ifalias_af_common() # backward compatibility: ipv6_ifconfig_IF_aliasN. case $_af in inet6) - for alias in `list_vars ipv6_ifconfig_${_if}_alias[0-9]\* | - sort_lite -nk1.$((14+${#_if}+7))` + for alias in `list_vars ipv6_ifconfig_${_vif}_alias[0-9]\* | + sort_lite -nk1.$((14+${#_vif}+7))` do eval ifconfig_args=\"\$$alias\" case ${_action}:"${ifconfig_args}" in @@ -1131,9 +1131,8 @@ ifalias_af_common() ;; alias:*) _aliasn="${_aliasn} inet6 ${ifconfig_args}" - warn "\$ipv6_ifconfig_${_if}_alias${alias} " \ - "is obsolete. Use ifconfig_$1_aliasN " \ - "instead." + warn "\$${alias} is obsolete. " \ + "Use ifconfig_${_vif}_aliasN instead." ;; esac done |