summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/netif
diff options
context:
space:
mode:
Diffstat (limited to 'etc/rc.d/netif')
-rwxr-xr-xetc/rc.d/netif60
1 files changed, 50 insertions, 10 deletions
diff --git a/etc/rc.d/netif b/etc/rc.d/netif
index 19b857f..7aac42d 100755
--- a/etc/rc.d/netif
+++ b/etc/rc.d/netif
@@ -28,7 +28,7 @@
# PROVIDE: netif
# REQUIRE: atm1 FILESYSTEMS serial sppp sysctl
# REQUIRE: ipfilter ipfs
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
. /etc/rc.subr
. /etc/network.subr
@@ -38,7 +38,8 @@ start_cmd="network_start"
stop_cmd="network_stop"
cloneup_cmd="clone_up"
clonedown_cmd="clone_down"
-extra_commands="cloneup clonedown"
+clear_cmd="doclear"
+extra_commands="cloneup clonedown clear"
cmdifn=
set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
@@ -46,6 +47,8 @@ set_rcvar_obsolete ipv6_prefer
network_start()
{
+ local _if
+
# Set the list of interfaces to work on.
#
cmdifn=$*
@@ -58,18 +61,15 @@ network_start()
# disable SIGINT (Ctrl-c) when running at startup
trap : 2
- # Create cloned interfaces
- clone_up
-
# Create Fast EtherChannel interfaces
fec_up
+ fi
- # Create IPv6<-->IPv4 tunnels
- gif_up
+ # Create cloned interfaces
+ clone_up $cmdifn
- # Rename interfaces.
- ifnet_rename
- fi
+ # Rename interfaces.
+ ifnet_rename $cmdifn
# Configure the interface(s).
network_common ifn_start
@@ -81,16 +81,46 @@ network_start()
if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then
/etc/rc.d/bridge start $cmdifn
fi
+ if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
+ for _if in $cmdifn; do
+ /etc/rc.d/routing start any $_if
+ done
+ fi
}
network_stop()
{
+ _clone_down=1
+ network_stop0 $*
+}
+
+doclear()
+{
+ _clone_down=
+ network_stop0 $*
+}
+
+network_stop0()
+{
+ local _if
+
# Set the list of interfaces to work on.
#
cmdifn=$*
# Deconfigure the interface(s)
network_common ifn_stop
+
+ # Destroy cloned interfaces
+ if [ -n "$_clone_down" ]; then
+ clone_down $cmdifn
+ fi
+
+ if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
+ for _if in $cmdifn; do
+ /etc/rc.d/routing stop any $_if
+ done
+ fi
}
# network_common routine
@@ -127,6 +157,16 @@ network_common()
_fail=
_ok=
for ifn in ${_cooked_list}; do
+ # Skip if ifn does not exist.
+ case $_func in
+ ifn_stop)
+ if ! ${IFCONFIG_CMD} $ifn > /dev/null 2>&1; then
+ warn "$ifn does not exist. Skipped."
+ _fail="${_fail} ${ifn}"
+ continue
+ fi
+ ;;
+ esac
if ${_func} ${ifn} $2; then
_ok="${_ok} ${ifn}"
if ipv6if ${ifn}; then
OpenPOWER on IntegriCloud