diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-21 14:31:02 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-21 14:50:32 -0700 |
commit | eff49c504b129dec8a46c5a0e696ccd2ec64bf0b (patch) | |
tree | 8b7939039ea33c3f25c81676dfe481d424fdb07f | |
parent | c1fe58dca6c46d2c37763b3e2c9adf6eb47deaaa (diff) | |
download | vyatta-cfg-qos-eff49c504b129dec8a46c5a0e696ccd2ec64bf0b.tar.gz vyatta-cfg-qos-eff49c504b129dec8a46c5a0e696ccd2ec64bf0b.zip |
Fix traffic-limiter class management
The class configuration function was looking at wrong place
in configuration (bug introduced when default added).
-rw-r--r-- | lib/Vyatta/Qos/TrafficLimiter.pm | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/lib/Vyatta/Qos/TrafficLimiter.pm b/lib/Vyatta/Qos/TrafficLimiter.pm index 32e2dd3..c98727e 100644 --- a/lib/Vyatta/Qos/TrafficLimiter.pm +++ b/lib/Vyatta/Qos/TrafficLimiter.pm @@ -49,32 +49,13 @@ sub _define { $self->{_level} = $level; - # make sure no clash of different types of tc filters - my %matchTypes = (); - foreach my $class ( $config->listNodes("class") ) { - foreach my $match ( $config->listNodes("class $class match") ) { - foreach my $type ( $config->listNodes("class $class match $match") ) - { - next if ( $type eq 'description' ); - $matchTypes{$type} = "$class match $match"; - } - } - } - - if ( scalar keys %matchTypes > 1 && $matchTypes{ip} ) { - print "Match type conflict:\n"; - while ( my ( $type, $usage ) = each(%matchTypes) ) { - print " class $usage $type\n"; - } - die "$level can not match on both ip and other types\n"; - } - if ( $config->exists('default') ) { $config->setLevel("$level default"); push @classes, new Vyatta::Qos::LimiterClass( $config, 0 ); } - foreach my $id ( $config->listNodes('class') ) { + $config->setLevel($level); + foreach my $id ( $config->listNodes("class") ) { $config->setLevel("$level class $id"); push @classes, new Vyatta::Qos::LimiterClass( $config, $id ); } @@ -95,8 +76,8 @@ sub commands { # find largest class id (to use for default) my $maxid = 0; foreach my $class (@$classes) { - my $id = $class->{id}; - $maxid = $id if ( $id > $maxid ); + my $id = $class->{id}; + $maxid = $id if ( $id > $maxid ); } foreach my $class (@$classes) { @@ -112,9 +93,9 @@ sub commands { print " protocol all basic"; printf " %s flowid %x:%x\n", $police, $parent, $id; } else { + my $prio = $class->{priority}; foreach my $match ( $class->matchRules() ) { - $match->filter( $dev, $parent, $id, $class->{priority}, undef, - $police ); + $match->filter( $dev, $parent, $id, $prio, undef, $police ); } } } |