mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-24 00:23:28 +01:00
Improve interface number assignment
This commit is contained in:
parent
83bef182b1
commit
56016ca1bb
@ -168,10 +168,7 @@ use constant { SIMPLE_IF_OPTION => 1,
|
|||||||
|
|
||||||
our %validinterfaceoptions;
|
our %validinterfaceoptions;
|
||||||
|
|
||||||
our %validhostoptions;
|
our %validhostoptions;
|
||||||
|
|
||||||
our $num;
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initialize globals -- we take this novel approach to globals initialization to allow
|
# Initialize globals -- we take this novel approach to globals initialization to allow
|
||||||
@ -188,7 +185,6 @@ sub initialize( $ ) {
|
|||||||
@zones = ();
|
@zones = ();
|
||||||
%zones = ();
|
%zones = ();
|
||||||
$firewall_zone = '';
|
$firewall_zone = '';
|
||||||
$num = 0;
|
|
||||||
|
|
||||||
@interfaces = ();
|
@interfaces = ();
|
||||||
%interfaces = ();
|
%interfaces = ();
|
||||||
@ -683,7 +679,8 @@ sub firewall_zone() {
|
|||||||
#
|
#
|
||||||
# Process a record in the interfaces file
|
# Process a record in the interfaces file
|
||||||
#
|
#
|
||||||
sub process_interface() {
|
sub process_interface( $ ) {
|
||||||
|
my $nextinum = $_[0];
|
||||||
my $nets;
|
my $nets;
|
||||||
my ($zone, $originalinterface, $networks, $options ) = split_line 2, 4, 'interfaces file';
|
my ($zone, $originalinterface, $networks, $options ) = split_line 2, 4, 'interfaces file';
|
||||||
my $zoneref;
|
my $zoneref;
|
||||||
@ -860,7 +857,7 @@ sub process_interface() {
|
|||||||
$interfaces{$interface} = { name => $interface ,
|
$interfaces{$interface} = { name => $interface ,
|
||||||
bridge => $bridge ,
|
bridge => $bridge ,
|
||||||
nets => 0 ,
|
nets => 0 ,
|
||||||
number => ++$num ,
|
number => $nextinum ,
|
||||||
root => $root ,
|
root => $root ,
|
||||||
broadcasts => $broadcasts ,
|
broadcasts => $broadcasts ,
|
||||||
options => \%options };
|
options => \%options };
|
||||||
@ -886,9 +883,11 @@ sub validate_interfaces_file( $ ) {
|
|||||||
|
|
||||||
my @ifaces;
|
my @ifaces;
|
||||||
|
|
||||||
|
my $nextinum = 1;
|
||||||
|
|
||||||
first_entry "$doing $fn...";
|
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
|
# We now assemble the @interfaces array such that bridge ports immediately precede their associated bridge
|
||||||
|
Loading…
Reference in New Issue
Block a user