Hi Jörg,

On 04/14/2011 10:25 AM, Jörg Kleuver wrote:

> If I add balance to the providers file for both ISPs, i guess there's 
> still something wrong in the case i have default routes with metric <> 0 
> and no default route with metric 0. shorewall start works and the 
> balanced route is added, but not removed when doing shorewall stop.

That's a case that I didn't test. Attached patch should correct it.

> 
> I'll test some cases tomorrow with USE_DEFAULT_RT=Yes.
> 

I did test that so hopefully your testing tomorrow will go smoother.

-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 39c53e9..817d520 100644
--- a/Shorewall/Perl/prog.header
+++ b/Shorewall/Perl/prog.header
@@ -519,9 +519,22 @@ save_default_route() {
 # Restore the default route that was in place before the initial 'shorewall start'
 #
 replace_default_route() {
-    qt $IP -4 route replace $default_route && \
-	result=0 && \
-	progress_message "Default Route (${default_route# }) restored"
+    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 -4 route replace $default_route && progress_message "Default Route (${default_route# }) restored"
+		default_route=
+		;;
+	    *)
+		qt $IP -4 route replace $default_route && progress_message "Default Route (${default_route# }) restored"
+		result=0
+		default_route=
+		;;
+	esac
+    fi
 }
 
 restore_default_route() # $1 = USE_DEFAULT_RT
@@ -537,22 +550,7 @@ restore_default_route() # $1 = USE_DEFAULT_RT
 	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"
 		    ;;
 		*)
@@ -561,9 +559,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
 	    #
------------------------------------------------------------------------------
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