forked from extern/shorewall_code
Merge branch 'master' into 4.4.19
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
commit
8fa41771bd
@ -518,7 +518,11 @@ save_default_route() {
|
||||
#
|
||||
# Restore the default route that was in place before the initial 'shorewall start'
|
||||
#
|
||||
replace_default_route() {
|
||||
replace_default_route() # $1 = USE_DEFAULT_RT
|
||||
{
|
||||
#
|
||||
# default_route and result are inherited from the caller
|
||||
#
|
||||
if [ -n "$default_route" ]; then
|
||||
case "$default_route" in
|
||||
*metric*)
|
||||
@ -540,12 +544,12 @@ replace_default_route() {
|
||||
restore_default_route() # $1 = USE_DEFAULT_RT
|
||||
{
|
||||
local result
|
||||
result=1
|
||||
|
||||
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
|
||||
local default_route
|
||||
default_route=
|
||||
local route
|
||||
result=1
|
||||
|
||||
while read route ; do
|
||||
case $route in
|
||||
|
@ -506,41 +506,43 @@ save_default_route() {
|
||||
#
|
||||
# Restore the default route that was in place before the initial 'shorewall start'
|
||||
#
|
||||
replace_default_route() {
|
||||
qt $IP -6 route replace $default_route && \
|
||||
result=0 && \
|
||||
progress_message "Default Route (${default_route# }) restored"
|
||||
replace_default_route() # $1 = USE_DEFAULT_RT
|
||||
{
|
||||
#
|
||||
# default_route and result are inherited from the caller
|
||||
#
|
||||
if [ -n "$default_route" ]; then
|
||||
case "$default_route" in
|
||||
*metric*)
|
||||
#
|
||||
# Don't restore a default route with a metric unless USE_DEFAULT_RT=Yes. Otherwise, we only replace the one with metric 0
|
||||
#
|
||||
[ -n "$1" ] && qt $IP -6 route replace $default_route && progress_message "Default Route (${default_route# }) restored"
|
||||
default_route=
|
||||
;;
|
||||
*)
|
||||
qt $IP -6 route replace $default_route && progress_message "Default Route (${default_route# }) restored"
|
||||
result=0
|
||||
default_route=
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
restore_default_route() # $1 = USE_DEFAULT_RT
|
||||
{
|
||||
local result
|
||||
result=1
|
||||
|
||||
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
|
||||
local default_route
|
||||
default_route=
|
||||
local route
|
||||
result=1
|
||||
|
||||
while read route ; do
|
||||
case $route in
|
||||
default*)
|
||||
if [ -n "$default_route" ]; then
|
||||
case "$default_route" in
|
||||
*metric*)
|
||||
#
|
||||
# Don't restore a default route with a metric unless USE_DEFAULT_RT=Yes. Otherwise, we only replace the one with metric 0
|
||||
#
|
||||
[ -n "$1" ] && replace_default_route
|
||||
default_route=
|
||||
;;
|
||||
*)
|
||||
replace_default_route
|
||||
default_route=
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
replace_default_route $1
|
||||
default_route="$default_route $route"
|
||||
;;
|
||||
*)
|
||||
@ -549,9 +551,9 @@ restore_default_route() # $1 = USE_DEFAULT_RT
|
||||
esac
|
||||
done < ${VARDIR}/default_route
|
||||
|
||||
if [ -n "$default_route" ]; then
|
||||
replace_default_route
|
||||
elif [ $result = 1 ]; then
|
||||
replace_default_route $1
|
||||
|
||||
if [ $result = 1 ]; then
|
||||
#
|
||||
# We added a default route with metric 0 but there wasn't one previously
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user