summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Vyatta/Qos/TrafficShaper.pm21
-rw-r--r--lib/Vyatta/Qos/Util.pm21
2 files changed, 21 insertions, 21 deletions
diff --git a/lib/Vyatta/Qos/TrafficShaper.pm b/lib/Vyatta/Qos/TrafficShaper.pm
index 114bba7..665a47d 100644
--- a/lib/Vyatta/Qos/TrafficShaper.pm
+++ b/lib/Vyatta/Qos/TrafficShaper.pm
@@ -45,25 +45,6 @@ sub new {
return $self;
}
-# Rate can be something like "auto" or "10.2mbit"
-sub _getAutoRate {
- my ( $rate, $dev ) = @_;
-
- if ( $rate eq "auto" ) {
- $rate = interfaceRate($dev);
- if ( !defined $rate ) {
- print STDERR
- "Interface $dev speed cannot be determined (assuming 10mbit)\n";
- $rate = 10000000;
- }
- }
- else {
- $rate = getRate($rate);
- }
-
- return $rate;
-}
-
sub _getClasses {
my $level = shift;
my @classes;
@@ -103,7 +84,7 @@ sub _checkClasses {
sub commands {
my ( $self, $dev ) = @_;
- my $rate = _getAutoRate( $self->{_rate}, $dev );
+ my $rate = getAutoRate( $self->{_rate}, $dev );
my $classes = $self->{_classes};
my %dsmark = ();
my $default = shift @$classes;
diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm
index c78e762..3aefbd8 100644
--- a/lib/Vyatta/Qos/Util.pm
+++ b/lib/Vyatta/Qos/Util.pm
@@ -20,7 +20,7 @@ use strict;
use warnings;
our @EXPORT =
- qw(getRate getPercent getBurstSize getProtocol getDsfield getTime);
+ qw(getRate getPercent getBurstSize getProtocol getDsfield getTime getAutoRate);
our @EXPORT_OK = qw(interfaceRate getIfIndex);
use base qw(Exporter);
@@ -65,6 +65,25 @@ my %rates = (
'tbps' => 8000000000000.,
);
+# Rate can be something like "auto" or "10.2mbit"
+sub getAutoRate {
+ my ( $rate, $dev ) = @_;
+
+ if ( $rate eq "auto" ) {
+ $rate = interfaceRate($dev);
+ if ( !defined $rate ) {
+ print STDERR
+ "Interface $dev speed cannot be determined (assuming 10mbit)\n";
+ $rate = 10000000;
+ }
+ }
+ else {
+ $rate = getRate($rate);
+ }
+
+ return $rate;
+}
+
sub getRate {
my $rate = shift;
my ( $num, $suffix ) = get_num($rate);