Correct tracing of nested rules

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2011-07-18 09:46:41 -07:00
parent a80b04bd74
commit 1e89074bf8

View File

@ -2529,6 +2529,9 @@ sub optimize_level8( $$$ ) {
progress_message "\n Table $table pass $passes, $chains referenced user chains, level 8..."; progress_message "\n Table $table pass $passes, $chains referenced user chains, level 8...";
#
# To be able to quickly compare two rules, we generate the -A command for each rule
#
for my $chainref ( @chains ) { for my $chainref ( @chains ) {
for ( @{$chainref->{rules}} ) { for ( @{$chainref->{rules}} ) {
$_->{rule} = format_rule( $chainref, $_, 1 ); $_->{rule} = format_rule( $chainref, $_, 1 );
@ -5060,27 +5063,28 @@ sub enter_cmd_mode1() {
} }
sub emitr1( $$ ) { sub emitr1( $$ ) {
my ( $chain, $rule ) = @_; my ( $chainref, $ruleref ) = @_;
if ( $rule ) { if ( $ruleref ) {
if ( $rule->{mode} == CAT_MODE ) { if ( $ruleref->{mode} == CAT_MODE ) {
# #
# A rule # A rule
# #
enter_cat_mode1 unless $mode == CAT_MODE; enter_cat_mode1 unless $mode == CAT_MODE;
my $formated = format_rule $chain, $rule; print format_rule( $chainref, $ruleref ) . "\n";
print "$formated\n";
} else { } else {
# #
# A command # A command
# #
enter_cmd_mode1 unless $mode == CMD_MODE; enter_cmd_mode1 unless $mode == CMD_MODE;
if ( $rule->{cmd} ) { if ( exists $ruleref->{cmd} ) {
emitstd $rule->{cmd}; emitstd $ruleref->{cmd};
} else { } else {
emitstd format_rule $chain, $rule; ( my $rule = format_rule( $chainref, $ruleref ) ) =~ s/"/\\"/g;
emitstd join( '', ' ' x $ruleref->{cmdlevel} , 'echo "' , $rule, '" >&3' );
} }
} }
} }