From 2dd9e6c91f4b1a5e9adc89c463780542dc4cbaac Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 11 Jun 2012 13:53:53 -0700 Subject: [PATCH] Don't delete default routes when 'fallback' is specified. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Providers.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Providers.pm b/Shorewall/Perl/Shorewall/Providers.pm index 0ba97b8fa..34b948e25 100644 --- a/Shorewall/Perl/Shorewall/Providers.pm +++ b/Shorewall/Perl/Shorewall/Providers.pm @@ -61,6 +61,7 @@ my @load_interfaces; my $balancing; my $fallback; +my $metrics; my $first_default_route; my $first_fallback_route; my $maxload; @@ -96,6 +97,7 @@ sub initialize( $ ) { @load_interfaces = (); $balancing = 0; $fallback = 0; + $metrics = 0; $first_default_route = 1; $first_fallback_route = 1; $maxload = 0; @@ -708,7 +710,7 @@ CEOF emit qq(echo "qt \$IP -$family route del default dev $physical table ) . DEFAULT_TABLE . qq(" >> \${VARDIR}/undo_${table}_routing); } - $fallback = 1; + $metrics = 1; } emit( qq(\n) , @@ -1161,7 +1163,7 @@ sub finish_providers() { 'fi', '' ); } elsif ( $config{USE_DEFAULT_RT} ) { - emit "while qt \$IP -$family route del default table " . DEFAULT_TABLE . '; do true; done'; + emit "while qt \$IP -$family route del default table " . DEFAULT_TABLE . '; do true; done' unless $metrics; } unless ( $config{KEEP_RT_TABLES} ) { @@ -1199,6 +1201,8 @@ sub process_providers( $ ) { } if ( $providers ) { + fatal_error q(Either all 'fallback' providers must specify a weight or non of them can specify a weight) if $fallback && $metrics; + my $fn = open_file( 'route_rules' ); if ( $fn ){