Fix a couple of bugs involving '-' in config file columns

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5682 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-25 16:53:33 +00:00
parent 47f2811b68
commit 40eaf6f671
3 changed files with 25 additions and 19 deletions

View File

@ -77,7 +77,7 @@ sub validate_hosts_file()
my $optionsref; my $optionsref;
if ( $options && $options ne '-' ) { if ( $options ne '-' ) {
my @options = split ',', $options; my @options = split ',', $options;
my %options; my %options;

View File

@ -323,24 +323,26 @@ sub validate_tc_class( $$$$$$ ) {
$tcref->{ceiling} = convert_rate $full, $ceil; $tcref->{ceiling} = convert_rate $full, $ceil;
$tcref->{priority} = defined $prio ? $prio : 1; $tcref->{priority} = defined $prio ? $prio : 1;
for my $option ( split /,/, "\L$options" ) { unless ( $options eq '-' ) {
my $optval = $tosoptions{$option}; for my $option ( split /,/, "\L$options" ) {
my $optval = $tosoptions{$option};
$option = $optval if $optval;
$option = $optval if $optval;
if ( $option eq 'default' ) {
fatal_error "Only one default class may be specified for device $device" if $devref->{default}; if ( $option eq 'default' ) {
$devref->{default} = $markval; fatal_error "Only one default class may be specified for device $device" if $devref->{default};
} elsif ( $option eq 'tcp-ack' ) { $devref->{default} = $markval;
$tcref->{tcp_ack} = 1; } elsif ( $option eq 'tcp-ack' ) {
} elsif ( $option =~ /^tos=0x[0-9a-f]{2}$/ ) { $tcref->{tcp_ack} = 1;
( undef, $option ) = split /=/, $option; } elsif ( $option =~ /^tos=0x[0-9a-f]{2}$/ ) {
push @{$tcref->{tos}}, "$option/0xff"; ( undef, $option ) = split /=/, $option;
} elsif ( $option =~ /^tos=0x[0-9a-f]{2}\/0x[0-9a-f]{2}$/ ) { push @{$tcref->{tos}}, "$option/0xff";
( undef, $option ) = split /=/, $option; } elsif ( $option =~ /^tos=0x[0-9a-f]{2}\/0x[0-9a-f]{2}$/ ) {
push @{$tcref->{tos}}, $option; ( undef, $option ) = split /=/, $option;
} else { push @{$tcref->{tos}}, $option;
fatal_error "Unknown option ( $option ) for tcclass \"$line\""; } else {
fatal_error "Unknown option ( $option ) for tcclass \"$line\"";
}
} }
} }

View File

@ -227,6 +227,10 @@ sub determine_zones()
my %zone_hash; my %zone_hash;
$options = '' if $options eq '-';
$in_options = '' if $in_options eq '-';
$out_options = '' if $out_options eq '-';
$zone_hash{in_out} = parse_zone_option_list( $options || ''); $zone_hash{in_out} = parse_zone_option_list( $options || '');
$zone_hash{in} = parse_zone_option_list( $in_options || ''); $zone_hash{in} = parse_zone_option_list( $in_options || '');
$zone_hash{out} = parse_zone_option_list( $out_options || ''); $zone_hash{out} = parse_zone_option_list( $out_options || '');