diff options
author | hrs <hrs@FreeBSD.org> | 2013-10-10 07:41:11 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2013-10-10 07:41:11 +0000 |
commit | 028a23e8a8be61d8c8bf8e10c9853997db1eec58 (patch) | |
tree | 3b31c1b3747bc17ad87137a9082fa32a9ba9ecd7 /etc/rc.d/netif | |
parent | 981609eebab29132c522028ba3265970ad0bfac0 (diff) | |
download | FreeBSD-src-028a23e8a8be61d8c8bf8e10c9853997db1eec58.zip FreeBSD-src-028a23e8a8be61d8c8bf8e10c9853997db1eec58.tar.gz |
Add support for "vnet jname" argument in ifconfig_IF. The vnet keyword
is ignored except for "rc.d/netif vnet{up,down} ifn" because a jail is
usually created after interface initialization on boot time.
"rc.d/netif vnetup ifn" moves ifn into the specified jail. It is
designed to be used in other scripts like rc.d/jail, not automatically
invoked during the interface initialization.
Approved by: re (kib)
Diffstat (limited to 'etc/rc.d/netif')
-rwxr-xr-x | etc/rc.d/netif | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/etc/rc.d/netif b/etc/rc.d/netif index 2cb7754..daece80 100755 --- a/etc/rc.d/netif +++ b/etc/rc.d/netif @@ -39,7 +39,9 @@ stop_cmd="network_stop" cloneup_cmd="clone_up" clonedown_cmd="clone_down" clear_cmd="doclear" -extra_commands="cloneup clonedown clear" +vnetup_cmd="vnet_up" +vnetdown_cmd="vnet_down" +extra_commands="cloneup clonedown clear vnetup vnetdown" cmdifn= set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces @@ -123,6 +125,20 @@ network_stop0() fi } +vnet_up() +{ + cmdifn=$* + + network_common ifn_vnetup $cmdifn +} + +vnet_down() +{ + cmdifn=$* + + network_common ifn_vnetdown $cmdifn +} + # network_common routine # Common configuration subroutine for network interfaces. This # routine takes all the preparatory steps needed for configuriing @@ -198,7 +214,7 @@ network_common() # inet6 address configuration needs sleep for DAD. case ${_func}:${_dadwait} in - ifn_start:1) + ifn_start:1|ifn_vnetup:1|ifn_vnetdown:1) sleep `${SYSCTL_N} net.inet6.ip6.dad_count` sleep 1 ;; @@ -209,12 +225,25 @@ network_common() case ${_func} in ifn_start) _str='Starting' - ;; + ;; ifn_stop) _str='Stopping' - ;; + ;; + ifn_vnetup) + _str='Moving' + ;; + ifn_vnetdown) + _str='Reclaiming' + ;; esac echo "${_str} Network:${_ok}." + case ${_func} in + ifn_vnetup) + # Clear _ok not to do "ifconfig $ifn" + # because $ifn is no longer in the current vnet. + _ok= + ;; + esac if check_startmsgs; then for ifn in ${_ok}; do /sbin/ifconfig ${ifn} |