summaryrefslogtreecommitdiffstats
path: root/etc/rc.d
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2013-10-04 02:44:04 +0000
committerhrs <hrs@FreeBSD.org>2013-10-04 02:44:04 +0000
commit1315bdcd1cb1cd6133a697efac8e34fd2b7903ab (patch)
tree230a4591ff8d7297e51d314631ce760e55075e73 /etc/rc.d
parente1fc8db7f4a9e657f4a1f9a4ea365414aee5f4e3 (diff)
downloadFreeBSD-src-1315bdcd1cb1cd6133a697efac8e34fd2b7903ab.zip
FreeBSD-src-1315bdcd1cb1cd6133a697efac8e34fd2b7903ab.tar.gz
Add epair(4) support in $cloned_interfaces. One should be specified
as "epair0" in $cloned_interfaces and "epair0[ab]" in the others in rc.conf like the following: cloned_interfaces="epair0" ifconfig_epair0a="inet 192.168.1.1/24" ifconfig_epair0b="inet 192.168.2.1/24" /etc/rc.d/netif now accepts both "netif start epair0" and "netif start epair0a". Approved by: re (kib)
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/netif31
1 files changed, 25 insertions, 6 deletions
diff --git a/etc/rc.d/netif b/etc/rc.d/netif
index 7aac42d..2cb7754 100755
--- a/etc/rc.d/netif
+++ b/etc/rc.d/netif
@@ -72,7 +72,7 @@ network_start()
ifnet_rename $cmdifn
# Configure the interface(s).
- network_common ifn_start
+ network_common ifn_start $cmdifn
if [ -f /etc/rc.d/ipfilter ] ; then
# Resync ipfilter
@@ -109,7 +109,7 @@ network_stop0()
cmdifn=$*
# Deconfigure the interface(s)
- network_common ifn_stop
+ network_common ifn_stop $cmdifn
# Destroy cloned interfaces
if [ -n "$_clone_down" ]; then
@@ -129,7 +129,7 @@ network_stop0()
# an interface and then calls $routine.
network_common()
{
- local _cooked_list _fail _func _ok _str
+ local _cooked_list _tmp_list _fail _func _ok _str _cmdifn
_func=
@@ -137,26 +137,45 @@ network_common()
err 1 "network_common(): No function name specified."
else
_func="$1"
+ shift
fi
# Set the scope of the command (all interfaces or just one).
#
_cooked_list=
- if [ -n "$cmdifn" ]; then
+ _tmp_list=
+ _cmdifn=$*
+ if [ -n "$_cmdifn" ]; then
# Don't check that the interface(s) exist. We need to run
# the down code even when the interface doesn't exist to
# kill off wpa_supplicant.
# XXXBED: is this really true or does wpa_supplicant die?
# if so, we should get rid of the devd entry
- _cooked_list="$cmdifn"
+ _cooked_list="$_cmdifn"
else
_cooked_list="`list_net_interfaces`"
fi
+ # Expand epair[0-9] to epair[0-9][ab].
+ for ifn in $_cooked_list; do
+ case ${ifn#epair} in
+ [0-9]*[ab]) ;; # Skip epair[0-9]*[ab].
+ [0-9]*)
+ for _str in $_cooked_list; do
+ case $_str in
+ $ifn) _tmp_list="$_tmp_list ${ifn}a ${ifn}b" ;;
+ *) _tmp_list="$_tmp_list ${ifn}" ;;
+ esac
+ done
+ _cooked_list=${_tmp_list# }
+ ;;
+ esac
+ done
+
_dadwait=
_fail=
_ok=
- for ifn in ${_cooked_list}; do
+ for ifn in ${_cooked_list# }; do
# Skip if ifn does not exist.
case $_func in
ifn_stop)
OpenPOWER on IntegriCloud