diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-09-30 15:15:39 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-09-30 15:15:39 +0200 |
commit | c5212b8510ecb480f759ccf3c81184c57c2d6426 (patch) | |
tree | ad58d72a54ec7dd8f2589397edad01b47dcf4f98 /scripts | |
parent | 6ab5a0589ac4f0359679edbd3982c130038dfc1d (diff) | |
download | vyatta-cfg-qos-c5212b8510ecb480f759ccf3c81184c57c2d6426.tar.gz vyatta-cfg-qos-c5212b8510ecb480f759ccf3c81184c57c2d6426.zip |
Validate ingress bandwidth value
The bandwidth value needs to be validated and converted if necessary.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/VyattaQosTrafficLimiter.pm | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/scripts/VyattaQosTrafficLimiter.pm b/scripts/VyattaQosTrafficLimiter.pm index 4ffee85..45e744e 100644 --- a/scripts/VyattaQosTrafficLimiter.pm +++ b/scripts/VyattaQosTrafficLimiter.pm @@ -48,7 +48,7 @@ my $level = $config->setLevel(); my @matches = (); - $self->{rate} = $config->returnValue("bandwidth"); + $self->{rate} = VyattaQosUtil::getRate($config->returnValue("bandwidth")); defined $self->{rate} or die "$level bandwidth not defined\n"; $self->{priority} = $config->returnValue("priority"); @@ -66,29 +66,6 @@ return @$matches; } - sub _getPercentRate { - my ( $rate, $speed ) = @_; - - if ( !defined $rate ) { - return; # leave rate undef - } - - # Rate might be a percentage of speed - if ( $rate =~ /%$/ ) { - my $percent = substr( $rate, 0, length($rate) - 1 ); - if ( $percent < 0 || $percent > 100 ) { - die "Invalid percentage bandwidth: $percent\n"; - } - - $rate = ( $percent * $speed ) / 100.; - } - else { - $rate = VyattaQosUtil::getRate($rate); - } - - return $rate; - } - } package VyattaQosTrafficLimiter; |