Small improvement in macro handling

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5706 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-26 21:49:03 +00:00
parent 8133c056fc
commit a8231a26b8
2 changed files with 6 additions and 4 deletions

View File

@ -110,7 +110,8 @@ sub merge_levels ($$) {
$subordinate; $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( $ ) { sub isolate_basic_target( $ ) {
( split '/', ( split /:/ , $_[0] )[0] )[0]; ( split '/', ( split /:/ , $_[0] )[0] )[0];

View File

@ -782,21 +782,22 @@ sub process_macro ( $$$$$$$$$$$ ) {
sub process_rule1 ( $$$$$$$$$ ) { sub process_rule1 ( $$$$$$$$$ ) {
my ( $target, $source, $dest, $proto, $ports, $sports, $origdest, $ratelimit, $user ) = @_; my ( $target, $source, $dest, $proto, $ports, $sports, $origdest, $ratelimit, $user ) = @_;
my ( $action, $loglevel) = split_action $target; my ( $action, $loglevel) = split_action $target;
my ( $basictarget, $param ) = split '/', $action;
my $rule = ''; my $rule = '';
my $actionchainref; my $actionchainref;
# #
# Determine the validity of the action # 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; fatal_error "Unknown action ($action) in rule \"$line\"" unless $actiontype;
if ( $actiontype == MACRO ) { if ( $actiontype == MACRO ) {
process_macro process_macro
$macros{isolate_basic_target $action}, $ $macros{$basictarget},
target , target ,
(split '/', $action)[1] , $param ,
$source, $source,
$dest, $dest,
$proto, $proto,