summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-29 17:22:54 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-08-17 17:04:12 -0700
commitc7ee5c9e13920eb42422e474f08c7f3d8a8ec324 (patch)
tree01dc1da02560b60850b7f13d200f279d10a35835 /lib/Vyatta/Qos
parentb76b37c0752c6f4845ddb4e780f6933a711ee0ac (diff)
downloadvyatta-cfg-qos-c7ee5c9e13920eb42422e474f08c7f3d8a8ec324.tar.gz
vyatta-cfg-qos-c7ee5c9e13920eb42422e474f08c7f3d8a8ec324.zip
Fix round-robin filter and class generation
This resolves problems with filter and classes for round-robin policy. Bug 5950 and 5952 (cherry picked from commit cb9532549c0eb2390cbd7d3eba1b5254bc7cb734)
Diffstat (limited to 'lib/Vyatta/Qos')
-rw-r--r--lib/Vyatta/Qos/Match.pm6
-rw-r--r--lib/Vyatta/Qos/RoundRobin.pm30
2 files changed, 19 insertions, 17 deletions
diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm
index 50e20f1..dc6f2db 100644
--- a/lib/Vyatta/Qos/Match.pm
+++ b/lib/Vyatta/Qos/Match.pm
@@ -45,6 +45,12 @@ sub new {
bless $self, $class;
+ # special case for match all
+ unless ($config) {
+ $self->{'ether'} = { protocol => 'all' };
+ return $self;
+ }
+
foreach my $af (qw(ip ipv6 ether)) {
next unless $config->exists($af);
diff --git a/lib/Vyatta/Qos/RoundRobin.pm b/lib/Vyatta/Qos/RoundRobin.pm
index c86bd05..d9cedfd 100644
--- a/lib/Vyatta/Qos/RoundRobin.pm
+++ b/lib/Vyatta/Qos/RoundRobin.pm
@@ -22,6 +22,7 @@ use warnings;
require Vyatta::Config;
require Vyatta::Qos::ShaperClass;
+require Vyatta::Qos::Match;
# Create a new instance based on config information
sub new {
@@ -47,7 +48,8 @@ sub _checkClasses {
my $qtype = $class->{_qdisc};
my $qlimit = $class->{_limit};
- if ($qtype eq 'random-detect' && defined($qlimit) && $qlimit >= 128) {
+ if (defined($qtype) && $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";
}
@@ -56,21 +58,22 @@ sub _checkClasses {
sub _getClasses {
my $level = shift;
- my @classes;
my $config = new Vyatta::Config;
+ my @classes;
- $config->setLevel("$level default");
- my $default = new Vyatta::Qos::ShaperClass($config);
- if ($default) {
- push @classes, $default;
- $default->{id} = 1;
- }
-
+ $config->setLevel($level);
foreach my $id ( $config->listNodes("class") ) {
$config->setLevel("$level class $id");
push @classes, new Vyatta::Qos::ShaperClass( $config, $id );
}
+ $config->setLevel("$level default");
+ my $default = new Vyatta::Qos::ShaperClass($config, 4096);
+
+ # Workaround for lack of default class in drr qdisc
+ $default->{_match} = [ new Vyatta::Qos::Match() ];
+ push @classes, $default;
+
return @classes;
}
@@ -87,15 +90,8 @@ sub commands {
$class->gen_class( $dev, 'drr', $parent );
$class->gen_leaf( $dev, $parent );
- if ($class->{id} == 1) {
- printf "filter add dev %s parent %x: prio %d",
- $dev, $parent, 4096;
- printf " protocol all basic flowid %x:1\n", $parent;
- next;
- }
-
foreach my $match ( $class->matchRules() ) {
- $match->filter( $dev, $parent, $class->{id}, $class->{id} - 1 );
+ $match->filter( $dev, $parent, $class->{id}, $class->{id} );
}
}
}