From 4573b5ba8e3ad51dca7cc270c8241ed32e36de9a Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 18 Dec 2010 13:32:53 -0800 Subject: [PATCH] Generate normalized name in process_rule_common() --- Shorewall/Perl/Shorewall/Actions.pm | 9 +++++---- Shorewall/Perl/Shorewall/Rules.pm | 8 +++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Actions.pm b/Shorewall/Perl/Shorewall/Actions.pm index 38ffda6d7..2334c9ffd 100644 --- a/Shorewall/Perl/Shorewall/Actions.pm +++ b/Shorewall/Perl/Shorewall/Actions.pm @@ -138,11 +138,12 @@ sub get_target_param( $ ) { # # Create a normalized action name from the passed pieces # -sub normalize_action( $$ ) { - my $target = shift; +sub normalize_action( $$$ ) { + my $action = shift; + my $level = shift; my $param = shift; - my ($action, $level, $tag ) = split /:/, $target; + ( $level, my $tag ) = split ':', $level; $level = 'none' unless defined $level && $level ne ''; $tag = '' unless defined $tag; @@ -151,7 +152,7 @@ sub normalize_action( $$ ) { ( $action, $level, $tag, $param ); } -sub normalize_action_name( $$ ) { +sub normalize_action_name( $$$ ) { join (':', &normalize_action( @_ ) ); } diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index cb0efefcf..10fb1a093 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -360,7 +360,7 @@ sub process_actions2 () { while ( $changed ) { $changed = 0; for my $target (keys %usedactions) { - my ($action, $level) = split_action $target; + my ( $action, $level, $tag, $param ) = split_action $target; my $actionref = $actions{$action}; assert( $actionref ); for my $action1 ( keys %{$actionref->{requires}} ) { @@ -581,10 +581,7 @@ sub process_actions3 () { for my $wholeaction ( keys %usedactions ) { my $chainref = find_logactionchain $wholeaction; - my ( $action, $level, $tag ) = split /:/, $wholeaction; - - $level = '' unless defined $level; - $tag = '' unless defined $tag; + my ( $action, $level, $tag, $param ) = split /:/, $wholeaction; if ( $targets{$action} & BUILTIN ) { $level = '' if $level =~ /none!?/; @@ -738,6 +735,7 @@ sub process_rule_common ( $$$$$$$$$$$$$$$$ ) { my $optimize = $wildcard ? ( $basictarget =~ /!$/ ? 0 : $config{OPTIMIZE} & 1 ) : 0; my $inaction1; my $inaction3; + my $normalized_target = normalize_action_name( $basictarget, $loglevel, $param ); if ( defined $chainref ) { if ( reftype $chainref ) {