From 6085c6092f3e70ffa19eb7442d7d172fcd588fb5 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 28 Jan 2016 10:58:09 -0800 Subject: [PATCH] Add origin comments to command-mode rules Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Chains.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index 7ab4faa0d..1f9fb4601 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -7952,7 +7952,7 @@ sub emitr( $$ ) { # enter_cat_mode unless $mode == CAT_MODE; - if ( ( my $origin = $ruleref->{origin} ) && $config{TRACK_RULES} eq 'File' ) { + if ( $config{TRACK_RULES} eq 'File' && ( my $origin = $ruleref->{origin} ) ) { emit_unindented '# ' . $origin; } @@ -7966,6 +7966,9 @@ sub emitr( $$ ) { if ( exists $ruleref->{cmd} ) { emit join( '', ' ' x $ruleref->{cmdlevel}, $ruleref->{cmd} ); } else { + if ( $config{TRACK_RULES} eq 'File' && ( my $origin = $ruleref->{origin} ) ) { + emit join( '', ' ' x $ruleref->{cmdlevel} , '# ' , $origin ); + } # # Must preserve quotes in the rule #