From e572d6ce501de8415b4436ab4e2fd53ee3561f70 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 26 Mar 2013 07:38:13 -0700 Subject: [PATCH] Use the 'id' member in copy_and_edit_table(). - Also add prohibit and unreachable to the existing blackhole case. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Providers.pm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Providers.pm b/Shorewall/Perl/Shorewall/Providers.pm index fc98c03ea..36cb6d6b0 100644 --- a/Shorewall/Perl/Shorewall/Providers.pm +++ b/Shorewall/Perl/Shorewall/Providers.pm @@ -220,8 +220,8 @@ sub copy_table( $$$ ) { ); } -sub copy_and_edit_table( $$$$ ) { - my ( $duplicate, $number, $copy, $realm) = @_; +sub copy_and_edit_table( $$$$$ ) { + my ( $duplicate, $number, $id, $copy, $realm) = @_; my $filter = $family == F_IPV6 ? q(fgrep -v ' cache ' | sed 's/ via :: / /' | ) : ''; my %copied; @@ -256,8 +256,8 @@ sub copy_and_edit_table( $$$$ ) { emit ( ' case $net in', ' default)', ' ;;', - ' blackhole)', - " run_ip route add table $number blackhole \$route $realm", + ' blackhole|prohibit|unreachable)', + " run_ip route add table $id \$net \$route $realm", ' ;;', ' *)', ' case $(find_device $route) in', @@ -267,12 +267,12 @@ sub copy_and_edit_table( $$$$ ) { ' 255.255.255.255*)', ' ;;', ' *)', - " run_ip route add table $number \$net \$route $realm", + " run_ip route add table $id \$net \$route $realm", ' ;;', ' esac', ); } else { - emit ( " run_ip route add table $number \$net \$route $realm" ); + emit ( " run_ip route add table $id \$net \$route $realm" ); } emit ( ' ;;', @@ -371,7 +371,6 @@ sub start_provider( $$$$$ ) { emit $test; push_indent; - if ( $number ) { emit "qt ip -$family route flush table $id"; emit "echo \"\$IP -$family route flush table $id > /dev/null 2>&1\" > \${VARDIR}/undo_${table}_routing"; @@ -776,7 +775,7 @@ CEOF $copy = "$interface,$copy"; } - copy_and_edit_table( $duplicate, $number ,$copy , $realm); + copy_and_edit_table( $duplicate, $number, $id, $copy, $realm); } }