Allow entries in shorewall.conf to be optional

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6089 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-04-23 19:49:02 +00:00
parent f10c7242f1
commit e722b6f581
2 changed files with 13 additions and 6 deletions

View File

@ -489,7 +489,7 @@ sub check_trivalue( $$ ) {
} elsif ( $val eq 'keep' ) {
$config{$var} = '';
} elsif ( $val eq '' ) {
$config{var} = $default
$config{$var} = $default
} else {
fatal_error "Invalid value ( $val ) for $var";
}
@ -818,7 +818,11 @@ sub get_configuration( $ ) {
default_yes_no 'DETECT_DNAT_IPADDRS' , '';
default_yes_no 'DETECT_DNAT_IPADDRS' , '';
default_yes_no 'CLEAR_TC' , 'Yes';
default_yes_no 'CLAMPMSS' , '' unless $config{CLAMPMSS} =~ /^\d+$/;
if ( defined $config{CLAMPMSS} ) {
default_yes_no 'CLAMPMSS' , '' unless $config{CLAMPMSS} =~ /^\d+$/;
} else {
$config{CLAMPMSS} = '';
}
unless ( $config{ADD_IP_ALIASES} || $config{ADD_SNAT_ALIASES} ) {
$config{RETAIN_ALIASES} = '';
@ -906,10 +910,13 @@ sub get_configuration( $ ) {
$globals{TC_SCRIPT} = '';
default 'TC_ENABLED' , 'Internal';
if ( $val = "\L$config{TC_ENABLED}" ) {
if ( $val eq 'yes' ) {
$file = find_file 'tcstart';
fatal_error "Unable to find tcstart file" unless -f $file;
$globals{TC_SCRIPT} = $file;
} elsif ( $val ne 'internal' ) {
fatal_error "Invalid value ($config{TC_ENABLED}) for TC_ENABLED" unless $val eq 'no';
$config{TC_ENABLED} = '';
@ -922,7 +929,7 @@ sub get_configuration( $ ) {
default 'QUEUE_DEFAULT' , 'none';
default 'ACCEPT_DEFAULT' , 'none';
default 'OPTIMIZE' , 0;
default 'IPSECFILE' , 'ipsec';
default 'IPSECFILE' , 'zones';
fatal_error 'IPSECFILE=ipsec is not supported by Shorewall-perl ' . $globals{VERSION} unless $config{IPSECFILE} eq 'zones';
@ -956,7 +963,7 @@ sub get_configuration( $ ) {
$globals{MAXZONENAMELENGTH} = int ( 5 + ( ( 29 - (length $result ) ) / 2) );
} else {
$globals{LOGFORMAT}='Shorewall:%s:%s:';
$config{LOGFORMAT}='Shorewall:%s:%s:';
$globals{MAXZONENAMELENGTH} = 5;
}

View File

@ -571,9 +571,9 @@ sub setup_tc() {
}
}
if ( $config{TC_SCRIPT} ) {
if ( $globals{TC_SCRIPT} ) {
save_progress_message 'Setting up Traffic Control...';
append_file $config{TC_SCRIPT};
append_file $globals{TC_SCRIPT};
} elsif ( $config{TC_ENABLED} eq 'Internal' ) {
setup_traffic_shaping;
}