mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-08 16:54:10 +01:00
Unconditionally cache interface lookup results
This commit is contained in:
parent
7a1a303265
commit
8c8e4d1654
@ -1187,13 +1187,11 @@ sub map_physical( $$ ) {
|
||||
# If the passed name matches a wildcard and 'cache' is true, an entry for the name is added in
|
||||
# %interfaces.
|
||||
#
|
||||
sub known_interface($;$)
|
||||
sub known_interface($)
|
||||
{
|
||||
my ( $interface, $cache ) = @_;
|
||||
my $interfaceref = $interfaces{$interface};
|
||||
|
||||
$cache = 1 unless defined $cache;
|
||||
|
||||
return $interfaceref if $interfaceref;
|
||||
|
||||
fatal_error "Invalid interface ($interface)" if $interface =~ /\*/;
|
||||
@ -1204,17 +1202,13 @@ sub known_interface($;$)
|
||||
if ( $i ne $root && $interface ne $root && substr( $interface, 0, length $root ) eq $root ) {
|
||||
my $physical = map_physical( $interface, $interfaceref );
|
||||
|
||||
my $copyref = { options => $interfaceref->{options},
|
||||
bridge => $interfaceref->{bridge} ,
|
||||
name => $i ,
|
||||
number => $interfaceref->{number} ,
|
||||
physical => $physical ,
|
||||
base => chain_base( $physical ) ,
|
||||
};
|
||||
|
||||
$interfaces{$interface} = $copyref if $cache;
|
||||
|
||||
return $copyref;
|
||||
return $interfaces{$interface} = { options => $interfaceref->{options},
|
||||
bridge => $interfaceref->{bridge} ,
|
||||
name => $i ,
|
||||
number => $interfaceref->{number} ,
|
||||
physical => $physical ,
|
||||
base => chain_base( $physical ) ,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user