mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-18 20:30:43 +01:00
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'
|
# 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
|
if [ -n "$default_route" ]; then
|
||||||
case "$default_route" in
|
case "$default_route" in
|
||||||
*metric*)
|
*metric*)
|
||||||
@ -540,12 +544,12 @@ replace_default_route() {
|
|||||||
restore_default_route() # $1 = USE_DEFAULT_RT
|
restore_default_route() # $1 = USE_DEFAULT_RT
|
||||||
{
|
{
|
||||||
local result
|
local result
|
||||||
|
result=1
|
||||||
|
|
||||||
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
|
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
|
||||||
local default_route
|
local default_route
|
||||||
default_route=
|
default_route=
|
||||||
local route
|
local route
|
||||||
result=1
|
|
||||||
|
|
||||||
while read route ; do
|
while read route ; do
|
||||||
case $route in
|
case $route in
|
||||||
|
@ -506,41 +506,43 @@ save_default_route() {
|
|||||||
#
|
#
|
||||||
# Restore the default route that was in place before the initial 'shorewall start'
|
# Restore the default route that was in place before the initial 'shorewall start'
|
||||||
#
|
#
|
||||||
replace_default_route() {
|
replace_default_route() # $1 = USE_DEFAULT_RT
|
||||||
qt $IP -6 route replace $default_route && \
|
{
|
||||||
result=0 && \
|
#
|
||||||
progress_message "Default Route (${default_route# }) restored"
|
# 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
|
restore_default_route() # $1 = USE_DEFAULT_RT
|
||||||
{
|
{
|
||||||
local result
|
local result
|
||||||
|
result=1
|
||||||
|
|
||||||
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
|
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
|
||||||
local default_route
|
local default_route
|
||||||
default_route=
|
default_route=
|
||||||
local route
|
local route
|
||||||
result=1
|
|
||||||
|
|
||||||
while read route ; do
|
while read route ; do
|
||||||
case $route in
|
case $route in
|
||||||
default*)
|
default*)
|
||||||
if [ -n "$default_route" ]; then
|
replace_default_route $1
|
||||||
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
|
|
||||||
|
|
||||||
default_route="$default_route $route"
|
default_route="$default_route $route"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -549,9 +551,9 @@ restore_default_route() # $1 = USE_DEFAULT_RT
|
|||||||
esac
|
esac
|
||||||
done < ${VARDIR}/default_route
|
done < ${VARDIR}/default_route
|
||||||
|
|
||||||
if [ -n "$default_route" ]; then
|
replace_default_route $1
|
||||||
replace_default_route
|
|
||||||
elif [ $result = 1 ]; then
|
if [ $result = 1 ]; then
|
||||||
#
|
#
|
||||||
# We added a default route with metric 0 but there wasn't one previously
|
# We added a default route with metric 0 but there wasn't one previously
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user