Fix rule numbers in trace output

- Don't increment $number needlessly when not tracing

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2014-09-27 07:57:09 -07:00
parent 10df9d31c4
commit bc8588a68e

View File

@ -1682,14 +1682,16 @@ sub insert_irule( $$$$;@ ) {
$ruleref->{comment} = shortlineinfo( $chainref->{origin} ) || $ruleref->{comment} || $comment;
if ( $number >= @$rulesref ) {
push @$rulesref, $ruleref;
#
# Avoid failure in spice if we insert beyond the end of the chain
#
$number = @$rulesref;
push @$rulesref, $ruleref;
} else {
splice( @$rulesref, $number, 0, $ruleref );
$number++;
}
trace( $chainref, 'I', $number, format_rule( $chainref, $ruleref ) ) if $debug;
trace( $chainref, 'I', ++$number, format_rule( $chainref, $ruleref ) ) if $debug;
$iprangematch = 0;