From 28f0a066da9292c3346a66c40ccff06108e99c4e Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 3 Jun 2012 15:15:11 -0700 Subject: [PATCH] Make 'check -r' work like 'compile' WRT optimization Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Chains.pm | 2 ++ Shorewall/Perl/Shorewall/Compiler.pm | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index 1b29eb370..48c56d26c 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -112,6 +112,7 @@ our %EXPORT_TAGS = ( ALL_COMMANDS NOT_RESTORE OPTIMIZE_POLICY_MASK + OPTIMIZE_POLICY_MASK1 OPTIMIZE_RULESET_MASK OPTIMIZE_MASK @@ -368,6 +369,7 @@ use constant { ALL_COMMANDS => 1, NOT_RESTORE => 2 }; # use constant { OPTIMIZE_POLICY_MASK => 0x02 , # Call optimize_policy_chains() + OPTIMIZE_POLICY_MASK1 => 0x06 , OPTIMIZE_RULESET_MASK => 0x1C , # Call optimize_ruleset() }; diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index 47cc71648..7c9ea2cd2 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -817,11 +817,11 @@ sub compiler { # # Optimize Policy Chains # - optimize_policy_chains if $optimize & 6 == 2; # Level 2 but not 4 + optimize_policy_chains if ( $optimize & OPTIMIZE_POLICY_MASK1 ) == OPTIMIZE_POLICY_MASK; # Level 2 but not 4 # # More Optimization # - optimize_ruleset if $config{OPTIMIZE} & 0x1C; + optimize_ruleset if $config{OPTIIMIZE} & OPTIMIZE_RULESET_MASK; } enable_script; @@ -877,16 +877,16 @@ sub compiler { optimize_level0; - if ( $config{OPTIMIZE} & OPTIMIZE_MASK ) { + if ( ( my $optimize = $config{OPTIMIZE} & OPTIMIZE_MASK ) ) { progress_message2 'Optimizing Ruleset...'; # # Optimize Policy Chains # - optimize_policy_chains if $config{OPTIMIZE} & OPTIMIZE_POLICY_MASK; + optimize_policy_chains if ( $optimize & OPTIMIZE_POLICY_MASK1 ) == OPTIMIZE_POLICY_MASK; # Level 2 but not 4 # # Ruleset Optimization # - optimize_ruleset if $config{OPTIMIZE} & OPTIMIZE_RULESET_MASK; + optimize_ruleset if $optimize & OPTIMIZE_RULESET_MASK; } enable_script if $debug;