Insure that the mapping to base names is deterministic

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-08-29 07:28:06 -07:00
parent be0231578f
commit d94f2cc86d

View File

@ -155,9 +155,13 @@ our %reservedName = ( all => 1,
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
# number => <ordinal position in the interfaces file>
# physical => <physical interface name>
# base => <shell variable base representing this interface>
# }
# }
#
# The purpose of the 'base' member is to ensure that the base names associated with the physical interfaces are assigned in
# the same order as the interfaces are encountered in the configuration files.
#
our @interfaces;
our %interfaces;
our @bport_zones;
@ -1051,7 +1055,8 @@ sub process_interface( $$ ) {
broadcasts => $broadcasts ,
options => \%options ,
zone => '',
physical => $physical
physical => $physical ,
base => chain_base( $physical )
};
if ( $zone ) {
@ -1163,11 +1168,14 @@ sub known_interface($)
#
# Cache this result for future reference. We set the 'name' to the name of the entry that appears in /etc/shorewall/interfaces and we do not set the root;
#
my $physical = map_physical( $interface, $interfaceref );
return $interfaces{$interface} = { options => $interfaceref->{options},
bridge => $interfaceref->{bridge} ,
name => $i ,
number => $interfaceref->{number} ,
physical => map_physical( $interface, $interfaceref )
physical => $physical,
base => chain_base( $physical ),
};
}
}