From fe7a5e5a3f495ab50e06f2db643fc86cc4bfb39f Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 3 Mar 2009 04:07:33 +0000 Subject: [PATCH] Correct optimization from 4.3.6 git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9581 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/Shorewall/Chains.pm | 2 +- Shorewall/Shorewall/Compiler.pm | 34 +++++++++++---------------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/Shorewall/Shorewall/Chains.pm b/Shorewall/Shorewall/Chains.pm index 84c50369a..531de9134 100644 --- a/Shorewall/Shorewall/Chains.pm +++ b/Shorewall/Shorewall/Chains.pm @@ -612,7 +612,7 @@ sub purge_jump ( $$ ) { my $to = $toref->{name}; for ( @{$fromref->{rules}} ) { - $_ = undef, last if / -j ${to}\b/; + $_ = undef if / -j ${to}\b/; } $toref->{referenced} = 0 unless @{$toref->{rules}}; diff --git a/Shorewall/Shorewall/Compiler.pm b/Shorewall/Shorewall/Compiler.pm index 9d97bce61..35c29fb62 100644 --- a/Shorewall/Shorewall/Compiler.pm +++ b/Shorewall/Shorewall/Compiler.pm @@ -921,27 +921,18 @@ sub compiler { # I N I T I A L I Z E # (Writes the initialize() function to the compiled script) # - unless ( $command eq 'check' ) { - enable_object; - generate_script_1; - disable_object; - } - # - # S T O P _ F I R E W A L L - # (Writes the stop_firewall() function to the compiled script) - # - unless ( $command eq 'check' ) { - enable_object; - compile_stop_firewall; - disable_object; - } - # - # C O M M O N _ R U L E S - # (Writes the setup_common_rules() function to the compiled script) - # enable_object; - + unless ( $command eq 'check' ) { + generate_script_1; + # S T O P _ F I R E W A L L + # (Writes the stop_firewall() function to the compiled script) + # + compile_stop_firewall; + # + # C O M M O N _ R U L E S + # (Writes the setup_common_rules() function to the compiled script) + # unless ( $test ) { if ( $family == F_IPV4 ) { copy $globals{SHAREDIRPL} . 'prog.functions'; @@ -957,7 +948,7 @@ sub compiler { ); push_indent; - } + } # # Do all of the zone-independent stuff # @@ -986,13 +977,10 @@ sub compiler { emit '}'; } - disable_object; # # R O U T I N G _ A N D _ T R A F F I C _ S H A P I N G # (Writes the setup_routing_and_traffic_shaping() function to the compiled script) # - enable_object; - unless ( $command eq 'check' ) { emit( "\n#", '# Setup routing and traffic shaping',