Don't let move_rules() duplicate rules

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9057 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2008-12-14 23:22:05 +00:00
parent fd2f961b55
commit 0d6c4309da

View File

@ -541,17 +541,25 @@ sub move_rules( $$ ) {
if ( $chain1->{referenced} ) {
my @rules = @{$chain1->{rules}};
my @newrules;
for ( @rules ) {
fatal_error "Internal Error in move_rules()" unless /^-A/;
RULE:
for my $rule ( @rules ) {
fatal_error "Internal Error in move_rules()" unless $rule =~ /^-A/;
for ( @{$chain2->{rules}} ) {
next RULE if $rule eq $_;
}
push @newrules, $rule;
}
splice @{$chain2->{rules}}, 0, 0, @rules;
if ( @newrules ) {
splice @{$chain2->{rules}}, 0, 0, @newrules;
$chain2->{referenced} = 1;
$chain1->{referenced} = 0;
$chain1->{rules} = [];
}
}
}
#