summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/ShaperClass.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-20 14:50:43 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-20 15:03:06 -0700
commit71b9bb01926ee220b73fb3135c5e7f5de9c80023 (patch)
treebf70a8b79cd44b6b7bfe93ff7d0ac338c1f5ed74 /lib/Vyatta/Qos/ShaperClass.pm
parentba5cad5145b11345fb195b79c806a02d9545bf0b (diff)
downloadvyatta-cfg-qos-71b9bb01926ee220b73fb3135c5e7f5de9c80023.tar.gz
vyatta-cfg-qos-71b9bb01926ee220b73fb3135c5e7f5de9c80023.zip
Validate shaper class ceiling
Bug 5879
Diffstat (limited to 'lib/Vyatta/Qos/ShaperClass.pm')
-rw-r--r--lib/Vyatta/Qos/ShaperClass.pm13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm
index 088d37f..464c58d 100644
--- a/lib/Vyatta/Qos/ShaperClass.pm
+++ b/lib/Vyatta/Qos/ShaperClass.pm
@@ -78,7 +78,7 @@ sub matchRules {
sub _getPercentRate {
my ( $rate, $speed ) = @_;
- return unless $rate; # no rate defined;
+ return unless defined $rate;
# Rate might be a percentage of speed
if ( $rate =~ /%$/ ) {
@@ -87,13 +87,10 @@ sub _getPercentRate {
die "Invalid percentage bandwidth: $percent\n";
}
- $rate = ( $percent * $speed ) / 100.;
- }
- else {
- $rate = getRate($rate);
- }
+ return ( $percent * $speed ) / 100.;
+ }
- return $rate;
+ return getRate($rate);
}
sub prioQdisc {
@@ -223,7 +220,7 @@ sub rateCheck {
}
my $ceil = _getPercentRate( $self->{_ceiling}, $ifspeed );
- if ( defined $ceil && $ceil < $rate ) {
+ if ( defined($ceil) && $ceil < $rate ) {
print STDERR "Configuration error in: $level\n";
printf STDERR
"The bandwidth ceiling for this class (%dKbps) must be greater or equal to\n",