summaryrefslogtreecommitdiff
path: root/scripts/VyattaQosTrafficShaper.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-02-14 10:44:50 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-02-14 10:44:50 -0800
commit33e9fbd53200bcb39b19fe9258679e9c27b67c2f (patch)
treed138ce9ae6a6d4d93361a7dc506f4d89dabdcaae /scripts/VyattaQosTrafficShaper.pm
parent13dfe609dfddf211b39d92fa372e0f583cd07355 (diff)
downloadvyatta-cfg-qos-33e9fbd53200bcb39b19fe9258679e9c27b67c2f.tar.gz
vyatta-cfg-qos-33e9fbd53200bcb39b19fe9258679e9c27b67c2f.zip
detect match conflicts during commit
Matching on 'ip' uses the u32 tc filter and other match types 'interface', 'vif' use the basic tc filter. Since kernel doesn't allow mixing filter types in the same classifier, need to catch and report the problem rather than failing in the actual commands.
Diffstat (limited to 'scripts/VyattaQosTrafficShaper.pm')
-rw-r--r--scripts/VyattaQosTrafficShaper.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm
index 361a2dd..854ee41 100644
--- a/scripts/VyattaQosTrafficShaper.pm
+++ b/scripts/VyattaQosTrafficShaper.pm
@@ -173,6 +173,26 @@ sub _define {
$config->exists("default")
or die "Configuration not complete: missing default class\n";
+
+ # 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") ) {
+ $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 "Can't match on both ip and other types\n";
+ }
+
+
$config->setLevel("$level default");
push @classes, new ShaperClass($config, -1);
$config->setLevel($level);