mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-12 04:37:01 +02:00
Add VERBOSE_MESSAGES option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
244f2cefe5
commit
24d40f4cc2
@ -889,6 +889,7 @@ sub initialize( $;$$) {
|
|||||||
DOCKER => undef ,
|
DOCKER => undef ,
|
||||||
PAGER => undef ,
|
PAGER => undef ,
|
||||||
MINIUPNPD => undef ,
|
MINIUPNPD => undef ,
|
||||||
|
VERBOSE_MESSAGES => undef ,
|
||||||
#
|
#
|
||||||
# Packet Disposition
|
# Packet Disposition
|
||||||
#
|
#
|
||||||
@ -2543,18 +2544,54 @@ sub directive_error( $$$ ) {
|
|||||||
fatal_error $_[0];
|
fatal_error $_[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub directive_warning( $$$ ) {
|
sub directive_warning( $$$$ ) {
|
||||||
my ( $savefilename, $savelineno ) = ( $currentfilename, $currentlinenumber );
|
if ( shift ) {
|
||||||
( my $warning, $currentfilename, $currentlinenumber ) = @_;
|
my ( $savefilename, $savelineno ) = ( $currentfilename, $currentlinenumber );
|
||||||
warning_message $warning;
|
( my $warning, $currentfilename, $currentlinenumber ) = @_;
|
||||||
( $currentfilename, $currentlinenumber ) = ( $savefilename, $savelineno );
|
warning_message $warning;
|
||||||
|
( $currentfilename, $currentlinenumber ) = ( $savefilename, $savelineno );
|
||||||
|
} else {
|
||||||
|
our @localtime;
|
||||||
|
|
||||||
|
handle_first_entry if $first_entry;
|
||||||
|
|
||||||
|
$| = 1; #Reset output buffering (flush any partially filled buffers).
|
||||||
|
|
||||||
|
if ( $log ) {
|
||||||
|
@localtime = localtime;
|
||||||
|
printf $log '%s %2d %02d:%02d:%02d ', $abbr[$localtime[4]], @localtime[3,2,1,0];
|
||||||
|
print $log " WARNING: $_[0]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print STDERR " WARNING: $_[0]\n";
|
||||||
|
|
||||||
|
$| = 0; #Re-allow output buffering
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub directive_info( $$$ ) {
|
sub directive_info( $$$$ ) {
|
||||||
my ( $savefilename, $savelineno ) = ( $currentfilename, $currentlinenumber );
|
if ( shift ) {
|
||||||
( my $info, $currentfilename, $currentlinenumber ) = @_;
|
my ( $savefilename, $savelineno ) = ( $currentfilename, $currentlinenumber );
|
||||||
info_message $info;
|
( my $info, $currentfilename, $currentlinenumber ) = @_;
|
||||||
( $currentfilename, $currentlinenumber ) = ( $savefilename, $savelineno );
|
info_message $info;
|
||||||
|
( $currentfilename, $currentlinenumber ) = ( $savefilename, $savelineno );
|
||||||
|
} else {
|
||||||
|
our @localtime;
|
||||||
|
|
||||||
|
handle_first_entry if $first_entry;
|
||||||
|
|
||||||
|
$| = 1; #Reset output buffering (flush any partially filled buffers).
|
||||||
|
|
||||||
|
if ( $log ) {
|
||||||
|
@localtime = localtime;
|
||||||
|
printf $log '%s %2d %02d:%02d:%02d ', $abbr[$localtime[4]], @localtime[3,2,1,0];
|
||||||
|
print $log " INFO: $_[0]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print STDERR " INFO: $_[0]\n";
|
||||||
|
|
||||||
|
$| = 0; #Re-allow output buffering
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -2703,7 +2740,7 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
|
|
||||||
print "CD===> $line\n" if $debug;
|
print "CD===> $line\n" if $debug;
|
||||||
|
|
||||||
directive_error( "Invalid compiler directive ($line)" , $filename, $linenumber ) unless $line =~ /^\s*\?(IF\s+|ELSE|ELSIF\s+|ENDIF|SET\s+|RESET\s+|FORMAT\s+|COMMENT\s*|ERROR\s+|WARNING\s+|INFO\s+)(.*)$/i;
|
directive_error( "Invalid compiler directive ($line)" , $filename, $linenumber ) unless $line =~ /^\s*\?(IF\s+|ELSE|ELSIF\s+|ENDIF|SET\s+|RESET\s+|FORMAT\s+|COMMENT\s*|ERROR\s+|WARNING\s+|INFO\s+|WARNING!\s+|INFO!\s+)(.*)$/i;
|
||||||
|
|
||||||
my ($keyword, $expression) = ( uc $1, $2 );
|
my ($keyword, $expression) = ( uc $1, $2 );
|
||||||
|
|
||||||
@ -2811,14 +2848,14 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
delete $actparams{$var}
|
delete $actparams{$var}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
directive_warning( "Shorewall variable $2 does not exist", $filename, $linenumber );
|
directive_warning( 'Yes', "Shorewall variable $2 does not exist", $filename, $linenumber );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ( exists $variables{$2} ) {
|
if ( exists $variables{$2} ) {
|
||||||
delete $variables{$2};
|
delete $variables{$2};
|
||||||
} else {
|
} else {
|
||||||
directive_warning( "Shell variable $2 does not exist", $filename, $linenumber );
|
directive_warning( 'Yes', "Shell variable $2 does not exist", $filename, $linenumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2832,7 +2869,7 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
( $comment = $line ) =~ s/^\s*\?COMMENT\s*//;
|
( $comment = $line ) =~ s/^\s*\?COMMENT\s*//;
|
||||||
$comment =~ s/\s*$//;
|
$comment =~ s/\s*$//;
|
||||||
} else {
|
} else {
|
||||||
directive_warning( "COMMENTs ignored -- require comment support in iptables/Netfilter" , $filename, $linenumber ) unless $warningcount++;
|
directive_warning( 'Yes', "COMMENTs ignored -- require comment support in iptables/Netfilter" , $filename, $linenumber ) unless $warningcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2851,7 +2888,8 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
} ,
|
} ,
|
||||||
|
|
||||||
WARNING => sub() {
|
WARNING => sub() {
|
||||||
directive_warning( evaluate_expression( $expression ,
|
directive_warning( $config{VERBOSE_MESSAGES} ,
|
||||||
|
evaluate_expression( $expression ,
|
||||||
$filename ,
|
$filename ,
|
||||||
$linenumber ,
|
$linenumber ,
|
||||||
1 ),
|
1 ),
|
||||||
@ -2860,7 +2898,28 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
} ,
|
} ,
|
||||||
|
|
||||||
INFO => sub() {
|
INFO => sub() {
|
||||||
directive_info( evaluate_expression( $expression ,
|
directive_info( $config{VERBOSE_MESSAGES} ,
|
||||||
|
evaluate_expression( $expression ,
|
||||||
|
$filename ,
|
||||||
|
$linenumber ,
|
||||||
|
1 ),
|
||||||
|
$filename ,
|
||||||
|
$linenumber ) unless $omitting;
|
||||||
|
} ,
|
||||||
|
|
||||||
|
'WARNING!' => sub() {
|
||||||
|
directive_warning( ! $config{VERBOSE_MESSAGES} ,
|
||||||
|
evaluate_expression( $expression ,
|
||||||
|
$filename ,
|
||||||
|
$linenumber ,
|
||||||
|
1 ),
|
||||||
|
$filename ,
|
||||||
|
$linenumber ) unless $omitting;
|
||||||
|
} ,
|
||||||
|
|
||||||
|
'INFO!' => sub() {
|
||||||
|
directive_info( ! $config{VERBOSE_MESSAGES} ,
|
||||||
|
evaluate_expression( $expression ,
|
||||||
$filename ,
|
$filename ,
|
||||||
$linenumber ,
|
$linenumber ,
|
||||||
1 ),
|
1 ),
|
||||||
@ -6109,6 +6168,7 @@ sub get_configuration( $$$$ ) {
|
|||||||
default_yes_no 'WARNOLDCAPVERSION' , 'Yes';
|
default_yes_no 'WARNOLDCAPVERSION' , 'Yes';
|
||||||
default_yes_no 'DEFER_DNS_RESOLUTION' , 'Yes';
|
default_yes_no 'DEFER_DNS_RESOLUTION' , 'Yes';
|
||||||
default_yes_no 'MINIUPNPD' , '';
|
default_yes_no 'MINIUPNPD' , '';
|
||||||
|
default_yes_no 'VERBOSE_MESSAGES' , 'Yes';
|
||||||
|
|
||||||
$config{IPSET} = '' if supplied $config{IPSET} && $config{IPSET} eq 'ipset';
|
$config{IPSET} = '' if supplied $config{IPSET} && $config{IPSET} eq 'ipset';
|
||||||
|
|
||||||
|
@ -242,6 +242,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -253,6 +253,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -250,6 +250,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -253,6 +253,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -242,6 +242,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -2508,7 +2508,7 @@ INLINE - - - ; -j REJECT
|
|||||||
role="bold">refresh</emphasis>, <emphasis
|
role="bold">refresh</emphasis>, <emphasis
|
||||||
role="bold">try</emphasis>, and <emphasis
|
role="bold">try</emphasis>, and <emphasis
|
||||||
role="bold">safe-</emphasis>* command. Logging verbosity is
|
role="bold">safe-</emphasis>* command. Logging verbosity is
|
||||||
determined by the setting of LOG_VERBOSITY above. </para>
|
determined by the setting of LOG_VERBOSITY above.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -2864,6 +2864,20 @@ INLINE - - - ; -j REJECT
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><emphasis role="bold">VERBOSE_MESSAGES=</emphasis>[<emphasis
|
||||||
|
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shorewall 5.0.9. When Yes (the default), messages
|
||||||
|
produced by the ?INFO and ?WARNING directives include the filename
|
||||||
|
and linenumber of the directive. When set to No, that additional
|
||||||
|
information is omitted. The setting may be overridden on a directive
|
||||||
|
by directive basis by following ?INFO or ?WARNING with '!' (no
|
||||||
|
intervening white space).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">VERBOSITY=</emphasis>[<emphasis>number</emphasis>]</term>
|
role="bold">VERBOSITY=</emphasis>[<emphasis>number</emphasis>]</term>
|
||||||
|
@ -213,6 +213,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -214,6 +214,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -213,6 +213,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -213,6 +213,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -213,6 +213,8 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
|
VERBOSE_MESSAGES=Yes
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
@ -2506,6 +2506,20 @@ INLINE - - - ; -j REJECT
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><emphasis role="bold">VERBOSE_MESSAGES=</emphasis>[<emphasis
|
||||||
|
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shorewall 5.0.9. When Yes (the default), messages
|
||||||
|
produced by the ?INFO and ?WARNING directives include the filename
|
||||||
|
and linenumber of the directive. When set to No, that additional
|
||||||
|
information is omitted. The setting may be overridden on a directive
|
||||||
|
by directive basis by following ?INFO or ?WARNING with '!' (no
|
||||||
|
intervening white space).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">VERBOSITY=</emphasis>[<emphasis>number</emphasis>]</term>
|
role="bold">VERBOSITY=</emphasis>[<emphasis>number</emphasis>]</term>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user