From af302900c669ccf2bda60a6c7d5d00cc93e0c34d Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 23 Jun 2012 17:09:46 -0700 Subject: [PATCH] Prevent multiple 'tproxy' providers Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Providers.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Providers.pm b/Shorewall/Perl/Shorewall/Providers.pm index 9b16ab0b9..6f2a593a1 100644 --- a/Shorewall/Perl/Shorewall/Providers.pm +++ b/Shorewall/Perl/Shorewall/Providers.pm @@ -65,6 +65,7 @@ my $metrics; my $first_default_route; my $first_fallback_route; my $maxload; +my $tproxies; my %providers; @@ -101,6 +102,7 @@ sub initialize( $ ) { $first_default_route = 1; $first_fallback_route = 1; $maxload = 0; + $tproxies = 0; %providers = ( local => { number => LOCAL_TABLE , mark => 0 , optional => 0 ,routes => [], rules => [] } , main => { number => MAIN_TABLE , mark => 0 , optional => 0 ,routes => [], rules => [] } , @@ -464,10 +466,11 @@ sub process_a_provider() { } if ( $local ) { - fatal_error "GATEWAY not valid with 'local' provider" unless $gatewaycase eq 'none'; - fatal_error "'track' not valid with 'local'" if $track; - fatal_error "DUPLICATE not valid with 'local'" if $duplicate ne '-'; + fatal_error "GATEWAY not valid with 'local' provider" unless $gatewaycase eq 'none'; + fatal_error "'track' not valid with 'local'" if $track; + fatal_error "DUPLICATE not valid with 'local'" if $duplicate ne '-'; } elsif ( $tproxy ) { + fatal_error "Only one 'tproxy' provider is allowed" if $tproxies++; fatal_error "GATEWAY not valid with 'tproxy' provider" unless $gatewaycase eq 'none'; fatal_error "'track' not valid with 'tproxy'" if $track; fatal_error "DUPLICATE not valid with 'tproxy'" if $duplicate ne '-';