Eliminate $globals{TRACK_GLOBALS}

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-01-26 16:45:47 -08:00
parent 3860a1dc72
commit b4723da07c
2 changed files with 6 additions and 8 deletions

View File

@ -2413,7 +2413,7 @@ sub add_ijump_internal( $$$$$;@ ) {
my ( $target ) = split ' ', $to;
$toref = $chain_table{$fromref->{table}}{$target};
fatal_error "Unknown rule target ($to)" unless $toref || $builtin_target{$target};
$origin ||= $fromref->{origin} if $globals{TRACK_RULES};
$origin ||= $fromref->{origin} if $config{TRACK_RULES} eq 'File';
}
#
@ -2423,7 +2423,7 @@ sub add_ijump_internal( $$$$$;@ ) {
$toref->{referenced} = 1;
add_reference $fromref, $toref;
$jump = 'j' unless have_capability 'GOTO_TARGET';
$origin ||= $toref->{origin} if $globals{TRACK_RULES};
$origin ||= $toref->{origin} if $config{TRACK_RULES} eq 'File';
$ruleref = create_irule ($fromref, $jump => $to, @matches );
} else {
$ruleref = create_irule( $fromref, 'j' => $to, @matches );

View File

@ -738,7 +738,6 @@ sub initialize( $;$$) {
RPFILTER_LOG_TAG => '',
INVALID_LOG_TAG => '',
UNTRACKED_LOG_TAG => '',
TRACK_RULES => '',
);
#
# From shorewall.conf file
@ -1212,11 +1211,11 @@ sub shortlineinfo2() {
}
sub shortlineinfo1( $ ) {
$globals{TRACK_RULES} ? $currentfile ? shortlineinfo2 : $_[0] || '' : '';
$config{TRACK_RULES} eq 'File' ? $currentfile ? shortlineinfo2 : $_[0] || '' : '';
}
sub shortlineinfo( $ ) {
if ( $config{TRACK_RULES} ) {
if ( $config{TRACK_RULES} eq 'Yes' ) {
if ( $currentfile ) {
my $comment = '@@@ '. join( ':', $currentfilename, $currentlinenumber ) . ' @@@';
$comment = '@@@ ' . join( ':' , basename($currentfilename), $currentlinenumber) . ' @@@' if length $comment > 255;
@ -5839,8 +5838,7 @@ sub get_configuration( $$$$ ) {
if ( supplied ( $val = $config{TRACK_RULES} ) ) {
if ( lc( $val ) eq 'file' ) {
$globals{TRACK_RULES} = 'Yes';
$config{TRACK_RULES} = '';
$config{TRACK_RULES} = 'File';
} else {
default_yes_no 'TRACK_RULES' , '';
}
@ -5848,7 +5846,7 @@ sub get_configuration( $$$$ ) {
$config{TRACK_RULES} = '';
}
%origin = () unless $globals{TRACK_RULES};
%origin = () unless $config{TRACK_RULES} eq 'File';
#
# Ensure that all members of %origin have defined values
#