diff --git a/Shorewall/Perl/Shorewall/Policy.pm b/Shorewall/Perl/Shorewall/Policy.pm index 9b94ad765..1dce31fd7 100644 --- a/Shorewall/Perl/Shorewall/Policy.pm +++ b/Shorewall/Perl/Shorewall/Policy.pm @@ -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. # diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index 29c3c3c98..f2d4df730 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -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. #