network.subr (254743) | network.subr (255653) |
---|---|
1# 2# Copyright (c) 2003 The FreeBSD Project. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23# SUCH DAMAGE. 24# | 1# 2# Copyright (c) 2003 The FreeBSD Project. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23# SUCH DAMAGE. 24# |
25# $FreeBSD: head/etc/network.subr 254743 2013-08-23 23:12:16Z asomers $ | 25# $FreeBSD: head/etc/network.subr 255653 2013-09-17 20:22:24Z hrs $ |
26# 27IFCONFIG_CMD="/sbin/ifconfig" 28 29# Maximum number of addresses expanded from a address range specification. 30_IPEXPANDMAX=31 31 32# 33# Subroutines commonly used from network startup scripts. --- 615 unchanged lines hidden (view full) --- 649{ 650 local _if _ifs _ret inetList oldifs _inet 651 _if=$1 652 _ifs="^" 653 _ret=1 654 655 ifalias ${_if} inet -alias && _ret=0 656 | 26# 27IFCONFIG_CMD="/sbin/ifconfig" 28 29# Maximum number of addresses expanded from a address range specification. 30_IPEXPANDMAX=31 31 32# 33# Subroutines commonly used from network startup scripts. --- 615 unchanged lines hidden (view full) --- 649{ 650 local _if _ifs _ret inetList oldifs _inet 651 _if=$1 652 _ifs="^" 653 _ret=1 654 655 ifalias ${_if} inet -alias && _ret=0 656 |
657 inetList="`${IFCONFIG_CMD} ${_if} | grep 'inet ' | tr "\n" "$_ifs"`" | 657 inetList="`${IFCONFIG_CMD} ${_if} | grep 'inet ' | tr "\n\t" "$_ifs"`" |
658 659 oldifs="$IFS" 660 IFS="$_ifs" 661 for _inet in $inetList ; do 662 # get rid of extraneous line 663 case $_inet in | 658 659 oldifs="$IFS" 660 IFS="$_ifs" 661 for _inet in $inetList ; do 662 # get rid of extraneous line 663 case $_inet in |
664 "") break ;; 665 \ inet\ *|inet\ *) ;; 666 *) continue ;; | 664 inet\ *) ;; 665 *) continue ;; |
667 esac | 666 esac |
668 [ -z "$_inet" ] && break | |
669 670 _inet=`expr "$_inet" : '.*\(inet \([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*'` 671 672 IFS="$oldifs" 673 ${IFCONFIG_CMD} ${_if} ${_inet} delete 674 IFS="$_ifs" 675 _ret=0 676 done --- 14 unchanged lines hidden (view full) --- 691 if ! ipv6if $_if; then 692 return 0 693 fi 694 695 ipv6_accept_rtadv_down ${_if} && _ret=0 696 ipv6_prefix_hostid_addr_common ${_if} -alias && _ret=0 697 ifalias ${_if} inet6 -alias && _ret=0 698 | 667 668 _inet=`expr "$_inet" : '.*\(inet \([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*'` 669 670 IFS="$oldifs" 671 ${IFCONFIG_CMD} ${_if} ${_inet} delete 672 IFS="$_ifs" 673 _ret=0 674 done --- 14 unchanged lines hidden (view full) --- 689 if ! ipv6if $_if; then 690 return 0 691 fi 692 693 ipv6_accept_rtadv_down ${_if} && _ret=0 694 ipv6_prefix_hostid_addr_common ${_if} -alias && _ret=0 695 ifalias ${_if} inet6 -alias && _ret=0 696 |
699 inetList="`${IFCONFIG_CMD} ${_if} | grep 'inet6 ' | tr "\n" "$_ifs"`" | 697 inetList="`${IFCONFIG_CMD} ${_if} | grep 'inet6 ' | tr "\n\t" "$_ifs"`" |
700 701 oldifs="$IFS" 702 IFS="$_ifs" 703 for _inet6 in $inetList ; do 704 # get rid of extraneous line | 698 699 oldifs="$IFS" 700 IFS="$_ifs" 701 for _inet6 in $inetList ; do 702 # get rid of extraneous line |
705 [ -z "$_inet6" ] && break | 703 case $_inet in 704 inet6\ *) ;; 705 *) continue ;; 706 esac |
706 707 _inet6=`expr "$_inet6" : '.*\(inet6 \([0-9a-f:]*\)\).*'` 708 709 IFS="$oldifs" 710 ${IFCONFIG_CMD} ${_if} ${_inet6} -alias 711 IFS="$_ifs" 712 _ret=0 713 done --- 994 unchanged lines hidden --- | 707 708 _inet6=`expr "$_inet6" : '.*\(inet6 \([0-9a-f:]*\)\).*'` 709 710 IFS="$oldifs" 711 ${IFCONFIG_CMD} ${_if} ${_inet6} -alias 712 IFS="$_ifs" 713 _ret=0 714 done --- 994 unchanged lines hidden --- |