diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index e68c172e8..fd6189cdd 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -4563,16 +4563,22 @@ sub valid_tables() { sub optimize_ruleset() { + my $optimize = $config{OPTIMIZE}; + for my $table ( valid_tables ) { my $tableref = $chain_table{$table}; my $passes = 0; - my $optimize = $config{OPTIMIZE}; $passes = optimize_level4( $table, $tableref ) if $optimize & 4; $passes = optimize_level16( $table, $tableref , $passes ) if $optimize & 16; + + my $savepasses = $passes; + $passes = optimize_level8( $table, $tableref , $passes ) if $optimize & 8; + $passes = optimize_level16( $table, $tableref , $passes ) if $optimize & 16 && $passes > $savepasses + 1; + progress_message " Table $table Optimized -- Passes = $passes"; progress_message ''; }