From 048d380c280de66919b7fd11c37e01137882e533 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 7 Jan 2012 19:58:45 -0800 Subject: [PATCH] Issue warning if there is a deprecated option setting in the .conf file. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 3e0ff0b18..7ab823ba6 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -408,6 +408,15 @@ use constant { MIN_VERBOSITY => -1, my %validlevels; # Valid log levels. +# +# Deprecated options with their default values +# +my %deprecated = ( LOGRATE => '' , + LOGBURST => '' , + EXPORTPARAMS => 'no', + WIDE_TC_MARKS => 'no', + HIGH_ROUTE_MARKS => 'no' + ); # # Rather than initializing globals in an INIT block or during declaration, # we initialize them in a function. This is done for two reasons: @@ -3080,16 +3089,7 @@ sub update_config_file( $ ) { # $fn = $annotate ? "$globals{SHAREDIR}/configfiles/${product}.conf.annotated" : "$globals{SHAREDIR}/configfiles/${product}.conf"; } - # - # Deprecated options with their default values - # - my %deprecated = ( LOGRATE => '' , - LOGBURST => '' , - EXPORTPARAMS => 'no', - WIDE_TC_MARKS => 'no', - HIGH_ROUTE_MARKS => 'no' - ); - if ( -f $fn ) { + if ( -f $fn ) { my ( $template, $output ); open $template, '<' , $fn or fatal_error "Unable to open $fn: $!"; @@ -3208,6 +3208,9 @@ sub process_shorewall_conf( $$ ) { warning_message "Unknown configuration option ($var) ignored", next unless exists $config{$var}; $config{$var} = ( $val =~ /\"([^\"]*)\"$/ ? $1 : $val ); + + warning_message "Option $var=$val is deprecated" + if $deprecated{$var} && supplied $val && lc $config{$var} ne $deprecated{$var}; } else { fatal_error "Unrecognized $product.conf entry"; }