Hi Jörg,

On 04/15/2011 02:27 AM, Jörg Kleuver wrote:

> I was too hasty, there's still something wrong, after I fixed the typo, 
> same type in prog.header6 too, routes with a metric disappear again.
> 
> The reason for this is at the end of restore_default_route().
> 
>       if [ $result = 1 ]; then
>           #
> 
> $result is set to 1 unconditionally at the beginning and never updated, 
> even when no default route was replaced or added.
> 
>       ip -4 route del default metric 0
> 
> When no default route with metric 0 exists, this deletes the next 
> default route with the lowest metric ...

Please reverse the changes that you made to correct the typo and apply
this patch. "It works for me" :-)

Thanks,
-Tom
-- 
Tom Eastep        \ When I die, I want to go like my Grandfather who
Shoreline,         \ died peacefully in his sleep. Not screaming like
Washington, USA     \ all of the passengers in his car
http://shorewall.net \________________________________________________
diff --git a/Shorewall/Perl/prog.header b/Shorewall/Perl/prog.header
index 1bffd1b..3705c3f 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 4caa49b..26f1092 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
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to