Clone a small function

This commit is contained in:
Tom Eastep 2011-01-01 11:19:53 -08:00
parent 8f0d0ac5a7
commit d64edf3470
2 changed files with 21 additions and 8 deletions

View File

@ -31,7 +31,7 @@ use Shorewall::Chains qw( :DEFAULT :internal) ;
use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( validate_policy apply_policy_rules complete_standard_chain setup_syn_flood_chains save_policies optimize_policy_chains get_target_param policy_actions );
our @EXPORT = qw( validate_policy apply_policy_rules complete_standard_chain setup_syn_flood_chains save_policies optimize_policy_chains policy_actions );
our @EXPORT_OK = qw( );
our $VERSION = '4.4_16';
@ -54,6 +54,13 @@ sub initialize() {
QUEUE => 'none' );
}
#
# Return a list of actions used by the policies
#
sub policy_actions() {
keys %policy_actions;
}
#
# Split the passed target into the basic target and parameter
#
@ -67,13 +74,6 @@ sub get_target_param( $ ) {
( $target, $param );
}
#
# Return a list of actions used by the policies
#
sub policy_actions() {
keys %policy_actions;
}
#
# Convert a chain into a policy chain.
#

View File

@ -128,6 +128,19 @@ sub split_action ( $ ) {
( $target, join ":", @a );
}
#
# Split the passed target into the basic target and parameter
#
sub get_target_param( $ ) {
my ( $target, $param ) = split '/', $_[0];
unless ( defined $param ) {
( $target, $param ) = ( $1, $2 ) if $target =~ /^(.*?)[(](.*)[)]$/;
}
( $target, $param );
}
#
# Create a normalized action name from the passed pieces.
#