mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-23 16:13:18 +01:00
Add Shorewall::Chains::find_chain()
This commit is contained in:
parent
633eba6c90
commit
00837ed503
@ -106,6 +106,7 @@ our %EXPORT_TAGS = (
|
||||
ecn_chain
|
||||
notrack_chain
|
||||
first_chains
|
||||
find_chain
|
||||
ensure_chain
|
||||
ensure_accounting_chain
|
||||
ensure_mangle_chain
|
||||
@ -176,7 +177,7 @@ our %EXPORT_TAGS = (
|
||||
|
||||
Exporter::export_ok_tags('internal');
|
||||
|
||||
our $VERSION = '4.4_12';
|
||||
our $VERSION = '4.4_13';
|
||||
|
||||
#
|
||||
# Chain Table
|
||||
@ -1070,6 +1071,17 @@ sub new_chain($$)
|
||||
$chain_table{$table}{$chain} = $chainref;
|
||||
}
|
||||
|
||||
#
|
||||
# Find a chain
|
||||
#
|
||||
sub find_chain($$) {
|
||||
my ($table, $chain) = @_;
|
||||
|
||||
assert( $table && $chain && $chain_table{$table} );
|
||||
|
||||
$chain_table{$table}{$chain};
|
||||
}
|
||||
|
||||
#
|
||||
# Create a chain if it doesn't exist already
|
||||
#
|
||||
@ -1077,11 +1089,7 @@ sub ensure_chain($$)
|
||||
{
|
||||
my ($table, $chain) = @_;
|
||||
|
||||
assert( $table && $chain && $chain_table{$table} );
|
||||
|
||||
my $ref = $chain_table{$table}{$chain};
|
||||
|
||||
$ref || new_chain( $table, $chain );
|
||||
find_chain( $table, $chain ) || new_chain( $table, $chain );
|
||||
}
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user