Correct an optimizer bug.

- delete_chain_and_references() was only deleting the downward references
  and not the upward ones.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-01-11 14:55:43 -08:00
parent 76a63fb7e8
commit 38097bef5d

View File

@ -1419,9 +1419,20 @@ sub delete_chain_and_references( $ ) {
# We're going to delete this chain but first, we must delete all references to it. # We're going to delete this chain but first, we must delete all references to it.
# #
my $tableref = $chain_table{$chainref->{table}}; my $tableref = $chain_table{$chainref->{table}};
my $name1 = $chainref->{name}; my $name = $chainref->{name};
for ( @{$chainref->{rules}} ) {
decrement_reference_count( $tableref->{$_->{target}}, $name1 ) if $_->{target}; while ( my ( $chain, $references ) = each %{$chainref->{references}} ) {
#
# Delete all rules from $chain that have $name as their target
#
my $chain1ref = $tableref->{$chain};
$chain1ref->{rules} = [ grep ( ( $_->{target} || '' ) ne $name, @{$chain1ref->{rules}} ) ];
}
#
# Now decrement the reference count of all targets of this chain's rules
#
for ( grep $_, ( map( $_->{target}, @{$chainref->{rules}} ) ) ) {
decrement_reference_count( $tableref->{$_}, $name );
} }
delete_chain $chainref; delete_chain $chainref;