From fb3194d96bfdbe89f9e6bf4f1031201e4cdb846c Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 25 Nov 2012 10:16:43 -0800 Subject: [PATCH] Correct handling of default-action macro when specified as "macro.Name" Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Rules.pm | 11 ++++++++--- Shorewall/manpages/shorewall-policy.xml | 4 ++-- Shorewall6/manpages/shorewall6-policy.xml | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index 39c60a549..45c66d888 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -361,10 +361,12 @@ sub process_a_policy() { $default = supplied $param ? normalize_action( $def, 'none', $param ) : normalize_action_name $def; use_policy_action( $default ); } elsif ( find_macro( $def ) ) { - $default = join( '.', 'macro', $def ) unless $default =~ /^macro./; + $def = join( '.', 'macro', $def ) unless $default =~ /^macro./; if ( supplied $param ) { validate_level($param); - $default = join( ':', $default, $param ); + $default = join( ':', $def, $param ); + } else { + $default = $def; } } else { fatal_error "Unknown Default Action ($default)"; @@ -1151,7 +1153,10 @@ sub merge_levels ($$) { sub find_macro( $ ) { my $macro = $_[0]; - my $macrofile = find_file( $macro =~ /^macro\./ ? $macro : "macro.$macro" ); + + $macro =~ s/^macro.//; + + my $macrofile = find_file "macro.$macro"; if ( -f $macrofile ) { $macros{$macro} = $macrofile; diff --git a/Shorewall/manpages/shorewall-policy.xml b/Shorewall/manpages/shorewall-policy.xml index 9662e4ac7..dbd48b4da 100644 --- a/Shorewall/manpages/shorewall-policy.xml +++ b/Shorewall/manpages/shorewall-policy.xml @@ -125,8 +125,8 @@ Both actions and macros can have parameters specified. In the case of a macro, only one parameter is allowed and specifies the log - level to be applied to each rule in the action; not recommended for - use. + level to be applied to each bare LOG rule (e.g., a rule specifying + 'LOG' with no level or tag in the ACTION column). Possible actions are: diff --git a/Shorewall6/manpages/shorewall6-policy.xml b/Shorewall6/manpages/shorewall6-policy.xml index 0d7e6184e..86154322c 100644 --- a/Shorewall6/manpages/shorewall6-policy.xml +++ b/Shorewall6/manpages/shorewall6-policy.xml @@ -125,8 +125,8 @@ Both actions and macros can have parameters specified. In the case of a macro, only one parameter is allowed and specifies the log - level to be applied to each rule in the action; not recommended for - use. + level to be applied to each bare LOG rule (e.g., a rule specifying + 'LOG' with no level or tag in the ACTION column). Possible actions are: