routing.subr (252987) | routing.subr (256181) |
---|---|
1if [ ! "$_NETWORKING_ROUTING_SUBR" ]; then _NETWORKING_ROUTING_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_ROUTING_SUBR" ]; then _NETWORKING_ROUTING_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/routing.subr 252987 2013-07-07 18:51:44Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/networking/share/routing.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/routing.subr 34f_include $BSDCFG_SHARE/dialog.subr 35f_include $BSDCFG_SHARE/media/tcpip.subr --- 34 unchanged lines hidden (view full) --- 70 # Return with-error when there are NFS-mounts currently active. If the 71 # default router/gateway is changed while NFS-exported directories are 72 # mounted, the system will hang. 73 # 74 if f_nfs_mounted && ! f_jailed; then 75 local setting="$( printf "$msg_current_default_router" \ 76 "$defaultrouter" )" 77 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/routing.subr 34f_include $BSDCFG_SHARE/dialog.subr 35f_include $BSDCFG_SHARE/media/tcpip.subr --- 34 unchanged lines hidden (view full) --- 70 # Return with-error when there are NFS-mounts currently active. If the 71 # default router/gateway is changed while NFS-exported directories are 72 # mounted, the system will hang. 73 # 74 if f_nfs_mounted && ! f_jailed; then 75 local setting="$( printf "$msg_current_default_router" \ 76 "$defaultrouter" )" 77 f_noyes "$msg_nfs_mounts_may_cause_hang" "$setting" || |
78 return $FAILURE | 78 return $DIALOG_CANCEL |
79 fi 80 81 # 82 # Loop until the user provides taint-free input. 83 # 84 local retval 85 while :; do 86 f_dialog_input defaultrouter \ 87 "$msg_please_enter_default_router" \ 88 "$defaultrouter" "$hline_num_punc_tab_enter" 89 retval=$? | 79 fi 80 81 # 82 # Loop until the user provides taint-free input. 83 # 84 local retval 85 while :; do 86 f_dialog_input defaultrouter \ 87 "$msg_please_enter_default_router" \ 88 "$defaultrouter" "$hline_num_punc_tab_enter" 89 retval=$? |
90 [ "$defaultrouter" ] || return $SUCCESS 91 [ $retval -eq $SUCCESS ] || return $retval | 90 [ "$defaultrouter" ] || return $DIALOG_OK 91 [ $retval -eq $DIALOG_OK ] || return $retval |
92 93 # Taint-check the user's input 94 f_dialog_validate_ipaddr "$defaultrouter" && break 95 done 96 97 # 98 # Save only if the user changed the default router/gateway. 99 # --- 7 unchanged lines hidden (view full) --- 107 # 108 # Only ask to apply setting if the current defaultrouter is different 109 # than the stored configuration (in rc.conf(5)). 110 # 111 if [ "$( f_route_get_default )" != "$defaultrouter" ]; then 112 f_dialog_clear 113 f_yesno "$msg_activate_default_router" \ 114 "$( f_route_get_default )" "$defaultrouter" | 92 93 # Taint-check the user's input 94 f_dialog_validate_ipaddr "$defaultrouter" && break 95 done 96 97 # 98 # Save only if the user changed the default router/gateway. 99 # --- 7 unchanged lines hidden (view full) --- 107 # 108 # Only ask to apply setting if the current defaultrouter is different 109 # than the stored configuration (in rc.conf(5)). 110 # 111 if [ "$( f_route_get_default )" != "$defaultrouter" ]; then 112 f_dialog_clear 113 f_yesno "$msg_activate_default_router" \ 114 "$( f_route_get_default )" "$defaultrouter" |
115 if [ $? -eq $SUCCESS ]; then | 115 if [ $? -eq $DIALOG_OK ]; then |
116 local err 117 118 # Apply the default router/gateway 119 f_quietly route delete default 120 err=$( route add default "$defaultrouter" 2>&1 ) 121 if [ $? -ne $SUCCESS ]; then 122 f_dialog_msgbox "$err" | 116 local err 117 118 # Apply the default router/gateway 119 f_quietly route delete default 120 err=$( route add default "$defaultrouter" 2>&1 ) 121 if [ $? -ne $SUCCESS ]; then 122 f_dialog_msgbox "$err" |
123 return $FAILURE | 123 return $DIALOG_CANCEL |
124 fi 125 fi 126 fi 127} 128 129############################################################ MAIN 130 131f_dprintf "%s: Successfully loaded." networking/routing.subr 132 133fi # ! $_NETWORKING_ROUTING_SUBR | 124 fi 125 fi 126 fi 127} 128 129############################################################ MAIN 130 131f_dprintf "%s: Successfully loaded." networking/routing.subr 132 133fi # ! $_NETWORKING_ROUTING_SUBR |