summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-09-27 12:59:56 +0200
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-09-27 18:51:33 +0200
commit54ca57c7022035213a741bf54c3f21c0c201b4a0 (patch)
tree6c371dffb6f8aaf2650fe74aa316960d1806281f
parent7086db424ed36a05b801d0e80b0dc5aac3529ff1 (diff)
downloadvyatta-op-qos-54ca57c7022035213a741bf54c3f21c0c201b4a0.tar.gz
vyatta-op-qos-54ca57c7022035213a741bf54c3f21c0c201b4a0.zip
Fix problem in parsing of qdisc command
Bugfix 3720 The RED qdisc was overlooked on the pretty print list, and it produces additional lines of output that needed to be skipped.
-rwxr-xr-xscripts/vyatta-show-queueing.pl45
1 files changed, 26 insertions, 19 deletions
diff --git a/scripts/vyatta-show-queueing.pl b/scripts/vyatta-show-queueing.pl
index 385a438..d4a9112 100755
--- a/scripts/vyatta-show-queueing.pl
+++ b/scripts/vyatta-show-queueing.pl
@@ -37,6 +37,7 @@ my %qdisc_types = (
'tbf' => 'rate-limit',
'htb' => 'traffic-shaper',
'pfifo' => 'drop-tail',
+ 'red' => 'random-detect',
# future
'prio' => 'priority',
@@ -129,28 +130,34 @@ sub show {
open($tc, "/sbin/tc -s qdisc show dev $interface |" )
or die 'tc command failed: $!';
- my $rootid;
- while (<$tc>) {
- # qdisc htb 1: root r2q 10 default 20 direct_packets...
- # qdisc sfq 8001: parent 1:2 limit ...
- my ( undef, $qdisc, $qid, $parent ) = split;
- # Sent 13860 bytes 88 pkt (dropped 0, overlimits 0 requeues 0)
- $_ = <$tc>;
- chomp;
- my ( undef, $sent, undef, undef, undef, undef, $drop, undef, $over ) =
- split;
- $drop =~ s/,$//;
-
- # rate 0bit 0pps backlog 0b 0p requeues 0
- <$tc>;
-
- my $shaper = $qdisc_types{$qdisc};
- defined $shaper or $shaper = '[' . $qdisc . ']';
+ my ($rootid, $qdisc, $parent, $qid);
+ while (<$tc>) {
+ chomp;
+ my @fields = split;
+ if ( $fields[0] eq 'qdisc') {
+ # qdisc htb 1: root r2q 10 default 20 direct_packets...
+ (undef, $qdisc, $qid, $parent) = @fields;
+ next;
+ }
+
+ # skip unwanted extra stats
+ next if ($fields[0] ne 'Sent');
+
+ # Sent 13860 bytes 88 pkt (dropped 0, overlimits 0 requeues 0)
+ my (undef, $sent, undef, undef, undef, undef, $drop, undef, $over )
+ = @fields;
+ # fix silly punctuation bug in tc
+ $drop =~ s/,$//;
+
+ my $shaper = $qdisc_types{$qdisc};
+
+ # this only happens if user uses some qdisc not in pretty print list
+ defined $shaper or $shaper = '[' . $qdisc . ']';
my $id = $classmap{$qid};
defined $id or $id = $qid;
-
+
if ($parent eq 'root') {
printf "%-10s" , $id;
$rootid = $id;
@@ -158,7 +165,7 @@ sub show {
$id =~ s/$rootid//;
printf " %-8s", $id;
}
- printf "%-16s %10d %10d %10d\n", $shaper, $sent, $drop, $over;
+ printf "%-16s %10d %10d %10d\n", $shaper, $sent, $drop, $over;
}
close $tc;
}