summaryrefslogtreecommitdiff
path: root/scripts/VyattaQosTrafficShaper.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-07-15 14:13:51 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-07-15 14:13:51 -0700
commit81b51bb9270e77289604493761a2f7cb047bd3ea (patch)
treebc8c6d8cb285ea99ba8b4296b9b2a26b6bb4efea /scripts/VyattaQosTrafficShaper.pm
parent3dd93c5175de9a4d32cadb7bb0c4f832fb14312d (diff)
downloadvyatta-cfg-qos-81b51bb9270e77289604493761a2f7cb047bd3ea.tar.gz
vyatta-cfg-qos-81b51bb9270e77289604493761a2f7cb047bd3ea.zip
Look for changes in QoS after commit
Since configuration system doesn't correctly notify on addition/deletion, have to introduce this extra verbosity to have each traffic-shaper type check for changes. Bugfix for 3452
Diffstat (limited to 'scripts/VyattaQosTrafficShaper.pm')
-rw-r--r--scripts/VyattaQosTrafficShaper.pm50
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm
index f321e9b..325c02e 100644
--- a/scripts/VyattaQosTrafficShaper.pm
+++ b/scripts/VyattaQosTrafficShaper.pm
@@ -404,4 +404,54 @@ sub commands {
}
}
+# Walk configuration tree and look for changed nodes
+# The configuration system should do this but doesn't do it right
+sub isChanged {
+ my ($self, $name) = @_;
+ my $config = new VyattaConfig;
+
+ $config->setLevel("qos-policy traffic-shaper $name");
+
+ if ($config->isChanged('bandwidth') ) {
+ return 'bandwidth';
+ }
+
+ foreach my $attr ('bandwidth', 'burst', 'ceiling', 'priority', 'queue-limit', 'queue-type') {
+ if ($config->isChanged("default $attr")) {
+ return "default $attr";
+ }
+ }
+
+ my %classNodes = $config->listNodeStatus('class');
+ while (my ($class, $status) = each %classNodes) {
+ if ($status ne 'static') {
+ return "class $class";
+ }
+
+ foreach my $attr ('bandwidth', 'burst', 'ceiling', 'priority', 'queue-limit', 'queue-type') {
+ if ($config->isChanged("class $class $attr")) {
+ return "class $class $attr";
+ }
+ }
+
+ my %matchNodes = $config->listNodeStatus("class $class match");
+ while (my ($match, $status) = each %matchNodes) {
+ my $level = "class $class match $match";
+ if ($status ne 'static') {
+ return $level;
+ }
+
+ foreach my $parm ('vif', 'interface', 'ip dscp', 'ip protocol',
+ 'ip source address', 'ip destination address',
+ 'ip source port', 'ip destination port') {
+ if ($config->isChanged("$level $parm")) {
+ return "$level $parm";
+ }
+ }
+ }
+ }
+
+ return undef; # false
+}
+
1;