diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-29 17:22:54 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-29 17:22:54 -0700 |
commit | cb9532549c0eb2390cbd7d3eba1b5254bc7cb734 (patch) | |
tree | f2ad37870a2b5650c8c08fc1776d2fc3298d9930 | |
parent | ad3d4ae244558ee0377ef600ece482f22048ff03 (diff) | |
download | vyatta-cfg-qos-cb9532549c0eb2390cbd7d3eba1b5254bc7cb734.tar.gz vyatta-cfg-qos-cb9532549c0eb2390cbd7d3eba1b5254bc7cb734.zip |
Fix round-robin filter and class generation
This resolves problems with filter and classes for round-robin
policy.
Bug 5950 and 5952
-rw-r--r-- | lib/Vyatta/Qos/Match.pm | 6 | ||||
-rw-r--r-- | lib/Vyatta/Qos/RoundRobin.pm | 30 |
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} ); } } } |