From d42a65fd1132525f19dd537504dd7b48ee4365d3 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 15 Apr 2011 07:09:34 -0700 Subject: [PATCH] Correct one more default route save/restore defect Signed-off-by: Tom Eastep --- Shorewall/Perl/prog.header | 9 +++++++-- Shorewall/Perl/prog.header6 | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Shorewall/Perl/prog.header b/Shorewall/Perl/prog.header index 1bffd1b86..3705c3f83 100644 --- a/Shorewall/Perl/prog.header +++ b/Shorewall/Perl/prog.header @@ -567,9 +567,14 @@ restore_default_route() # $1 = USE_DEFAULT_RT if [ $result = 1 ]; then # - # We added a default route with metric 0 but there wasn't one previously + # We didn't restore a default route with metric 0 # - qt -4 ip route del default metric 0 && progress_message "Default route with metric 0 deleted" + if $IP -4 -o route ls 2> /dev/null | fgrep default | fgrep -qv metric; then + # + # But we added a default route with metric 0 + # + qt $IP -4 route del default metric 0 && progress_message "Default route with metric 0 deleted" + fi fi rm -f ${VARDIR}/default_route diff --git a/Shorewall/Perl/prog.header6 b/Shorewall/Perl/prog.header6 index 4caa49b3b..26f1092de 100644 --- a/Shorewall/Perl/prog.header6 +++ b/Shorewall/Perl/prog.header6 @@ -555,9 +555,14 @@ restore_default_route() # $1 = USE_DEFAULT_RT if [ $result = 1 ]; then # - # We added a default route with metric 0 but there wasn't one previously + # We didn't restore a default route with metric 0 # - qt -6 ip route del default metric 0 && progress_message "Default route with metric 0 deleted" + if $IP -6 -o route ls 2> /dev/null | fgrep default | fgrep -qv metric; then + # + # But we added a default route with metric 0 + # + qt $IP -6 route del default metric 0 && progress_message "Default route with metric 0 deleted" + fi fi rm -f ${VARDIR}/default_route