Fix Optimization Bug

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-05-29 08:58:16 -07:00
parent ff5f2ab15a
commit 50ce5bab68

View File

@ -174,7 +174,7 @@ our %EXPORT_TAGS = (
Exporter::export_ok_tags('internal'); Exporter::export_ok_tags('internal');
our $VERSION = '4.4_9'; our $VERSION = '4.4_10';
# #
# Chain Table # Chain Table
@ -736,6 +736,15 @@ sub adjust_reference_counts( $$$ ) {
} }
} }
#
# Adjust reference counts after copying a rule from $name1 to $name2
#
sub adjust_reference_counts1( $$$ ) {
my ($toref, $name1, $name2) = @_;
$toref->{references}{$name2}++ if $toref;
}
# #
# Move the rules from one chain to another # Move the rules from one chain to another
# #
@ -799,8 +808,6 @@ sub copy_rules( $$ ) {
# #
$name1 =~ s/\+/\\+/; $name1 =~ s/\+/\\+/;
( s/\-([AI]) $name1(\b)/-$1 ${name2}$2/ ) for @rules;
my $last = pop @$rules; # Delete the jump to chain1 my $last = pop @$rules; # Delete the jump to chain1
if ( $debug ) { if ( $debug ) {
@ -809,7 +816,7 @@ sub copy_rules( $$ ) {
} }
for ( @rules ) { for ( @rules ) {
adjust_reference_counts( $tableref->{$1}, $name1, $name2 ) if / -[jg] ([^\s]+)/; adjust_reference_counts1( $tableref->{$1}, $name1, $name2 ) if / -[jg] ([^\s]+)/;
} }
push @$rules, @rules; push @$rules, @rules;
@ -1640,8 +1647,7 @@ sub conditionally_move_rules( $$ ) {
# Move is safe -- start with an empty rule list # Move is safe -- start with an empty rule list
# #
$chainref->{rules} = []; $chainref->{rules} = [];
my $count = move_rules( $targetref, $chainref ); copy_rules( $targetref, $chainref );
progress_message " $count rules moved from chain $targetref->{name} to chain $chainref->{name}" if $count;
1; 1;
} }
} }