netmask.subr (252987) | netmask.subr (256181) |
---|---|
1if [ ! "$_NETWORKING_NETMASK_SUBR" ]; then _NETWORKING_NETMASK_SUBR=1 2# 3# Copyright (c) 2006-2013 Devin Teske 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# | 1if [ ! "$_NETWORKING_NETMASK_SUBR" ]; then _NETWORKING_NETMASK_SUBR=1 2# 3# Copyright (c) 2006-2013 Devin Teske 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# |
27# $FreeBSD: head/usr.sbin/bsdconfig/networking/share/netmask.subr 252987 2013-07-07 18:51:44Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/networking/share/netmask.subr 256181 2013-10-09 08:12:26Z dteske $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." networking/netmask.subr 34f_include $BSDCFG_SHARE/dialog.subr 35f_include $BSDCFG_SHARE/networking/common.subr --- 56 unchanged lines hidden (view full) --- 92 # Return with-error when there are NFS-mounts currently active. If the 93 # subnet mask is changed while NFS-exported directories are mounted, 94 # the system may hang (if any NFS mounts are using that interface). 95 # 96 if f_nfs_mounted && ! f_jailed; then 97 local setting="$( printf "$msg_current_subnet" \ 98 "$interface" "$_netmask" )" 99 f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" || | 28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." networking/netmask.subr 34f_include $BSDCFG_SHARE/dialog.subr 35f_include $BSDCFG_SHARE/networking/common.subr --- 56 unchanged lines hidden (view full) --- 92 # Return with-error when there are NFS-mounts currently active. If the 93 # subnet mask is changed while NFS-exported directories are mounted, 94 # the system may hang (if any NFS mounts are using that interface). 95 # 96 if f_nfs_mounted && ! f_jailed; then 97 local setting="$( printf "$msg_current_subnet" \ 98 "$interface" "$_netmask" )" 99 f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" || |
100 return $FAILURE | 100 return $DIALOG_CANCEL |
101 fi 102 103 # 104 # Loop until the user provides taint-free input. 105 # 106 local msg="$( printf "$msg_please_enter_subnet_mask" "$interface" )" 107 while :; do 108 # 109 # Return error status if: 110 # - User has either pressed ESC or chosen Cancel/No 111 # - User has not made any changes to the given value 112 # 113 f_dialog_input _input "$msg" "$_netmask" \ | 101 fi 102 103 # 104 # Loop until the user provides taint-free input. 105 # 106 local msg="$( printf "$msg_please_enter_subnet_mask" "$interface" )" 107 while :; do 108 # 109 # Return error status if: 110 # - User has either pressed ESC or chosen Cancel/No 111 # - User has not made any changes to the given value 112 # 113 f_dialog_input _input "$msg" "$_netmask" \ |
114 "$hline_num_punc_tab_enter" || return 115 [ "$_netmask" = "$_input" ] && return $FAILURE | 114 "$hline_num_punc_tab_enter" || return $? 115 [ "$_netmask" = "$_input" ] && return $DIALOG_CANCEL |
116 117 # Return success if NULL value was entered | 116 117 # Return success if NULL value was entered |
118 [ "$_input" ] || return $SUCCESS | 118 [ "$_input" ] || return $DIALOG_OK |
119 120 # Take only the first "word" of the user's input 121 _netmask="$_input" 122 _netmask="${_netmask%%[$IFS]*}" 123 124 # Taint-check the user's input 125 f_dialog_validate_netmask "$_netmask" && break 126 done 127 128 netmask="$_netmask" 129} 130 131############################################################ MAIN 132 133f_dprintf "%s: Successfully loaded." networking/netmask.subr 134 135fi # ! $_NETWORKING_NETMASK_SUBR | 119 120 # Take only the first "word" of the user's input 121 _netmask="$_input" 122 _netmask="${_netmask%%[$IFS]*}" 123 124 # Taint-check the user's input 125 f_dialog_validate_netmask "$_netmask" && break 126 done 127 128 netmask="$_netmask" 129} 130 131############################################################ MAIN 132 133f_dprintf "%s: Successfully loaded." networking/netmask.subr 134 135fi # ! $_NETWORKING_NETMASK_SUBR |