From 32b2030e59adc2ae0b8fd51058787e6a7f68771b Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 6 Mar 2013 07:03:41 -0800 Subject: [PATCH] Remove duplicate interface names in generated case statement. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Providers.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Shorewall/Perl/Shorewall/Providers.pm b/Shorewall/Perl/Shorewall/Providers.pm index 41c6a5ada..c419fcfe6 100644 --- a/Shorewall/Perl/Shorewall/Providers.pm +++ b/Shorewall/Perl/Shorewall/Providers.pm @@ -221,10 +221,21 @@ sub copy_and_edit_table( $$$$ ) { my ( $duplicate, $number, $copy, $realm) = @_; my $filter = $family == F_IPV6 ? q(fgrep -v ' cache ' | sed 's/ via :: / /' | ) : ''; + my %copied; + my @copy; + # + # Remove duplicates + # + for ( split ',', $copy ) { + unless ( $copied{$_} ) { + push @copy, $_; + $copied{$_} = 1; + } + } # # Map physical names in $copy to logical names # - $copy = join( '|' , map( physical_name($_) , split( ',' , $copy ) ) ); + $copy = join( '|' , map( physical_name($_) , @copy ) ); # # Shell and iptables use a different wildcard character #