From fc5f439b4b68732ad9ccfecaf60a87c360978233 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 17 Jan 2012 13:00:34 -0800 Subject: [PATCH] Generate prio 999 rule when USE_DEFAULT_RT=Yes, even when there are no balance providers. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Providers.pm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Providers.pm b/Shorewall/Perl/Shorewall/Providers.pm index 4a5f0d052..05b196520 100644 --- a/Shorewall/Perl/Shorewall/Providers.pm +++ b/Shorewall/Perl/Shorewall/Providers.pm @@ -1071,20 +1071,20 @@ sub start_providers() { } sub finish_providers() { + my $table = MAIN_TABLE; + + if ( $config{USE_DEFAULT_RT} ) { + emit ( 'run_ip rule add from ' . ALLIP . ' table ' . MAIN_TABLE . ' pref 999', + 'run_ip rule add from ' . ALLIP . ' table ' . BALANCE_TABLE . ' pref 32765', + "\$IP -$family rule del from " . ALLIP . ' table ' . MAIN_TABLE . ' pref 32766', + qq(echo "qt \$IP -$family rule add from ) . ALLIP . ' table ' . MAIN_TABLE . ' pref 32766" >> ${VARDIR}/undo_main_routing', + qq(echo "qt \$IP -$family rule del from ) . ALLIP . ' table ' . MAIN_TABLE . ' pref 999" >> ${VARDIR}/undo_main_routing', + qq(echo "qt \$IP -$family rule del from ) . ALLIP . ' table ' . BALANCE_TABLE . ' pref 32765" >> ${VARDIR}/undo_balance_routing', + '' ); + $table = BALANCE_TABLE; + } + if ( $balancing ) { - my $table = MAIN_TABLE; - - if ( $config{USE_DEFAULT_RT} ) { - emit ( 'run_ip rule add from ' . ALLIP . ' table ' . MAIN_TABLE . ' pref 999', - 'run_ip rule add from ' . ALLIP . ' table ' . BALANCE_TABLE . ' pref 32765', - "\$IP -$family rule del from " . ALLIP . ' table ' . MAIN_TABLE . ' pref 32766', - qq(echo "qt \$IP -$family rule add from ) . ALLIP . ' table ' . MAIN_TABLE . ' pref 32766" >> ${VARDIR}/undo_main_routing', - qq(echo "qt \$IP -$family rule del from ) . ALLIP . ' table ' . MAIN_TABLE . ' pref 999" >> ${VARDIR}/undo_main_routing', - qq(echo "qt \$IP -$family rule del from ) . ALLIP . ' table ' . BALANCE_TABLE . ' pref 32765" >> ${VARDIR}/undo_balance_routing', - '' ); - $table = BALANCE_TABLE; - } - emit ( 'if [ -n "$DEFAULT_ROUTE" ]; then' ); if ( $family == F_IPV4 ) { emit ( " run_ip route replace default scope global table $table \$DEFAULT_ROUTE" );