mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-24 03:31:24 +02:00
More editing of RATE and CEIL
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8463 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
0162419e60
commit
3b9a7e5f8e
@ -396,20 +396,22 @@ sub validate_tc_device( $$$$$ ) {
|
|||||||
progress_message " Tcdevice \"$currentline\" $done.";
|
progress_message " Tcdevice \"$currentline\" $done.";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub convert_rate( $$ ) {
|
sub convert_rate( $$$ ) {
|
||||||
my ($full, $rate) = @_;
|
my ($full, $rate, $column) = @_;
|
||||||
|
|
||||||
if ( $rate =~ /\bfull\b/ ) {
|
if ( $rate =~ /\bfull\b/ ) {
|
||||||
$rate =~ s/\bfull\b/$full/g;
|
$rate =~ s/\bfull\b/$full/g;
|
||||||
progress_message " Compiling $_[1]";
|
progress_message " Compiling $column $_[1]";
|
||||||
fatal_error "Invalid Rate ($_[1])" if $rate =~ m{[^0-9*/+()-]};
|
fatal_error "Invalid $column ($_[1])" if $rate =~ m{[^0-9*/+()-]};
|
||||||
|
no warnings;
|
||||||
$rate = eval "int( $rate )";
|
$rate = eval "int( $rate )";
|
||||||
fatal_error "Invalid Rate ($_[1])" unless defined $rate;
|
use warnings;
|
||||||
|
fatal_error "Invalid $column ($_[1])" unless defined $rate;
|
||||||
} else {
|
} else {
|
||||||
$rate = rate_to_kbit $rate
|
$rate = rate_to_kbit $rate
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "Invalid Rate ($_[1])" if $rate > $full;
|
fatal_error "$column ($_[1]) exceeds OUT-BANDWIDTH" if $rate > $full;
|
||||||
|
|
||||||
"${rate}kbit";
|
"${rate}kbit";
|
||||||
}
|
}
|
||||||
@ -492,13 +494,15 @@ sub validate_tc_class( $$$$$$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tcref->{$classnumber} = { tos => [] ,
|
$tcref->{$classnumber} = { tos => [] ,
|
||||||
rate => convert_rate( $full, $rate ) ,
|
rate => convert_rate( $full, $rate, 'RATE' ) ,
|
||||||
ceiling => convert_rate( $full, $ceil ) ,
|
ceiling => convert_rate( $full, $ceil, 'CEIL' ) ,
|
||||||
priority => $prio eq '-' ? 1 : $prio
|
priority => $prio eq '-' ? 1 : $prio
|
||||||
};
|
};
|
||||||
|
|
||||||
$tcref = $tcref->{$classnumber};
|
$tcref = $tcref->{$classnumber};
|
||||||
|
|
||||||
|
fatal_error "RATE ($tcref->{rate}) exceeds CEIL ($tcref->{ceiling})" if $tcref->{rate} > $tcref->{ceiling};
|
||||||
|
|
||||||
unless ( $options eq '-' ) {
|
unless ( $options eq '-' ) {
|
||||||
for my $option ( split_list "\L$options", 'option' ) {
|
for my $option ( split_list "\L$options", 'option' ) {
|
||||||
my $optval = $tosoptions{$option};
|
my $optval = $tosoptions{$option};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user