summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Vyatta/Qos/TrafficLimiter.pm33
-rw-r--r--templates/traffic-policy/limiter/node.tag/default/priority/node.def8
2 files changed, 7 insertions, 34 deletions
diff --git a/lib/Vyatta/Qos/TrafficLimiter.pm b/lib/Vyatta/Qos/TrafficLimiter.pm
index 93ea302..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) {
@@ -110,11 +91,11 @@ sub commands {
# Null filter for default rule
printf "filter add dev %s parent %x: prio %d", $dev, $parent, 255;
print " protocol all basic";
- print " %s flowid %x:%x\n", $police, $parent, $id;
+ 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 );
}
}
}
diff --git a/templates/traffic-policy/limiter/node.tag/default/priority/node.def b/templates/traffic-policy/limiter/node.tag/default/priority/node.def
deleted file mode 100644
index 916a3c7..0000000
--- a/templates/traffic-policy/limiter/node.tag/default/priority/node.def
+++ /dev/null
@@ -1,8 +0,0 @@
-type: u32
-help: Priority for rule evaluation
-default: 20
-syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 20 ; \
- "priority must be between 0 and 20"
-help: Priority for rule evaluation
-
-val_help: u32:0-20; Rule evaluation order