diff options
Diffstat (limited to 'etc/network.subr')
-rw-r--r-- | etc/network.subr | 131 |
1 files changed, 15 insertions, 116 deletions
diff --git a/etc/network.subr b/etc/network.subr index f92cab1b1015..aa72749c6967 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -51,7 +51,6 @@ ifn_start() if ! noafif $ifn; then afexists inet && ipv4_up ${ifn} && cfg=0 afexists inet6 && ipv6_up ${ifn} && cfg=0 - afexists ipx && ipx_up ${ifn} && cfg=0 fi childif_create ${ifn} && cfg=0 @@ -71,7 +70,6 @@ ifn_stop() [ -z "$ifn" ] && err 1 "ifn_stop called without an interface" if ! noafif $ifn; then - afexists ipx && ipx_down ${ifn} && cfg=0 afexists inet6 && ipv6_down ${ifn} && cfg=0 afexists inet && ipv4_down ${ifn} && cfg=0 fi @@ -285,10 +283,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 @@ -495,9 +491,6 @@ afexists() inet|inet6) check_kern_features ${_af} ;; - ipx) - ${SYSCTL_N} net.ipx > /dev/null 2>&1 - ;; atm) if [ -x /sbin/atmconfig ]; then /sbin/atmconfig diag list > /dev/null 2>&1 @@ -1081,6 +1074,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,15 +1082,18 @@ 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 ;; inet6\ *) _iaf=inet6 ;; - ipx\ *) _iaf=ipx ;; link\ *) _iaf=link ;; ether\ *) _iaf=ether ;; esac @@ -1113,15 +1110,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 +1130,6 @@ ifalias_af_common() "instead." ;; esac - alias=$(($alias + 1)) done esac @@ -1146,7 +1142,7 @@ ifalias_af_common() _tmpargs= for _c in `get_if_var $_if ifconfig_IF_aliases` $_aliasn; do case $_c in - inet|inet6|ipx|link|ether) + inet|inet6|link|ether) case $_tmpargs in ${_af}\ *) eval ifalias_af_common_handler $_if $_af $_action $_tmpargs && _ret=0 @@ -1520,103 +1516,6 @@ ng_create_one() done } -# ng_fec_create ifn -# Configure Fast EtherChannel for interface $ifn. Returns 0 if -# FEC arguments were found and configured; returns !0 otherwise. -ng_fec_create() -{ - local req_iface iface bogus - req_iface="$1" - - ngctl shutdown ${req_iface}: > /dev/null 2>&1 - - bogus="" - while true; do - iface=`ng_create_one fec dummy fec` - if [ -z "${iface}" ]; then - exit 2 - fi - if [ "${iface}" = "${req_iface}" ]; then - break - fi - bogus="${bogus} ${iface}" - done - - for iface in ${bogus}; do - ngctl shutdown ${iface}: - done -} - -# fec_up -# Create Fast EtherChannel interfaces. -fec_up() -{ - local i j - - for i in ${fec_interfaces}; do - ng_fec_create $i - for j in `get_if_var $i fecconfig_IF`; do - case ${j} in - '') - continue - ;; - *) - ngctl msg ${i}: add_iface "\"${j}\"" - ;; - esac - done - done -} - -# ipx_up ifn -# Configure any IPX addresses for interface $ifn. Returns 0 if -# IPX arguments were found and configured; returns 1 otherwise. -# -ipx_up() -{ - local ifn - ifn="$1" - - # ifconfig_IF_ipx - ifconfig_args=`_ifconfig_getargs $ifn ipx` - if [ -n "${ifconfig_args}" ]; then - ${IFCONFIG_CMD} ${ifn} ${ifconfig_args} - return 0 - fi - - return 1 -} - -# ipx_down ifn -# Remove IPX addresses for interface $ifn. Returns 0 if IPX -# addresses were found and unconfigured. It returns 1, otherwise. -# -ipx_down() -{ - local _if _ifs _ret ipxList oldifs _ipx - _if=$1 - _ifs="^" - _ret=1 - ipxList="`${IFCONFIG_CMD} ${_if} | grep 'ipx ' | tr "\n" "$_ifs"`" - oldifs="$IFS" - - IFS="$_ifs" - for _ipx in $ipxList ; do - # get rid of extraneous line - [ -z "$_ipx" ] && break - - _ipx=`expr "$_ipx" : '.*\(ipx [0-9a-h]\{1,8\}H*\.[0-9a-h]\{1,12\}\).*'` - - IFS="$oldifs" - ${IFCONFIG_CMD} ${_if} ${_ipx} delete - IFS="$_ifs" - _ret=0 - done - IFS="$oldifs" - - return $_ret -} - # ifnet_rename [ifname] # Rename interfaces if ifconfig_IF_name is defined. # |