From 4e74f4cde70773874cec5480ab953e47dbd48855 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 20 Aug 2009 13:48:41 -0700 Subject: Add wireless config --- gen-interface-templates.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/gen-interface-templates.pl b/gen-interface-templates.pl index a563d93..57fdd1d 100755 --- a/gen-interface-templates.pl +++ b/gen-interface-templates.pl @@ -33,6 +33,7 @@ my %interface_hash = ( 'ethernet/node.tag/pppoe/node.tag' => 'pppoe$VAR(@)', 'ethernet/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)', 'ethernet/node.tag/vif/node.tag/pppoe/node.tag' => 'pppoe$VAR(@)', + 'wireless/node.tag' => '$VAR(@)', 'bonding/node.tag' => '$VAR(@)', 'bonding/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)', 'pseudo-ethernet/node.tag' => '$VAR(@)', -- cgit v1.2.3 From 673b1bf04db2832596b07eb0e6abb1a0e6bf4217 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 20 Aug 2009 13:48:54 -0700 Subject: 0.13.9 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index ddb1bbf..5e17ce8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg-qos (0.13.9) unstable; urgency=low + + * Add wireless config + + -- Stephen Hemminger Thu, 20 Aug 2009 13:48:54 -0700 + vyatta-cfg-qos (0.13.8) unstable; urgency=low [ Stephen Hemminger ] -- cgit v1.2.3 From e0f015e97b01a0e1f3349e74e5b8c9f2b862022d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 9 Jun 2009 11:07:31 -0700 Subject: Use sudo when getting speed Ethtool doesn't allow non-root user to read settings (in mainline kernel). (cherry picked from commit 767fa8a7e2afeb1d53838a6f544fa1232aef39da) --- lib/Vyatta/Qos/Util.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm index 242e2b4..9686120 100644 --- a/lib/Vyatta/Qos/Util.pm +++ b/lib/Vyatta/Qos/Util.pm @@ -300,7 +300,7 @@ sub ethtoolRate { # Get rate of real device (ignore vlan) $dev =~ s/\.[0-9]+$//; - open( my $ethtool, "/usr/sbin/ethtool $dev 2>/dev/null |" ) + open( my $ethtool, "sudo /usr/sbin/ethtool $dev 2>/dev/null |" ) or die "ethtool failed: $!\n"; # ethtool produces: -- cgit v1.2.3 From c46cba727ad8853991052602315c6a1f3b992e3e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 10 Jun 2009 10:33:46 -0700 Subject: Allow random-detect for Qos policy types without rate Part of Bug 4516 (cherry picked from commit 8f5e0920e7edd83b8d58d016d7ec6964bf222577) --- lib/Vyatta/Qos/ShaperClass.pm | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm index 3a25233..ef18f30 100644 --- a/lib/Vyatta/Qos/ShaperClass.pm +++ b/lib/Vyatta/Qos/ShaperClass.pm @@ -168,18 +168,12 @@ sub fifoQdisc { # sub redQdisc { my ( $self, $dev, $rate ) = @_; - my $qmax = ( $rate * 100 ) / 8000; - my $qmin = $qmax / 3; my $avg = 1024; - my $burst = ( 2 * $qmin + $qmax ) / (3*$avg); - + my $qmax = (defined $rate) ? (( $rate * 100 ) / 8000) : (18 * $avg); + my $qmin = $qmax / 3; + my $burst = ( 2 * $qmin + $qmax ) / (3 * $avg); my $limit = $self->{_limit}; - my $qlimit; - if ($limit) { - $qlimit = $limit * $avg; - } else { - $qlimit = 4 * $qmax; - } + my $qlimit = (defined $limit) ? ($limit * $avg) : (4 * $qmax); printf "red limit %d min %d max %d avpkt %d", $qlimit, $qmin, $qmax, $avg; printf " burst %d probability 0.1 bandwidth %s ecn\n", $burst, $rate; -- cgit v1.2.3 From 5e0d337e371773e81059f5f2513c6f430c3d8e4c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 10 Jun 2009 09:48:39 -0700 Subject: Allow random-detect for round-robin subqueue Bug 4516 (cherry picked from commit 26890ac98e3ed6c0830e61fa91f306fea0cc227a) --- .../round-robin/node.tag/class/node.tag/queue-type/node.def | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/qos-policy/round-robin/node.tag/class/node.tag/queue-type/node.def b/templates/qos-policy/round-robin/node.tag/class/node.tag/queue-type/node.def index 61f9506..8df453b 100644 --- a/templates/qos-policy/round-robin/node.tag/class/node.tag/queue-type/node.def +++ b/templates/qos-policy/round-robin/node.tag/class/node.tag/queue-type/node.def @@ -1,9 +1,10 @@ type: txt -default: "fair-queue" -syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail"; "Unknown queue-type" +default: "drop-tail" +syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail", "random-detect"; "Unknown queue-type" help: Set the queue type for this class comp_help:Possible completions fair-queue\tStochastic Fair Queue (SFQ) drop-tail\tFirst-In-First-Out (FIFO) priority\tPriority queueing based on DSCP + random-detect\tRandom Early Detection (RED) -- cgit v1.2.3 From 6cf4217e392eb4c0956804b1ba66874de68fbd5e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 9 Jun 2009 11:08:38 -0700 Subject: Allow setting queue limit and average packet size Two more (optional) parameters for random detect precedence groups. Bug 4518,4519 (cherry picked from commit 8104da09f5da338c6ce0813c367262de4e417598) --- lib/Vyatta/Qos/RandomDetect.pm | 29 ++++++++++++++-------- .../precedence/node.tag/average-packet/node.def | 4 +++ .../precedence/node.tag/queue-limit/node.def | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def create mode 100644 templates/qos-policy/random-detect/node.tag/precedence/node.tag/queue-limit/node.def diff --git a/lib/Vyatta/Qos/RandomDetect.pm b/lib/Vyatta/Qos/RandomDetect.pm index 1918711..663abc2 100644 --- a/lib/Vyatta/Qos/RandomDetect.pm +++ b/lib/Vyatta/Qos/RandomDetect.pm @@ -31,14 +31,14 @@ use Vyatta::Qos::Util qw/getRate getAutoRate getTime/; # default values for different precedence levels my @default_fields = ( - { 'min-threshold' => 9, 'max-threshold' => 18, 'mark-probability' => 1/2 }, - { 'min-threshold' => 10, 'max-threshold' => 18, 'mark-probability' => 5/9 }, - { 'min-threshold' => 11, 'max-threshold' => 18, 'mark-probability' => .1 }, - { 'min-threshold' => 12, 'max-threshold' => 18, 'mark-probability' => 2/3 }, - { 'min-threshold' => 13, 'max-threshold' => 18, 'mark-probability' => .1 }, - { 'min-threshold' => 14, 'max-threshold' => 18, 'mark-probability' => 7/9 }, - { 'min-threshold' => 15, 'max-threshold' => 18, 'mark-probability' => 5/6 }, - { 'min-threshold' => 16, 'max-threshold' => 18, 'mark-probability' => 8/9 }, + { 'min-threshold' => 9, 'mark-probability' => 1/2 }, + { 'min-threshold' => 10, 'mark-probability' => 5/9 }, + { 'min-threshold' => 11, 'mark-probability' => .1 }, + { 'min-threshold' => 12, 'mark-probability' => 2/3 }, + { 'min-threshold' => 13, 'mark-probability' => .1 }, + { 'min-threshold' => 14, 'mark-probability' => 7/9 }, + { 'min-threshold' => 15, 'mark-probability' => 5/6 }, + { 'min-threshold' => 16, 'mark-probability' => 8/9 }, ); # Create a new instance based on config information @@ -69,8 +69,8 @@ sub getPrecedence { my $defaults = $default_fields[$i]; my %param; - $config->setLevel("$level precedence $i"); - foreach my $field (keys %$defaults) { + foreach my $field (qw(max-threshold average-packet queue-limit), + keys %$defaults) { my $val = $config->returnValue($field); if ( !defined $val ) { @@ -116,10 +116,17 @@ sub commands { my $param = $precedence->[$i]; my $qmin = $param->{'min-threshold'}; my $qmax = $param->{'max-threshold'}; + my $qlimit = $param->{'queue-limit'}; + my $avgpkt = $param->{'average-packet'}; my $prob = $param->{'mark-probability'}; + $qmax = 18 unless $qmax; + $avgpkt = 1024 unless $avgpkt; + $qlimit = 4 * $qmax unless $qlimit; + printf "qdisc change dev %s handle %x:0 gred", $dev, $root+1, $i; - printf " limit %dK min %dK max %dK avpkt 1K", 4 * $qmax, $qmin, $qmax; + printf " limit %d min %d max %d avpkt %d", + $qlimit * $avgpkt, $qmin * $avgpkt, $qmax * $avgpkt, $avgpkt; printf " burst %d bandwidth %d probability %f DP %d prio %d\n", ( 2 * $qmin + $qmax ) / 3, $rate, $prob, $i, 8-$i; } diff --git a/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def new file mode 100644 index 0000000..9b4490d --- /dev/null +++ b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Average packet size (bytes) +default: "1024" +syntax:expression: $VAR(@) >= 16 && $VAR(@) <= 10240 ; "Average packet size must be between 16 and 10240" diff --git a/templates/qos-policy/random-detect/node.tag/precedence/node.tag/queue-limit/node.def b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/queue-limit/node.def new file mode 100644 index 0000000..49c47b4 --- /dev/null +++ b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/queue-limit/node.def @@ -0,0 +1,2 @@ +type: u32 +help: Set maximum queue size (packets) -- cgit v1.2.3 From 969064d17f9cc50a68e2922ec30ec5bb63b31763 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 10 Jun 2009 14:25:14 -0700 Subject: Handle round-robin without configuration of default If default class is not configured Qos. Bug 4529 (cherry picked from commit 0df90b28ca6d9cb6ae4f5267ef8522ac12a0c352) --- lib/Vyatta/Qos/RoundRobin.pm | 13 +++---------- lib/Vyatta/Qos/ShaperClass.pm | 10 +++++++--- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/Vyatta/Qos/RoundRobin.pm b/lib/Vyatta/Qos/RoundRobin.pm index 83a41b7..7cd6b4f 100644 --- a/lib/Vyatta/Qos/RoundRobin.pm +++ b/lib/Vyatta/Qos/RoundRobin.pm @@ -41,16 +41,9 @@ sub _getClasses { my @classes; my $config = new Vyatta::Config; - $config->setLevel($level); - my $default; - if ( $config->exists("default") ) { - $config->setLevel("$level default"); - $default = new Vyatta::Qos::ShaperClass($config); - $config->setLevel($level); - } - else { - $default = new Vyatta::Qos::ShaperClass; - } + $config->setLevel("$level default"); + my $default = new Vyatta::Qos::ShaperClass($config); + push @classes, $default; $default->{id} = 1; diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm index ef18f30..361eb57 100644 --- a/lib/Vyatta/Qos/ShaperClass.pm +++ b/lib/Vyatta/Qos/ShaperClass.pm @@ -209,11 +209,15 @@ sub gen_class { sub gen_leaf { my ( $self, $dev, $parent, $rate ) = @_; + my $qtype = $self->{_qdisc}; + return unless $qtype; # default is okay - printf "qdisc add dev %s parent %x:%x ", $dev, $parent, $self->{id}; + my $q = $qdiscOptions{$qtype}; + die "Unknown queue-type $qtype\n" + unless $q; - my $q = $qdiscOptions{ $self->{_qdisc} }; - $q->( $self, $dev, $rate ) if ($q); + printf "qdisc add dev %s parent %x:%x ", $dev, $parent, $self->{id}; + $q->( $self, $dev, $rate ); } sub dsmarkClass { -- cgit v1.2.3 From 4e41f747e53ebdba0e6f835ec701fa9ee6bb2ead Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 10 Jun 2009 15:59:05 -0700 Subject: Fix management of delete of policy in use Minor config confusion in script. Bug 4532 (cherry picked from commit 28650945b96e0990fbe39e4743bca436662bae66) --- scripts/vyatta-qos.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index 693da36..86b8fe2 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -182,6 +182,7 @@ sub update_interface { } } + # return array of names using given qos-policy sub interfaces_using { my $policy = shift; @@ -191,9 +192,13 @@ sub interfaces_using { foreach my $name ( getInterfaces() ) { my $intf = new Vyatta::Interface($name); next unless $intf; - - $config->setLevel( $intf->path() ); - push @inuse, $name if ( $config->exists("qos-policy $policy") ); + $config->setLevel($intf->path() . ' qos-policy'); + + foreach my $direction ($config->listNodes()) { + my $cur = $config->returnValue($direction); + next unless $cur; + push @inuse, $name if ($cur eq $policy); + } } return @inuse; } @@ -204,7 +209,7 @@ sub delete_policy { my @inuse = interfaces_using($name); die "QoS policy still in use on ", join( ' ', @inuse ), "\n" - if (@inuse); + if @inuse; } } -- cgit v1.2.3 From a4746e015e64aeca8b64b59abd0558ec339323e9 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 10 Jun 2009 16:26:53 -0700 Subject: Fix netem bandwidth (TBF) setup Need limit or latency value Bug 4533 (cherry picked from commit 61a756a5003bda12380c300dbc963adfcc09d888) --- lib/Vyatta/Qos/NetworkEmulator.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/Vyatta/Qos/NetworkEmulator.pm b/lib/Vyatta/Qos/NetworkEmulator.pm index 2a87407..d7a3404 100644 --- a/lib/Vyatta/Qos/NetworkEmulator.pm +++ b/lib/Vyatta/Qos/NetworkEmulator.pm @@ -46,23 +46,28 @@ sub new { sub commands { my ( $self, $dev ) = @_; my $rate = $self->{_rate}; + my $limit = $self->{_limit}; + my $delay = $self->{_delay}; if ($rate) { my $burst = $self->{_burst}; $burst or $burst = "15K"; - printf "qdisc add dev %s root handle 1:0 tbf rate %s burst %s\n", + printf "qdisc add dev %s root handle 1:0 tbf rate %s burst %s", $dev, $rate, $burst; - printf "qdisc add dev %s parent 1:1 handle 10: netem", $dev; + if ($limit) { + print " limit $limit"; + } elsif ($delay) { + print " latency $delay"; + } else { + print " latency 50ms"; + } + printf "\nqdisc add dev %s parent 1:1 handle 10: netem", $dev; } else { printf "qdisc add dev %s root netem", $dev; } - - my $delay = $self->{_delay}; - print " delay $delay" if ($delay); - - my $limit = $self->{_limit}; print " limit $limit" if ($limit); + print " delay $delay" if ($delay); my $drop = $self->{_drop}; print " drop $drop" if ($drop); -- cgit v1.2.3 From c0f3b93ee22d5885a5fbe1027ccab2e95313884a Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 10 Jun 2009 19:52:55 -0700 Subject: Change initialization of WRED parameters Bug 4544, 4543 Rereading documentation: mark-probability should always be 1/10 min-threshold should be scaled if max-threshold changed Also enforce sanity constraints on values. (cherry picked from commit 3a88e33b7d06814faac5c20e539f3b5d28f2bcb5) --- lib/Vyatta/Qos/RandomDetect.pm | 82 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/lib/Vyatta/Qos/RandomDetect.pm b/lib/Vyatta/Qos/RandomDetect.pm index 663abc2..0ceb4d6 100644 --- a/lib/Vyatta/Qos/RandomDetect.pm +++ b/lib/Vyatta/Qos/RandomDetect.pm @@ -29,18 +29,6 @@ use warnings; require Vyatta::Config; use Vyatta::Qos::Util qw/getRate getAutoRate getTime/; -# default values for different precedence levels -my @default_fields = ( - { 'min-threshold' => 9, 'mark-probability' => 1/2 }, - { 'min-threshold' => 10, 'mark-probability' => 5/9 }, - { 'min-threshold' => 11, 'mark-probability' => .1 }, - { 'min-threshold' => 12, 'mark-probability' => 2/3 }, - { 'min-threshold' => 13, 'mark-probability' => .1 }, - { 'min-threshold' => 14, 'mark-probability' => 7/9 }, - { 'min-threshold' => 15, 'mark-probability' => 5/6 }, - { 'min-threshold' => 16, 'mark-probability' => 8/9 }, -); - # Create a new instance based on config information sub new { my ( $that, $config, $name ) = @_; @@ -66,22 +54,37 @@ sub getPrecedence { my @precedence; for ( my $i = 0 ; $i <= 7 ; $i++ ) { - my $defaults = $default_fields[$i]; - my %param; + my %pred; + + $config->setLevel("$level precedence $i"); + + # Compute some sane defaults based on predence and max-threshold + $pred{qmax} = $config->returnValue('maximum-threshold'); + $pred{qmax} = 18 unless $pred{qmax}; - foreach my $field (qw(max-threshold average-packet queue-limit), - keys %$defaults) { - my $val = $config->returnValue($field); - - if ( !defined $val ) { - $param{$field} = $defaults->{$field}; - } elsif ( $field eq 'mark-probability' ) { - $param{$field} = 1 / $val; - } else { - $param{$field} = $val; - } - } - $precedence[$i] = \%param; + $pred{qmin} = $config->returnValue('minimum-threshold'); + if ($pred{qmin}) { + die "min-threshold: $pred{qmin} > max-threshold: $pred{qmax}\n" + if ($pred{qmin} > $pred{qmax}); + } else { + $pred{qmin} = ((9 + $i) * $pred{qmax})/ 18; + } + + $pred{qlim} = $config->returnValue('queue-limit'); + if ($pred{qlim}) { + die "queue-limit: $pred{qlim} < max-threshold: $pred{qmax}\n" + if ($pred{qlim} < $pred{qmax}); + } else { + $pred{qlim} = 4 * $pred{qmax}; + } + + my $mp = $config->returnValue('mark-probablilty'); + $pred{prob} = (defined $mp) ? (1 / $mp) : (1 / 10); + + my $avgpkt = $config->returnValue('average-packet'); + $pred{avpkt} = (defined $avgpkt) ? $avgpkt : 1024; + + $precedence[$i] = \%pred; } return @precedence; @@ -98,7 +101,7 @@ sub commands { $dev, $root; # 2. use tcindex filter to convert tc_index to precedence - # + # # Precedence Field: the three leftmost bits in the TOS octet of an IPv4 # header. @@ -113,22 +116,17 @@ sub commands { # set VQ parameters for ( my $i = 0 ; $i <= 7 ; $i++ ) { - my $param = $precedence->[$i]; - my $qmin = $param->{'min-threshold'}; - my $qmax = $param->{'max-threshold'}; - my $qlimit = $param->{'queue-limit'}; - my $avgpkt = $param->{'average-packet'}; - my $prob = $param->{'mark-probability'}; - - $qmax = 18 unless $qmax; - $avgpkt = 1024 unless $avgpkt; - $qlimit = 4 * $qmax unless $qlimit; + my $pred = $precedence->[$i]; + my $avg = $pred->{avpkt}; + my $burst = ( 2 * $pred->{qmin} + $pred->{qmax} ) / 3; printf "qdisc change dev %s handle %x:0 gred", $dev, $root+1, $i; printf " limit %d min %d max %d avpkt %d", - $qlimit * $avgpkt, $qmin * $avgpkt, $qmax * $avgpkt, $avgpkt; + $pred->{qlim} * $avg, $pred->{qmin} * $avg, + $pred->{qmax} * $avg, $avg; + printf " burst %d bandwidth %d probability %f DP %d prio %d\n", - ( 2 * $qmin + $qmax ) / 3, $rate, $prob, $i, 8-$i; + $burst, $rate, $pred->{prob}, $i, 8-$i; } } @@ -146,8 +144,8 @@ sub isChanged { while ( my ( $pred, $status ) = each %precedenceNodes ) { return "precedence $pred" if ( $status ne 'static' ); - my $defaults = $default_fields[0]; - foreach my $attr (keys %$defaults) { + foreach my $attr qw(average-packet min-threshold mark-probability + max-threshold queue-limit) { return "precedence $pred $attr" if ( $config->isChanged("precedence $pred $attr") ); } -- cgit v1.2.3 From ba4170471de90b2a32abeff6b48ec13461e7f9b1 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 11 Jun 2009 15:54:31 -0700 Subject: IPV6 match fix Bug 4548 The tc u32 filter command wants "ipv6" in protocol field but "ip6" in the match field. Make up your mind Alexey! (cherry picked from commit e7d228450c037ce16923dee385e127e7028d3358) --- lib/Vyatta/Qos/Match.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index 8dda94d..dbcd3f1 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -88,6 +88,7 @@ sub filter { printf "filter add dev %s parent %x:", $dev, $parent; printf " prio %d", $prio if ($prio); + if ($proto ne 'ether') { print " protocol $proto u32"; print " match $proto dsfield $$p{dsfield} 0xff" if $$p{dsfield}; @@ -98,6 +99,10 @@ sub filter { print " protocol $type u32"; } + + # workaround inconsistent usage in tc u32 match + $proto = 'ip6' if ($proto eq 'ipv6'); + print " match $proto src $$p{src}" if $$p{src}; print " match $proto sport $$p{sport} 0xffff" if $$p{sport}; print " match $proto dst $$p{dst}" if $$p{dst}; -- cgit v1.2.3 From 4cd540436f0b946ca6b8206d7166c56094a6e9e4 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 11 Jun 2009 16:55:29 -0700 Subject: Cleanup how qos-policy change detection works The CLI end: node does work correctly, so don't need to go walking configuration manually Bug 4545 (cherry picked from commit 377896b296827e4d7c3c20debb3487605c45bbe3) --- lib/Vyatta/Qos/DropTail.pm | 8 ---- lib/Vyatta/Qos/FairQueue.pm | 11 ----- lib/Vyatta/Qos/NetworkEmulator.pm | 12 ----- lib/Vyatta/Qos/RandomDetect.pm | 24 ---------- lib/Vyatta/Qos/RateLimiter.pm | 11 ----- lib/Vyatta/Qos/RoundRobin.pm | 51 --------------------- lib/Vyatta/Qos/TrafficLimiter.pm | 45 ------------------- lib/Vyatta/Qos/TrafficShaper.pm | 62 -------------------------- scripts/vyatta-qos.pl | 34 +++++++------- templates/qos-policy/drop-tail/node.def | 6 +-- templates/qos-policy/fair-queue/node.def | 6 +-- templates/qos-policy/network-emulator/node.def | 6 +-- templates/qos-policy/random-detect/node.def | 6 +-- templates/qos-policy/rate-limit/node.def | 6 +-- templates/qos-policy/round-robin/node.def | 6 +-- templates/qos-policy/traffic-limiter/node.def | 6 +-- templates/qos-policy/traffic-shaper/node.def | 6 +-- 17 files changed, 42 insertions(+), 264 deletions(-) diff --git a/lib/Vyatta/Qos/DropTail.pm b/lib/Vyatta/Qos/DropTail.pm index 1b14a81..0ff15e9 100644 --- a/lib/Vyatta/Qos/DropTail.pm +++ b/lib/Vyatta/Qos/DropTail.pm @@ -47,12 +47,4 @@ sub commands { printf "%s\n", $cmd; } -sub isChanged { - my ($self, $name) = @_; - my $config = new Vyatta::Config; - - $config->setLevel("qos-policy drop-tail $name"); - return $config->isChanged('queue-limit'); -} - 1; diff --git a/lib/Vyatta/Qos/FairQueue.pm b/lib/Vyatta/Qos/FairQueue.pm index bc3a872..c74cb01 100644 --- a/lib/Vyatta/Qos/FairQueue.pm +++ b/lib/Vyatta/Qos/FairQueue.pm @@ -52,15 +52,4 @@ sub commands { print "\n"; } -sub isChanged { - my ( $self, $name ) = @_; - my $config = new Vyatta::Config; - - $config->setLevel("qos-policy fair-queue $name"); - foreach my $attr ('hash-interval', 'queue-limit') { - return $attr if ($config->isChanged($attr)); - } - return; # false -} - 1; diff --git a/lib/Vyatta/Qos/NetworkEmulator.pm b/lib/Vyatta/Qos/NetworkEmulator.pm index d7a3404..602393c 100644 --- a/lib/Vyatta/Qos/NetworkEmulator.pm +++ b/lib/Vyatta/Qos/NetworkEmulator.pm @@ -81,16 +81,4 @@ sub commands { print "\n"; } -sub isChanged { - my ( $self, $name ) = @_; - my $config = new Vyatta::Config; - - $config->setLevel("qos-policy network-emulator $name"); - foreach my $attr ( "bandwidth", "burst", "queue-limit", "network-delay", - "packet-loss", "packet-corruption", "packet-reordering", ) { - return $attr if ( $config->isChanged($attr) ); - } - return; -} - 1; diff --git a/lib/Vyatta/Qos/RandomDetect.pm b/lib/Vyatta/Qos/RandomDetect.pm index 0ceb4d6..6e6dad0 100644 --- a/lib/Vyatta/Qos/RandomDetect.pm +++ b/lib/Vyatta/Qos/RandomDetect.pm @@ -130,28 +130,4 @@ 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 Vyatta::Config; - - $config->setLevel("qos-policy random-detect $name"); - - return 'bandwidth' if ( $config->isChanged('bandwidth') ); - - my %precedenceNodes = $config->listNodeStatus('precedence'); - while ( my ( $pred, $status ) = each %precedenceNodes ) { - return "precedence $pred" if ( $status ne 'static' ); - - foreach my $attr qw(average-packet min-threshold mark-probability - max-threshold queue-limit) { - return "precedence $pred $attr" - if ( $config->isChanged("precedence $pred $attr") ); - } - } - - return; # false -} - 1; diff --git a/lib/Vyatta/Qos/RateLimiter.pm b/lib/Vyatta/Qos/RateLimiter.pm index c20646e..ac0cd2c 100644 --- a/lib/Vyatta/Qos/RateLimiter.pm +++ b/lib/Vyatta/Qos/RateLimiter.pm @@ -55,15 +55,4 @@ sub commands { $dev, $self->{_rate}, $self->{_latency}, $self->{_burst}; } -sub isChanged { - my ($self, $name) = @_; - my $config = new Vyatta::Config; - - $config->setLevel("qos-policy rate-limit $name"); - foreach my $attr ('bandwidth', 'burst', 'latency') { - return $attr if ($config->isChanged($attr)); - } - return; # false -} - 1; diff --git a/lib/Vyatta/Qos/RoundRobin.pm b/lib/Vyatta/Qos/RoundRobin.pm index 7cd6b4f..af45875 100644 --- a/lib/Vyatta/Qos/RoundRobin.pm +++ b/lib/Vyatta/Qos/RoundRobin.pm @@ -74,55 +74,4 @@ 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 Vyatta::Config; - - $config->setLevel("qos-policy round-robin $name"); - - return 'quantum' if ( $config->isChanged('quantum') ); - - foreach my $attr (qw(queue-limit queue-type)) { - return "default $attr" if ( $config->isChanged("default $attr") ); - } - - my %classNodes = $config->listNodeStatus('class'); - while ( my ( $class, $status ) = each %classNodes ) { - return "class $class" if ( $status ne 'static' ); - - foreach my $attr (qw(queue-limit queue-type)) { - return "class $class $attr" - if ( $config->isChanged("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 protocol', - 'ip source address', - 'ip destination address', - 'ip source port', - 'ip destination port' - ) - ) - { - return "$level $parm" - if ( $config->isChanged("$level $parm") ); - } - } - } - - return; # false -} - 1; diff --git a/lib/Vyatta/Qos/TrafficLimiter.pm b/lib/Vyatta/Qos/TrafficLimiter.pm index fd3460c..b2fd07c 100644 --- a/lib/Vyatta/Qos/TrafficLimiter.pm +++ b/lib/Vyatta/Qos/TrafficLimiter.pm @@ -90,49 +90,4 @@ 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 Vyatta::Config; - - $config->setLevel("qos-policy traffic-limiter $name"); - my %classNodes = $config->listNodeStatus('class'); - while ( my ( $class, $status ) = each %classNodes ) { - if ( $status ne 'static' ) { - return "class $class"; - } - - foreach my $attr ( 'bandwidth', 'burst', 'priority' ) { - 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' - ) - { - return "$level $parm" if ( $config->isChanged("$level $parm") ); - } - } - } - - return; # false -} - 1; diff --git a/lib/Vyatta/Qos/TrafficShaper.pm b/lib/Vyatta/Qos/TrafficShaper.pm index c808c7d..f51d373 100644 --- a/lib/Vyatta/Qos/TrafficShaper.pm +++ b/lib/Vyatta/Qos/TrafficShaper.pm @@ -157,66 +157,4 @@ 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 Vyatta::Config; - my @attributes = qw(bandwidth burst ceiling priority queue-limit queue-type); - - $config->setLevel("qos-policy traffic-shaper $name"); - - if ( $config->isChanged('bandwidth') ) { - return 'bandwidth'; - } - - foreach my $attr (@attributes) { - 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 (@attributes) { - 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', - 'ether destination', - 'ether source', - 'ether protocol', - '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; # false -} - 1; diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index 86b8fe2..e0a1b0f 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -192,12 +192,16 @@ sub interfaces_using { foreach my $name ( getInterfaces() ) { my $intf = new Vyatta::Interface($name); next unless $intf; - $config->setLevel($intf->path() . ' qos-policy'); + my $level = $intf->path() . ' qos-policy'; + $config->setLevel($level); foreach my $direction ($config->listNodes()) { my $cur = $config->returnValue($direction); next unless $cur; - push @inuse, $name if ($cur eq $policy); + + # these are arguments to update_interface() + push @inuse, [ $name, $direction, $name ] + if ($cur eq $policy); } } return @inuse; @@ -224,19 +228,17 @@ sub create_policy { # Configuration changed, reapply to all interfaces. sub apply_policy { - my $config = new Vyatta::Config; - - while ( my $name = shift ) { - foreach my $device ( interfaces_using($name) ) { - my $intf = new Vyatta::Interface($device); - - $config->setLevel( $intf->path() ); - foreach my $direction ( $config->listNodes('qos-policy') ) { - next unless $config->exists("qos-policy $direction $name"); + my ( $policy, $name ) = @_; + my @usedby = interfaces_using($name); - update_interface( $device, $direction, $name ); - } - } + if (@usedby) { + foreach my $args (@usedby) { + update_interface( @$args ); + } + } else { + # Recheck the policy, might have new errors. + my $shaper = make_policy( $policy, $name ); + exit 1 unless $shaper; } } @@ -245,7 +247,7 @@ sub usage { usage: vyatta-qos.pl --list-policy direction vyatta-qos.pl --create-policy policy-type policy-name vyatta-qos.pl --delete-policy policy-name - vyatta-qos.pl --apply-policy policy-name + vyatta-qos.pl --apply-policy policy-type policy-name vyatta-qos.pl --update-interface interface direction policy-name vyatta-qos.pl --delete-interface interface direction @@ -270,7 +272,7 @@ GetOptions( "list-policy=s" => \@listPolicy, "delete-policy=s" => \@deletePolicy, "create-policy=s{2}" => \@createPolicy, - "apply-policy=s" => \@applyPolicy, + "apply-policy=s{2}" => \@applyPolicy, ) or usage(); delete_interface(@deleteInterface) if ( $#deleteInterface == 1 ); diff --git a/templates/qos-policy/drop-tail/node.def b/templates/qos-policy/drop-tail/node.def index 111bb63..49561c3 100644 --- a/templates/qos-policy/drop-tail/node.def +++ b/templates/qos-policy/drop-tail/node.def @@ -3,6 +3,6 @@ type: txt help: Set drop tail queue (FIFO) policy syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" -create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy "$VAR(@)" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) diff --git a/templates/qos-policy/fair-queue/node.def b/templates/qos-policy/fair-queue/node.def index ac9dc2d..15b995a 100644 --- a/templates/qos-policy/fair-queue/node.def +++ b/templates/qos-policy/fair-queue/node.def @@ -3,6 +3,6 @@ type: txt help: Set fair queueing policy syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" -create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy "$VAR(@)" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@)" diff --git a/templates/qos-policy/network-emulator/node.def b/templates/qos-policy/network-emulator/node.def index 4a3e570..2f383f8 100644 --- a/templates/qos-policy/network-emulator/node.def +++ b/templates/qos-policy/network-emulator/node.def @@ -3,6 +3,6 @@ type: txt help: Setup network emulator policy syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" -create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy "$VAR(@)" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) diff --git a/templates/qos-policy/random-detect/node.def b/templates/qos-policy/random-detect/node.def index 02911a1..f6da04a 100644 --- a/templates/qos-policy/random-detect/node.def +++ b/templates/qos-policy/random-detect/node.def @@ -3,6 +3,6 @@ type: txt help: Set Weighted Random Early Detect policy syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" -create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy "$VAR(@)" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) diff --git a/templates/qos-policy/rate-limit/node.def b/templates/qos-policy/rate-limit/node.def index 2e3eed1..6da6f67 100644 --- a/templates/qos-policy/rate-limit/node.def +++ b/templates/qos-policy/rate-limit/node.def @@ -3,6 +3,6 @@ type: txt help: Set rate limiting policy syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" -create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy "$VAR(@)" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) diff --git a/templates/qos-policy/round-robin/node.def b/templates/qos-policy/round-robin/node.def index daf795a..6d15978 100644 --- a/templates/qos-policy/round-robin/node.def +++ b/templates/qos-policy/round-robin/node.def @@ -3,6 +3,6 @@ type: txt help: Set deficit round robin based policy syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" -create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy "$VAR(@)" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) diff --git a/templates/qos-policy/traffic-limiter/node.def b/templates/qos-policy/traffic-limiter/node.def index b411273..38bd516 100644 --- a/templates/qos-policy/traffic-limiter/node.def +++ b/templates/qos-policy/traffic-limiter/node.def @@ -3,6 +3,6 @@ type: txt help: Set traffic input limiting policy syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" -create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy "$VAR(@)" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) diff --git a/templates/qos-policy/traffic-shaper/node.def b/templates/qos-policy/traffic-shaper/node.def index e54c093..4c7b73c 100644 --- a/templates/qos-policy/traffic-shaper/node.def +++ b/templates/qos-policy/traffic-shaper/node.def @@ -3,6 +3,6 @@ type: txt help: Set traffic shaping based policy syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" -create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy "$VAR(@)" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) -- cgit v1.2.3 From c5e332cdf5b734357efef9e385ad5099538a0bd0 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 12 Jun 2009 18:40:52 -0700 Subject: remove pseudo-ethernet vif (cherry picked from commit c1b29a3f355350a7b0409f215f144d9cf46a6977) --- gen-interface-templates.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen-interface-templates.pl b/gen-interface-templates.pl index 57fdd1d..f779f1f 100755 --- a/gen-interface-templates.pl +++ b/gen-interface-templates.pl @@ -37,7 +37,7 @@ my %interface_hash = ( 'bonding/node.tag' => '$VAR(@)', 'bonding/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)', 'pseudo-ethernet/node.tag' => '$VAR(@)', - 'pseudo-ethernet/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)', +# 'pseudo-ethernet/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)', 'tunnel/node.tag' => '$VAR(@)', 'bridge/node.tag' => '$VAR(@)', -- cgit v1.2.3 From 016dd00049e8c2bae87831c04a450f68a3278898 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 10:52:25 -0700 Subject: Address issues in traffic-shaper match Fix bug when matching only ether protocol field (Bug 4539) Fix IPV6 match (Bug 4548) (cherry picked from commit 4ce140e2d2376b647f5dc65de0316bd331167a41) --- lib/Vyatta/Qos/Match.pm | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index dbcd3f1..7b81043 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -89,24 +89,31 @@ sub filter { printf "filter add dev %s parent %x:", $dev, $parent; printf " prio %d", $prio if ($prio); - if ($proto ne 'ether') { - print " protocol $proto u32"; - print " match $proto dsfield $$p{dsfield} 0xff" if $$p{dsfield}; - print " match $proto protocol $$p{protocol} 0xff" if $$p{protocol}; - } else { + if ($proto eq 'ether') { my $type = $$p{protocol}; $type = 'all' unless $type; - print " protocol $type u32"; - } - - # workaround inconsistent usage in tc u32 match - $proto = 'ip6' if ($proto eq 'ipv6'); + if (defined($$p{src}) || defined($$p{dest})) { + print " protocol $type u32"; + print " match ether src $$p{src}" if $$p{src}; + print " match ether dst $$p{dst}" if $$p{dst}; + } else { + # u32 requires some options to work but basic works + print " protocol $type basic"; + } + } else { + print " protocol $proto u32"; - print " match $proto src $$p{src}" if $$p{src}; - print " match $proto sport $$p{sport} 0xffff" if $$p{sport}; - print " match $proto dst $$p{dst}" if $$p{dst}; - print " match $proto dport $$p{dport} 0xffff" if $$p{dport}; + # workaround inconsistent usage in tc u32 match + my $sel = ($proto eq 'ipv6') ? 'ip6' : $proto; + print " match $sel dsfield $$p{dsfield} 0xff" if $$p{dsfield}; + print " match $sel protocol $$p{protocol} 0xff" if $$p{protocol}; + + print " match $sel src $$p{src}" if $$p{src}; + print " match $sel sport $$p{sport} 0xffff" if $$p{sport}; + print " match $sel dst $$p{dst}" if $$p{dst}; + print " match $sel dport $$p{dport} 0xffff" if $$p{dport}; + } } my $indev = $self->{indev}; -- cgit v1.2.3 From 78396db2d9b7b7a9f05fb2a27616cf37660b14d7 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 11:05:51 -0700 Subject: Require bandwidth setting for default class Check for bandwidth value on default class (Bug 4551) (cherry picked from commit e69c7c849e70edd757b160488f83035f2a16be66) --- lib/Vyatta/Qos/TrafficShaper.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Vyatta/Qos/TrafficShaper.pm b/lib/Vyatta/Qos/TrafficShaper.pm index f51d373..10bc90a 100644 --- a/lib/Vyatta/Qos/TrafficShaper.pm +++ b/lib/Vyatta/Qos/TrafficShaper.pm @@ -72,8 +72,10 @@ sub _checkClasses { my $rate = shift; my $default = shift; - # if auto, can't check at create must wait for policy to be applied + # if auto, can't check for constraints until later $rate = ( $rate eq "auto") ? undef : getRate($rate); + die "Bandwidth not defined for default traffic\n" + unless $default->{_rate}; $default->rateCheck( $rate, "$level default" ) if $rate; foreach my $class (@_) { -- cgit v1.2.3 From 83aef96b5eefe8c851f3cac7492b71eed3afe51b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 11:34:44 -0700 Subject: Fix update (apply-policy) at end The $VAR(.) is not set on end node, so have to go hunting for policy type. Related to Bug 4545 (cherry picked from commit 39712bfaf390a4435218a14308cc6efa1a2d39b8) --- scripts/vyatta-qos.pl | 25 ++++++++++++++----------- templates/qos-policy/drop-tail/node.def | 2 +- templates/qos-policy/fair-queue/node.def | 2 +- templates/qos-policy/network-emulator/node.def | 2 +- templates/qos-policy/random-detect/node.def | 2 +- templates/qos-policy/rate-limit/node.def | 2 +- templates/qos-policy/round-robin/node.def | 2 +- templates/qos-policy/traffic-limiter/node.def | 2 +- templates/qos-policy/traffic-shaper/node.def | 2 +- 9 files changed, 22 insertions(+), 19 deletions(-) diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index e0a1b0f..2576af1 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -228,17 +228,20 @@ sub create_policy { # Configuration changed, reapply to all interfaces. sub apply_policy { - my ( $policy, $name ) = @_; - my @usedby = interfaces_using($name); - - if (@usedby) { - foreach my $args (@usedby) { - update_interface( @$args ); + while (my $name = shift) { + my @usedby = interfaces_using($name); + if (@usedby) { + foreach my $args (@usedby) { + update_interface( @$args ); + } + } else { + # Recheck the policy, might have new errors. + my $policy = find_policy($name); + die "Unknown policy name $name\n" unless $policy; + + my $shaper = make_policy( $policy, $name ); + exit 1 unless $shaper; } - } else { - # Recheck the policy, might have new errors. - my $shaper = make_policy( $policy, $name ); - exit 1 unless $shaper; } } @@ -272,7 +275,7 @@ GetOptions( "list-policy=s" => \@listPolicy, "delete-policy=s" => \@deletePolicy, "create-policy=s{2}" => \@createPolicy, - "apply-policy=s{2}" => \@applyPolicy, + "apply-policy=s" => \@applyPolicy, ) or usage(); delete_interface(@deleteInterface) if ( $#deleteInterface == 1 ); diff --git a/templates/qos-policy/drop-tail/node.def b/templates/qos-policy/drop-tail/node.def index 49561c3..1bbb25f 100644 --- a/templates/qos-policy/drop-tail/node.def +++ b/templates/qos-policy/drop-tail/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) diff --git a/templates/qos-policy/fair-queue/node.def b/templates/qos-policy/fair-queue/node.def index 15b995a..9af92ed 100644 --- a/templates/qos-policy/fair-queue/node.def +++ b/templates/qos-policy/fair-queue/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@)" +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@)" diff --git a/templates/qos-policy/network-emulator/node.def b/templates/qos-policy/network-emulator/node.def index 2f383f8..9a89c53 100644 --- a/templates/qos-policy/network-emulator/node.def +++ b/templates/qos-policy/network-emulator/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) diff --git a/templates/qos-policy/random-detect/node.def b/templates/qos-policy/random-detect/node.def index f6da04a..7dc1caa 100644 --- a/templates/qos-policy/random-detect/node.def +++ b/templates/qos-policy/random-detect/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) diff --git a/templates/qos-policy/rate-limit/node.def b/templates/qos-policy/rate-limit/node.def index 6da6f67..57bf98e 100644 --- a/templates/qos-policy/rate-limit/node.def +++ b/templates/qos-policy/rate-limit/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) diff --git a/templates/qos-policy/round-robin/node.def b/templates/qos-policy/round-robin/node.def index 6d15978..4427e1a 100644 --- a/templates/qos-policy/round-robin/node.def +++ b/templates/qos-policy/round-robin/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) diff --git a/templates/qos-policy/traffic-limiter/node.def b/templates/qos-policy/traffic-limiter/node.def index 38bd516..f8bdf26 100644 --- a/templates/qos-policy/traffic-limiter/node.def +++ b/templates/qos-policy/traffic-limiter/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) diff --git a/templates/qos-policy/traffic-shaper/node.def b/templates/qos-policy/traffic-shaper/node.def index 4c7b73c..cd7b07d 100644 --- a/templates/qos-policy/traffic-shaper/node.def +++ b/templates/qos-policy/traffic-shaper/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(.) $VAR(@) +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) -- cgit v1.2.3 From e653c208a4ac2e063bb56bbfdaf19f6e9d998e00 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 13:13:02 -0700 Subject: Fix issues with vif match Typo in hash for match Bug 4583 (cherry picked from commit 2631b297f701250537ed0eeda21d5fe01c67785f) --- lib/Vyatta/Qos/Match.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index 7b81043..fd1714a 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -116,9 +116,9 @@ sub filter { } } - my $indev = $self->{indev}; - my $vif = $self->{vif}; - if ( $vif || $indev ) { + my $indev = $self->{_indev}; + my $vif = $self->{_vif}; + if ( defined($vif) || defined($indev) ) { printf "filter add dev %s parent %x: prio %d", $dev, $parent, $prio; print " protocol all basic"; print " match meta\(rt_iif eq $indev\)" if $indev; -- cgit v1.2.3 From c22deb0c01bb270c61ff3aabd71c533567c293f7 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 13:21:34 -0700 Subject: Ignore deleted policy on end test If policy is deleted, then the end: check is still run, but can be safely ignored. (cherry picked from commit 68312d5d735861153fbd28e5e3c98000761ca9a2) --- scripts/vyatta-qos.pl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index 2576af1..9844d06 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -234,11 +234,8 @@ sub apply_policy { foreach my $args (@usedby) { update_interface( @$args ); } - } else { + } elsif (my $policy = find_policy($name)) { # Recheck the policy, might have new errors. - my $policy = find_policy($name); - die "Unknown policy name $name\n" unless $policy; - my $shaper = make_policy( $policy, $name ); exit 1 unless $shaper; } -- cgit v1.2.3 From 24bdadbcbf93a9ae6822024b33ebd6f43b5488f4 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 14:07:12 -0700 Subject: Fix DSCP field match with set-dscp Special case of DSCP changing exposed bug in dscp match code. Bug 4551 (cherry picked from commit 87f3e3dd1d054e5c356b8b9e251eb23b6a35bb32) --- lib/Vyatta/Qos/Match.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index fd1714a..98b7286 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -75,9 +75,9 @@ sub filter { my $ip = $self->{$ipver}; next unless $ip && $$ip{dsfield}; - printf "filter add dev %s parent %x: protocol $ipver prio 1", - $dev, $parent; - printf " handle %d tcindex", $$ip{dsfield}; + printf "filter add dev %s parent %x: protocol %s prio 1", + $dev, $parent, $ipver; + print " handle $$ip{dsfield} tcindex", } return; } -- cgit v1.2.3 From f8e91a2a8591fada3004bd5aee8912017799bf2b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 14:13:22 -0700 Subject: Fix policy update If policy is updated, then the function interfaces_using() has to set correct arguments for later update. (cherry picked from commit db0b46b068eda15884eb92636d52d6f821869283) --- scripts/vyatta-qos.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index 9844d06..b7106c2 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -200,7 +200,7 @@ sub interfaces_using { next unless $cur; # these are arguments to update_interface() - push @inuse, [ $name, $direction, $name ] + push @inuse, [ $name, $direction, $policy ] if ($cur eq $policy); } } -- cgit v1.2.3 From 737f6fa46eefdcfda1150c9647c0a7a919de71ae Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 14:40:03 -0700 Subject: Fix mixed protocol matches If matching on multiple protocols in same traffic-shaper class then the filter command was garbaled. Bug 4552 (cherry picked from commit 22e0d06a750abc2847e7e7bc96d8abf341a5bca1) --- lib/Vyatta/Qos/Match.pm | 10 +++++++--- lib/Vyatta/Qos/TrafficShaper.pm | 6 ++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index 98b7286..682996f 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -63,7 +63,7 @@ sub new { } sub filter { - my ( $self, $dev, $parent, $prio, $dsmark ) = @_; + my ( $self, $dev, $parent, $classid, $prio, $dsmark ) = @_; # empty match return unless %{$self}; @@ -77,8 +77,9 @@ sub filter { printf "filter add dev %s parent %x: protocol %s prio 1", $dev, $parent, $ipver; - print " handle $$ip{dsfield} tcindex", - } + printf " handle %s tcindex classid %x:%x\n", + $$ip{dsfield}, $parent, $classid; + } return; } @@ -114,6 +115,8 @@ sub filter { print " match $sel dst $$p{dst}" if $$p{dst}; print " match $sel dport $$p{dport} 0xffff" if $$p{dport}; } + + printf " classid %x:%x\n", $parent, $classid; } my $indev = $self->{_indev}; @@ -123,5 +126,6 @@ sub filter { print " protocol all basic"; print " match meta\(rt_iif eq $indev\)" if $indev; print " match meta\(vlan mask 0xfff eq $vif\)" if $vif; + printf " classid %x:%x\n", $parent, $classid; } } diff --git a/lib/Vyatta/Qos/TrafficShaper.pm b/lib/Vyatta/Qos/TrafficShaper.pm index 10bc90a..f89ae60 100644 --- a/lib/Vyatta/Qos/TrafficShaper.pm +++ b/lib/Vyatta/Qos/TrafficShaper.pm @@ -134,8 +134,7 @@ sub commands { foreach my $class (@$classes) { $class->dsmarkClass( 1, $dev ); foreach my $match ( $class->matchRules() ) { - $match->filter( $dev, 1, 1 ); - printf " classid %x:%x\n", $parent, $class->{id}; + $match->filter( $dev, $parent, $class->{id}, 1 ); } } @@ -153,8 +152,7 @@ sub commands { $class->gen_leaf( $dev, $parent, $rate ); foreach my $match ( $class->matchRules() ) { - $match->filter( $dev, $parent, 1, $class->{dsmark} ); - printf " classid %x:%x\n", $parent, $class->{id}; + $match->filter( $dev, $parent, $class->{id}, 1, $class->{dsmark} ); } } } -- cgit v1.2.3 From 54aa517fcde3cb0165a06c72aa008e81e6689a4e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 15:33:30 -0700 Subject: Fix IPV6 traffic-class match This resolves issues with mulitple filters (can't have same priority), and IPV6 traffic-class/dscp match rules Bug 4552 (cherry picked from commit da8a3fdc4e5cc526bb28f6959944f3635c23a6ed) --- lib/Vyatta/Qos/Match.pm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index 682996f..033aee1 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -75,11 +75,13 @@ sub filter { my $ip = $self->{$ipver}; next unless $ip && $$ip{dsfield}; - printf "filter add dev %s parent %x: protocol %s prio 1", + printf "filter add dev %s parent %x: protocol %s prio $prio", $dev, $parent, $ipver; printf " handle %s tcindex classid %x:%x\n", $$ip{dsfield}, $parent, $classid; - } + + $prio += 1; + } return; } @@ -88,7 +90,10 @@ sub filter { next unless $p; printf "filter add dev %s parent %x:", $dev, $parent; - printf " prio %d", $prio if ($prio); + if ($prio) { + printf " prio %d", $prio; + $prio += 1; + } if ($proto eq 'ether') { my $type = $$p{protocol}; @@ -106,8 +111,14 @@ sub filter { print " protocol $proto u32"; # workaround inconsistent usage in tc u32 match - my $sel = ($proto eq 'ipv6') ? 'ip6' : $proto; - print " match $sel dsfield $$p{dsfield} 0xff" if $$p{dsfield}; + my $sel = $proto; + if ($proto eq 'ipv6') { + $sel = 'ip6'; + printf " match u16 0x%x 0x0ff0 at 0", hex($$p{dsfield}) << 4, + if $$p{dsfield}; + } else { + print " match $sel dsfield $$p{dsfield} 0xff" if $$p{dsfield}; + } print " match $sel protocol $$p{protocol} 0xff" if $$p{protocol}; print " match $sel src $$p{src}" if $$p{src}; -- cgit v1.2.3 From f35ca4081ade052dd2e050c12915ae1e56c834db Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 16 Jun 2009 11:04:01 -0700 Subject: Remove extra quote that caused shell error in fair-queue Bug 4590 (cherry picked from commit 447b5430e8f4019e5d3b6e3f1f2025712d1c7b7f) --- templates/qos-policy/fair-queue/node.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/qos-policy/fair-queue/node.def b/templates/qos-policy/fair-queue/node.def index 9af92ed..1966ab6 100644 --- a/templates/qos-policy/fair-queue/node.def +++ b/templates/qos-policy/fair-queue/node.def @@ -5,4 +5,4 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" ; "only alpha-numeric policy name allowed" create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@) -end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@)" +end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@) -- cgit v1.2.3 From e6eafcc5c3251c2c1afa9cc3b0638be442856fca Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 16 Jun 2009 16:25:22 -0700 Subject: Don't allow random-detect type for round-robin queue type Random detect requires bandwidth which is not part of round robin policy. Therefore drop it as a configurable value. Bug 4595 (cherry picked from commit b1b823012b2a1aa0fa8578054fc1179f92a32c2f) --- .../round-robin/node.tag/class/node.tag/queue-type/node.def | 4 +--- templates/qos-policy/round-robin/node.tag/default/queue-type/node.def | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/templates/qos-policy/round-robin/node.tag/class/node.tag/queue-type/node.def b/templates/qos-policy/round-robin/node.tag/class/node.tag/queue-type/node.def index 8df453b..ecbcede 100644 --- a/templates/qos-policy/round-robin/node.tag/class/node.tag/queue-type/node.def +++ b/templates/qos-policy/round-robin/node.tag/class/node.tag/queue-type/node.def @@ -1,10 +1,8 @@ type: txt default: "drop-tail" -syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail", "random-detect"; "Unknown queue-type" +syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail"; "Unknown queue-type" help: Set the queue type for this class comp_help:Possible completions fair-queue\tStochastic Fair Queue (SFQ) drop-tail\tFirst-In-First-Out (FIFO) priority\tPriority queueing based on DSCP - random-detect\tRandom Early Detection (RED) - diff --git a/templates/qos-policy/round-robin/node.tag/default/queue-type/node.def b/templates/qos-policy/round-robin/node.tag/default/queue-type/node.def index 295c04c..61f9506 100644 --- a/templates/qos-policy/round-robin/node.tag/default/queue-type/node.def +++ b/templates/qos-policy/round-robin/node.tag/default/queue-type/node.def @@ -1,10 +1,9 @@ type: txt default: "fair-queue" -syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail", "random-detect"; "Unknown queue-type" +syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail"; "Unknown queue-type" help: Set the queue type for this class comp_help:Possible completions fair-queue\tStochastic Fair Queue (SFQ) drop-tail\tFirst-In-First-Out (FIFO) priority\tPriority queueing based on DSCP - random-detect\tRandom Early Detection (RED) -- cgit v1.2.3 From 6736b2088a169d10e179e561e603e9e6993513fa Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 16 Jun 2009 16:55:50 -0700 Subject: random-detect needs qmax > qmin Need some space to compute RED parameters Bug 4594 (cherry picked from commit 603752d0771c2bdaf77e18e0f65135ac090fde85) --- lib/Vyatta/Qos/RandomDetect.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Vyatta/Qos/RandomDetect.pm b/lib/Vyatta/Qos/RandomDetect.pm index 6e6dad0..e7f16f3 100644 --- a/lib/Vyatta/Qos/RandomDetect.pm +++ b/lib/Vyatta/Qos/RandomDetect.pm @@ -64,8 +64,8 @@ sub getPrecedence { $pred{qmin} = $config->returnValue('minimum-threshold'); if ($pred{qmin}) { - die "min-threshold: $pred{qmin} > max-threshold: $pred{qmax}\n" - if ($pred{qmin} > $pred{qmax}); + die "min-threshold: $pred{qmin} >= max-threshold: $pred{qmax}\n" + if ($pred{qmin} >= $pred{qmax}); } else { $pred{qmin} = ((9 + $i) * $pred{qmax})/ 18; } -- cgit v1.2.3 From 4a86133a0d7a4d20887c2f2d726d1558f47c476b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 16 Jun 2009 17:12:54 -0700 Subject: Fix match rules for traffic limiter Need to pass police string in to Match filter generator. Bug 4596 (cherry picked from commit 340773bacdacbb88586ff0ea8d053990205bd538) --- lib/Vyatta/Qos/Match.pm | 9 +++++---- lib/Vyatta/Qos/RoundRobin.pm | 3 +-- lib/Vyatta/Qos/TrafficLimiter.pm | 8 +++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index 033aee1..327fbd4 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -63,7 +63,7 @@ sub new { } sub filter { - my ( $self, $dev, $parent, $classid, $prio, $dsmark ) = @_; + my ( $self, $dev, $parent, $classid, $prio, $dsmark, $police ) = @_; # empty match return unless %{$self}; @@ -126,8 +126,8 @@ sub filter { print " match $sel dst $$p{dst}" if $$p{dst}; print " match $sel dport $$p{dport} 0xffff" if $$p{dport}; } - - printf " classid %x:%x\n", $parent, $classid; + print " $police" if $police; + printf " flowid %x:%x\n", $parent, $classid; } my $indev = $self->{_indev}; @@ -137,6 +137,7 @@ sub filter { print " protocol all basic"; print " match meta\(rt_iif eq $indev\)" if $indev; print " match meta\(vlan mask 0xfff eq $vif\)" if $vif; - printf " classid %x:%x\n", $parent, $classid; + print " $police" if $police; + printf " flowid %x:%x\n", $parent, $classid; } } diff --git a/lib/Vyatta/Qos/RoundRobin.pm b/lib/Vyatta/Qos/RoundRobin.pm index af45875..a1d7787 100644 --- a/lib/Vyatta/Qos/RoundRobin.pm +++ b/lib/Vyatta/Qos/RoundRobin.pm @@ -68,8 +68,7 @@ sub commands { $class->gen_class( $dev, 'drr', $parent ); $class->gen_leaf( $dev, $parent ); foreach my $match ( $class->matchRules() ) { - $match->filter( $dev, $parent, 1 ); - printf " classid %x:%x\n", $parent, $class->{id}; + $match->filter( $dev, $parent, $class->{id}, 1); } } } diff --git a/lib/Vyatta/Qos/TrafficLimiter.pm b/lib/Vyatta/Qos/TrafficLimiter.pm index b2fd07c..e5731d0 100644 --- a/lib/Vyatta/Qos/TrafficLimiter.pm +++ b/lib/Vyatta/Qos/TrafficLimiter.pm @@ -83,9 +83,11 @@ sub commands { printf "qdisc add dev %s handle %x: ingress\n", $dev, $parent; foreach my $class (@$classes) { foreach my $match ( $class->matchRules() ) { - $match->filter( $dev, $parent, $class->{priority} ); - printf " police rate %s burst %s drop flowid :%x\n", - $class->{rate}, $class->{burst}, $class->{id}; + my $police = " police rate " . $class->{rate} + . " burst " . $class->{burst}; + + $match->filter( $dev, $parent, $class->{id}, $class->{priority}, + undef, $police ); } } } -- cgit v1.2.3 From 7be3888cba2342a5e7ad2cd774af82558205711e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 13 Jul 2009 12:30:08 -0700 Subject: Fix perl error when attempting to delete qos policy Bug 4597 Don't print ARRAY() print the element of that array. (cherry picked from commit 24889117e3aa124071e13541d4a6b663476226a2) --- scripts/vyatta-qos.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index b7106c2..eb04ec8 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -183,7 +183,7 @@ sub update_interface { } -# return array of names using given qos-policy +# return array of references to (name, direction, policy) sub interfaces_using { my $policy = shift; my $config = new Vyatta::Config; @@ -210,9 +210,11 @@ sub interfaces_using { # check if policy name(s) are still in use sub delete_policy { while ( my $name = shift ) { - my @inuse = interfaces_using($name); + # interfaces_using returns array of array and only want name + my @inuse = map { @$_[0] } interfaces_using($name); - die "QoS policy still in use on ", join( ' ', @inuse ), "\n" + die "Can not delete qos-policy $name, still applied" + . " to interface ", join(' ', @inuse), "\n" if @inuse; } } -- cgit v1.2.3 From 31678ed9d1021242342576f4b2b21827f077d404 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 27 Jul 2009 14:49:09 -0700 Subject: Allow update to interface if not present yet Solves issues like Bug 4759 where qos-policy is commited to an interface that does not exist in system until later. (cherry picked from commit f94f46058fce5ca110a24ef90935b0f517b16d33) --- scripts/vyatta-qos.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index eb04ec8..487fdc6 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -155,6 +155,12 @@ sub update_interface { my $shaper = make_policy( $policy, $name, $direction ); exit 1 unless $shaper; + if ( ! -d "/sys/class/net/$device" ) { + warn "$device not present yet, qos-policy will be applied later\n"; + return; + } + + # Remove old policy delete_interface( $device, $direction ); -- cgit v1.2.3 From 38ea757d358a17dd1dab4cb62bc4253339304b52 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 1 Oct 2009 13:52:13 -0700 Subject: 0.13.10 --- debian/changelog | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/debian/changelog b/debian/changelog index 5e17ce8..3668154 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,34 @@ +vyatta-cfg-qos (0.13.10) unstable; urgency=low + + * Use sudo when getting speed + * Allow random-detect for Qos policy types without rate + * Allow random-detect for round-robin subqueue + * Allow setting queue limit and average packet size + * Handle round-robin without configuration of default + * Fix management of delete of policy in use + * Fix netem bandwidth (TBF) setup + * Change initialization of WRED parameters + * IPV6 match fix + * Cleanup how qos-policy change detection works + * remove pseudo-ethernet vif + * Address issues in traffic-shaper match + * Require bandwidth setting for default class + * Fix update (apply-policy) at end + * Fix issues with vif match + * Ignore deleted policy on end test + * Fix DSCP field match with set-dscp + * Fix policy update + * Fix mixed protocol matches + * Fix IPV6 traffic-class match + * Remove extra quote that caused shell error in fair-queue + * Don't allow random-detect type for round-robin queue type + * random-detect needs qmax > qmin + * Fix match rules for traffic limiter + * Fix perl error when attempting to delete qos policy + * Allow update to interface if not present yet + + -- Stephen Hemminger Thu, 01 Oct 2009 13:52:13 -0700 + vyatta-cfg-qos (0.13.9) unstable; urgency=low * Add wireless config -- cgit v1.2.3 From a8154090a563b0ab465aeed7e379c803aafefb40 Mon Sep 17 00:00:00 2001 From: slioch Date: Tue, 20 Oct 2009 11:37:58 -0700 Subject: add support for priority in project --- templates/qos-policy/node.def | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/qos-policy/node.def b/templates/qos-policy/node.def index e692c0f..e6a2afc 100644 --- a/templates/qos-policy/node.def +++ b/templates/qos-policy/node.def @@ -1 +1,2 @@ +priority: 900 help: Configure Quality of Service (QOS) policy type -- cgit v1.2.3 From fef6d3e86ca22f76f10f738b1ff24c58182336f1 Mon Sep 17 00:00:00 2001 From: slioch Date: Tue, 20 Oct 2009 16:16:15 -0700 Subject: 0.13.11 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3668154..fd03c52 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg-qos (0.13.11) unstable; urgency=low + + * add support for priority in project + + -- slioch Tue, 20 Oct 2009 16:16:15 -0700 + vyatta-cfg-qos (0.13.10) unstable; urgency=low * Use sudo when getting speed -- cgit v1.2.3 From 8d8847c2123600ccadd5fa4ad78a2dd0afbd4144 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Thu, 5 Nov 2009 16:47:21 -0800 Subject: Fix parse error found by check_tmpl script. --- .../random-detect/node.tag/precedence/node.tag/average-packet/node.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def index 9b4490d..23cdb0f 100644 --- a/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def +++ b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def @@ -1,4 +1,4 @@ type: u32 help: Average packet size (bytes) -default: "1024" +default: 1024 syntax:expression: $VAR(@) >= 16 && $VAR(@) <= 10240 ; "Average packet size must be between 16 and 10240" -- cgit v1.2.3 From 37119a7e25133f6729a902073451a449732526cd Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Thu, 5 Nov 2009 16:47:32 -0800 Subject: 0.13.12 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index fd03c52..10c19c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg-qos (0.13.12) unstable; urgency=low + + * Fix parse error found by check_tmpl script. + + -- Stig Thormodsrud Thu, 05 Nov 2009 16:47:32 -0800 + vyatta-cfg-qos (0.13.11) unstable; urgency=low * add support for priority in project -- cgit v1.2.3 From 72b334397fe88516044b245b7d0d76fbcec711f8 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Fri, 13 Nov 2009 14:01:02 -0800 Subject: dependency update --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index d9dce92..a5ce364 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Depends: sed (>= 4.1.5), perl (>= 5.8.8), procps (>= 1:3.2.7-3), coreutils (>= 5.97-5.3), - vyatta-cfg, + vyatta-cfg (>= 0.15.33), vyatta-bash | bash (>= 3.1), iproute | vyatta-iproute, sudo, -- cgit v1.2.3 From 50530ef1a093bcad45aef16afd7ea7a16a9cafbc Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Fri, 13 Nov 2009 14:01:25 -0800 Subject: 0.13.13 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 10c19c5..3c26a81 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg-qos (0.13.13) unstable; urgency=low + + * dependency update + + -- Michael Larson Fri, 13 Nov 2009 14:01:25 -0800 + vyatta-cfg-qos (0.13.12) unstable; urgency=low * Fix parse error found by check_tmpl script. -- cgit v1.2.3 From f62e60803ba84e3edb352d7fd51ceb2214ff2371 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Mon, 30 Nov 2009 15:59:58 -0800 Subject: added required keyword to help text. --- templates/qos-policy/drop-tail/node.tag/queue-limit/node.def | 2 +- .../traffic-limiter/node.tag/class/node.tag/bandwidth/node.def | 2 +- templates/qos-policy/traffic-shaper/node.tag/default/bandwidth/node.def | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/qos-policy/drop-tail/node.tag/queue-limit/node.def b/templates/qos-policy/drop-tail/node.tag/queue-limit/node.def index 49c47b4..fe3b4dd 100644 --- a/templates/qos-policy/drop-tail/node.tag/queue-limit/node.def +++ b/templates/qos-policy/drop-tail/node.tag/queue-limit/node.def @@ -1,2 +1,2 @@ type: u32 -help: Set maximum queue size (packets) +help: Set maximum queue size (packets) [REQUIRED] diff --git a/templates/qos-policy/traffic-limiter/node.tag/class/node.tag/bandwidth/node.def b/templates/qos-policy/traffic-limiter/node.tag/class/node.tag/bandwidth/node.def index 21a46a4..13c70ee 100644 --- a/templates/qos-policy/traffic-limiter/node.tag/class/node.tag/bandwidth/node.def +++ b/templates/qos-policy/traffic-limiter/node.tag/class/node.tag/bandwidth/node.def @@ -1,5 +1,5 @@ type: txt -help: Set the traffic-limit used for this class +help: Set the traffic-limit used for this class [REQUIRED] syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --rate $VAR(@)" comp_help: Allowed values: Bandwidth in Kbps diff --git a/templates/qos-policy/traffic-shaper/node.tag/default/bandwidth/node.def b/templates/qos-policy/traffic-shaper/node.tag/default/bandwidth/node.def index 3743688..f0bc773 100644 --- a/templates/qos-policy/traffic-shaper/node.tag/default/bandwidth/node.def +++ b/templates/qos-policy/traffic-shaper/node.tag/default/bandwidth/node.def @@ -1,5 +1,5 @@ type: txt -help: Set the bandwidth used for default traffic +help: Set the bandwidth used for default traffic [REQUIRED] syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --percent-or-rate \$VAR(@)" comp_help: Allowed values: Bandwidth in Kbps per second -- cgit v1.2.3 From 33b8a1ebeb7925890bd744d1bda5f5c6c686c537 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Mon, 30 Nov 2009 16:00:24 -0800 Subject: 0.13.14 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3c26a81..16cd265 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg-qos (0.13.14) unstable; urgency=low + + * added required keyword to help text. + + -- Michael Larson Mon, 30 Nov 2009 16:00:24 -0800 + vyatta-cfg-qos (0.13.13) unstable; urgency=low * dependency update -- cgit v1.2.3