summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/RoundRobin.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Vyatta/Qos/RoundRobin.pm')
-rw-r--r--lib/Vyatta/Qos/RoundRobin.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Vyatta/Qos/RoundRobin.pm b/lib/Vyatta/Qos/RoundRobin.pm
index b7d72b2..d9e90e9 100644
--- a/lib/Vyatta/Qos/RoundRobin.pm
+++ b/lib/Vyatta/Qos/RoundRobin.pm
@@ -26,8 +26,10 @@ require Vyatta::Qos::ShaperClass;
# Create a new instance based on config information
sub new {
my ( $that, $config, $name ) = @_;
-
my @classes = _getClasses( $config->setLevel() );
+
+ _checkClasses( @classes );
+
my $self = {};
my $class = ref($that) || $that;
bless $self, $class;
@@ -36,6 +38,22 @@ sub new {
return $self;
}
+# Check constraints on sub queues
+sub _checkClasses {
+ my $level = shift;
+
+ foreach my $class (@_) {
+ my $level = $class->{level};
+ my $qtype = $class->{_qdisc};
+ my $qlimit = $class->{_limit};
+
+ if ($qtype eq 'random-detect' && defined($qlimit) && $qlimit >= 128) {
+ print STDERR "Configuration error in: $level\n";
+ die "queue limit must be between 1 and 127 for random-detect\n";
+ }
+ }
+}
+
sub _getClasses {
my $level = shift;
my @classes;