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;
if ( $options && $options ne '-' ) {
if ( $options ne '-' ) {
my @options = split ',', $options;
my %options;

View File

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

View File

@ -227,6 +227,10 @@ sub determine_zones()
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} = parse_zone_option_list( $in_options || '');
$zone_hash{out} = parse_zone_option_list( $out_options || '');