Corrections to Defaults

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2011-06-18 15:38:08 -07:00
parent f93ac02bfc
commit faeb2da2ba

View File

@ -219,7 +219,7 @@ our %defaults =
LOGFORMAT => 'Shorewall:%s:%s:', LOGFORMAT => 'Shorewall:%s:%s:',
LOGTAGONLY => 'No', LOGTAGONLY => 'No',
LOGLIMIT => '', LOGLIMIT => '',
LOGALLNEW => 'No', LOGALLNEW => 'none',
BLACKLIST_LOGLEVEL => 'none', BLACKLIST_LOGLEVEL => 'none',
MACLIST_LOG_LEVEL => 'none', MACLIST_LOG_LEVEL => 'none',
TCP_FLAGS_LOG_LEVEL => 'none', TCP_FLAGS_LOG_LEVEL => 'none',
@ -233,6 +233,8 @@ our %defaults =
TC => '', TC => '',
IPSET => '', IPSET => '',
PERL => '', PERL => '',
IPTABLES => '',
IP6TABLES => '',
# #
#PATH is inherited #PATH is inherited
# #
@ -309,6 +311,7 @@ our %defaults =
COMPLETE => 'No', COMPLETE => 'No',
EXPORTMODULES => 'Yes', EXPORTMODULES => 'Yes',
LEGACY_FASTSTART => 'Yes', LEGACY_FASTSTART => 'Yes',
RESTORE_DEFAULT_ROUTE => 'Yes',
# #
# Packet Disposition # Packet Disposition
# #
@ -3896,7 +3899,7 @@ sub upgrade_config_file( $ ) {
LOGBURST => '' , LOGBURST => '' ,
EXPORTPARAMS => 'no' ); EXPORTPARAMS => 'no' );
my @undocumented = ( qw( FAKE_AUDIT ) ); my @undocumented = ( qw( TC_BITS PROVIDER_BITS PROVIDER_OFFSET MASK_BITS FAKE_AUDIT ) );
if ( -f $fn ) { if ( -f $fn ) {
my ( $template, $output ); my ( $template, $output );
@ -3909,10 +3912,19 @@ sub upgrade_config_file( $ ) {
while ( <$template> ) { while ( <$template> ) {
if ( /^(\w+)=/ ) { if ( /^(\w+)=/ ) {
my ($var, $val ) = ( $1, $rawconfig{$1} ); my ($var, $val, $default ) = ( $1, $rawconfig{$1}, $defaults{$1} );
$val = $defaults{$var} unless defined $val;
if ( $val =~ /\s/ ) { fatal_error "Default value for $var is undefined" unless defined $default;
unless ( supplied $val ) {
if ( defined $val ) {
$val = $default if $default eq 'Yes' || $default eq 'No';
} else {
$val = $default;
}
}
unless ( $val =~ /^\w*$/ ) {
$val = qq("$val") unless $val =~ /'/; $val = qq("$val") unless $val =~ /'/;
} }
@ -3927,19 +3939,21 @@ sub upgrade_config_file( $ ) {
my $heading_printed; my $heading_printed;
for ( @undocumented ) { for ( @undocumented ) {
if ( $rawconfig{$_} ) { if ( defined $rawconfig{$_} ) {
unless ( $heading_printed ) { unless ( $heading_printed ) {
print $output print $output
'################################################################################# '
#################################################################################
# U N D O C U M E N T E D # U N D O C U M E N T E D
# O P T I O N S # O P T I O N S
################################################################################# #################################################################################
'; ';
$heading_printed = 1; $heading_printed = 1;
} }
print $output "$_=$rawconfig{$_}\n"; print $output "$_=$rawconfig{$_}\n\n";
} }
} }
@ -3950,15 +3964,17 @@ sub upgrade_config_file( $ ) {
if ( lc $rawconfig{$_} ne $deprecated{$_} ) { if ( lc $rawconfig{$_} ne $deprecated{$_} ) {
unless ( $heading_printed ) { unless ( $heading_printed ) {
print $output print $output
'################################################################################# '
#################################################################################
# D E P R E C A T E D # D E P R E C A T E D
# O P T I O N S # O P T I O N S
################################################################################# #################################################################################
'; ';
$heading_printed = 1; $heading_printed = 1;
} }
print $output "$_=$rawconfig{$_}\n"; print $output "$_=$rawconfig{$_}\n\n";
warning_message "Deprecated option $_ is being set in your $product.conf file"; warning_message "Deprecated option $_ is being set in your $product.conf file";
} }