On 04/14/2011 07:18 AM, Tom Eastep wrote:
> On 04/14/2011 07:03 AM, Jörg Kleuver wrote:
>> Am 14.04.2011 15:56, schrieb Tom Eastep:
>>> On 04/14/2011 02:50 AM, Jörg Kleuver wrote:
>>>
>>>>
>>>> What's the problem with this? Is there still one?
>>>
>>> Yes -- the code supporting USE_DEFAULT_RT=Yes is not prepared to handle
>>> multiple default routes in the main table.
>>>
>>> -Tom
>>
>> Hi Tom,
>>
>> I wasn't using USE_DEFAULT_RT=Yes in any of the configurations yet and 
>> this happened all with USE_DEFAULT_RT=No
> 
> Yes -- I see that. I'll try to get a fix out today but I have a busy
> work schedule so it may be this evening.

Hi Jörg,

The attached patch should fix the USE_DEFAULT_RT=No case for IPv4. I'll
work on the other cases as time permits.

-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 3c37d43..710c0c3 100644
--- a/Shorewall/Perl/prog.header
+++ b/Shorewall/Perl/prog.header
@@ -518,7 +518,14 @@ save_default_route() {
 #
 # Restore the default route that was in place before the initial 'shorewall start'
 #
-restore_default_route() {
+replace_default_route() {
+    qt $IP -4 route replace $default_route && \
+	result=0 && \
+	progress_message "Default Route (${default_route# }) restored"
+}
+
+restore_default_route()
+{
     local result
 
     if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
@@ -533,16 +540,14 @@ restore_default_route() {
 		    if [ -n "$default_route" ]; then
 			case "$default_route" in
 			    *metric*)
-		                #
-		                # Don't restore a route with a metric -- we only replace the one with metric == 0
-		                #
-				qt $IP -4 route delete default metric 0 && \
-				    progress_message "Default Route with metric 0 deleted"
+				#
+				# Don't restore a default route with a metric. We only replace the one with metric 0
+				#
+				default_route=
 				;;
 			    *)
-				qt $IP -4 route replace $default_route && \
-				    result=0 && \
-				    progress_message "Default Route (${default_route# }) restored"
+				replace_default_route
+				default_route=
 				;;
 			esac
 
@@ -557,6 +562,15 @@ restore_default_route() {
 	    esac
 	done < ${VARDIR}/default_route
 
+	if [ -n "$default_route" ]; then
+	    replace_default_route
+	elif [ $result = 1 ]; then
+	    #
+	    # We added a default route with metric 0 but there wasn't one previously
+	    #
+	    qt -4 ip route del default metric 0 && progress_message "Default route with metric 0 deleted"
+	fi
+
 	rm -f ${VARDIR}/default_route
     fi
 
------------------------------------------------------------------------------
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