From 56016ca1bb9defe8a328f2550424933ae17676f2 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 6 May 2009 07:07:38 -0700 Subject: [PATCH] Improve interface number assignment --- Shorewall/Perl/Shorewall/Zones.pm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Zones.pm b/Shorewall/Perl/Shorewall/Zones.pm index 495fe1583..273e9f4c0 100644 --- a/Shorewall/Perl/Shorewall/Zones.pm +++ b/Shorewall/Perl/Shorewall/Zones.pm @@ -168,10 +168,7 @@ use constant { SIMPLE_IF_OPTION => 1, our %validinterfaceoptions; -our %validhostoptions; - -our $num; - +our %validhostoptions; # # Initialize globals -- we take this novel approach to globals initialization to allow @@ -188,7 +185,6 @@ sub initialize( $ ) { @zones = (); %zones = (); $firewall_zone = ''; - $num = 0; @interfaces = (); %interfaces = (); @@ -683,7 +679,8 @@ sub firewall_zone() { # # Process a record in the interfaces file # -sub process_interface() { +sub process_interface( $ ) { + my $nextinum = $_[0]; my $nets; my ($zone, $originalinterface, $networks, $options ) = split_line 2, 4, 'interfaces file'; my $zoneref; @@ -860,7 +857,7 @@ sub process_interface() { $interfaces{$interface} = { name => $interface , bridge => $bridge , nets => 0 , - number => ++$num , + number => $nextinum , root => $root , broadcasts => $broadcasts , options => \%options }; @@ -886,9 +883,11 @@ sub validate_interfaces_file( $ ) { my @ifaces; + my $nextinum = 1; + first_entry "$doing $fn..."; - push @ifaces, process_interface while read_a_line; + push @ifaces, process_interface( $nextinum++) while read_a_line; # # We now assemble the @interfaces array such that bridge ports immediately precede their associated bridge