From 70a60971dcd7589a892e1cd16d0456604c6761aa Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 8 Mar 2007 21:41:05 +0000 Subject: [PATCH] Correct nested Zone sort order git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5466 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/compiler.pl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/New/compiler.pl b/New/compiler.pl index 25379b442..1f36121ef 100755 --- a/New/compiler.pl +++ b/New/compiler.pl @@ -135,6 +135,7 @@ my $line; # Current config file line my @zones; my %zones; +my %zone_children; my %zone_parents; my %zone_hosts; my %zone_options; @@ -398,11 +399,12 @@ sub parse_zone_option_list($) # # Parse the zones file. Generates the following information: # -# zones => -# zone_parents => -# zone_options => in_out => mss => -# => ipsec => "ipsec selection string" -# => routeback => 1 +# zones => +# zone_children => +# zone_parents => +# zone_options => in_out => mss => +# => ipsec => "ipsec selection string" +# => routeback => 1 # in ... # out ... # @@ -430,6 +432,7 @@ sub determine_zones() fatal_error "Invalid Parent List ($2)" unless $p; fatal_error "Unknown parent zone ($p)" unless $zones{$p}; fatal_error 'Subzones of firewall zone not allowed' if $zones{$p} eq 'firewall'; + push @{$zone_children{$p}}, $zone; } } @@ -468,6 +471,7 @@ sub determine_zones() $zone_options{$zone} = \%zone_hash; $zone_interfaces{$zone} = {}; + $zone_children{$zone} = []; push @z, $zone; } @@ -483,8 +487,8 @@ sub determine_zones() ZONE: for my $zone ( @z ) { unless ( $ordered{$zone} ) { - for my $parent ( @{$zone_parents{$zone}} ) { - next ZONE unless $ordered{$parent}; + for my $child ( @{$zone_children{$zone}} ) { + next ZONE unless $ordered{$child}; } $ordered{$zone} = 1; push @zones, $zone;