Merge branch 'master' into 4.4.19

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2011-04-14 12:28:10 -07:00
commit 8fa41771bd
2 changed files with 32 additions and 26 deletions

View File

@ -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

View File

@ -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
#