From a8231a26b8af5b032ebd3ca9a753838b02adad2f Mon Sep 17 00:00:00 2001 From: teastep Date: Mon, 26 Mar 2007 21:49:03 +0000 Subject: [PATCH] Small improvement in macro handling git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5706 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/Shorewall/Actions.pm | 3 ++- New/Shorewall/Rules.pm | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/New/Shorewall/Actions.pm b/New/Shorewall/Actions.pm index 1bff05d92..846a3cfe7 100644 --- a/New/Shorewall/Actions.pm +++ b/New/Shorewall/Actions.pm @@ -110,7 +110,8 @@ sub merge_levels ($$) { $subordinate; } -# Get Macro Name +# +# Get Macro Name -- strips away trailing /* and :* from the first column in a rule, macro or action. # sub isolate_basic_target( $ ) { ( split '/', ( split /:/ , $_[0] )[0] )[0]; diff --git a/New/Shorewall/Rules.pm b/New/Shorewall/Rules.pm index bdc9ed13e..ad0d0f24d 100644 --- a/New/Shorewall/Rules.pm +++ b/New/Shorewall/Rules.pm @@ -782,21 +782,22 @@ sub process_macro ( $$$$$$$$$$$ ) { sub process_rule1 ( $$$$$$$$$ ) { my ( $target, $source, $dest, $proto, $ports, $sports, $origdest, $ratelimit, $user ) = @_; my ( $action, $loglevel) = split_action $target; + my ( $basictarget, $param ) = split '/', $action; my $rule = ''; my $actionchainref; # # Determine the validity of the action # - my $actiontype = $targets{$action} || find_macro( isolate_basic_target $action ); + my $actiontype = $targets{$basictarget} || find_macro( $basictarget ); fatal_error "Unknown action ($action) in rule \"$line\"" unless $actiontype; if ( $actiontype == MACRO ) { process_macro - $macros{isolate_basic_target $action}, $ + $macros{$basictarget}, target , - (split '/', $action)[1] , + $param , $source, $dest, $proto,