1
0
mirror of https://gitlab.com/shorewall/code.git synced 2025-03-25 05:57:56 +01:00

Optimization of log rule code

Signed-off-by: Tom Eastep <teastep@shorewall.net>

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9843 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2009-04-10 20:36:22 +00:00
parent b734d3af31
commit c39fcc4db7

View File

@ -2681,7 +2681,7 @@ sub expand_rule( $$$$$$$$$$ )
# No exclusions -- save original chain # No exclusions -- save original chain
# #
my $savechainref = $chainref; my $savechainref = $chainref;
for my $onet ( mysplit $onets ) { for my $onet ( mysplit $onets ) {
$onet = match_orig_dest $onet; $onet = match_orig_dest $onet;
for my $inet ( mysplit $inets ) { for my $inet ( mysplit $inets ) {
@ -2709,9 +2709,9 @@ sub expand_rule( $$$$$$$$$$ )
# Jump to the log chain if all of the rule's conditions are met # Jump to the log chain if all of the rule's conditions are met
# #
add_jump( $chainref, $logchainref, $builtin_target{$disposition}, $predicates, 1 ); add_jump( $chainref, $logchainref, $builtin_target{$disposition}, $predicates, 1 );
#
$predicates = ''; # Now add the log rule and target rule without predicates to the log chain.
#
log_rule_limit( log_rule_limit(
$loglevel , $loglevel ,
$chainref = $logchainref , $chainref = $logchainref ,
@ -2721,7 +2721,12 @@ sub expand_rule( $$$$$$$$$$ )
$logtag, $logtag,
'add', 'add',
'' ); '' );
add_rule( $chainref, $target, 1 );
} else { } else {
#
# The log rule must be added with predicates to the rule chain
#
log_rule_limit( log_rule_limit(
$loglevel , $loglevel ,
$chainref , $chainref ,
@ -2733,9 +2738,10 @@ sub expand_rule( $$$$$$$$$$ )
$predicates $predicates
); );
} }
} } else {
#
unless ( $disposition eq 'LOG' ) { # No logging -- add the target rule with predicates to the rule chain
#
add_rule( $chainref, $predicates . $target , 1 ); add_rule( $chainref, $predicates . $target , 1 );
} }
} }