summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-09-30 15:15:39 +0200
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-09-30 15:15:39 +0200
commitc5212b8510ecb480f759ccf3c81184c57c2d6426 (patch)
treead58d72a54ec7dd8f2589397edad01b47dcf4f98 /scripts
parent6ab5a0589ac4f0359679edbd3982c130038dfc1d (diff)
downloadvyatta-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.pm25
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;