summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-02-10 13:47:04 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-02-10 13:47:04 -0800
commit7e40c009a39a69181de9e8eadb1f750078c72dd2 (patch)
treeabcb103aa9a50f5df1e5d37e8eb12540eacdb3b6
parent2d401f4df4844a6770aa1ade657b79fefe80b761 (diff)
downloadvyatta-op-qos-7e40c009a39a69181de9e8eadb1f750078c72dd2.tar.gz
vyatta-op-qos-7e40c009a39a69181de9e8eadb1f750078c72dd2.zip
Ignore top-level dsmark class when displaying
Makes show queueing match what user expects based on configuration Bug 4450
-rwxr-xr-xscripts/vyatta-show-queueing.pl27
1 files changed, 20 insertions, 7 deletions
diff --git a/scripts/vyatta-show-queueing.pl b/scripts/vyatta-show-queueing.pl
index d7679ad..657a44c 100755
--- a/scripts/vyatta-show-queueing.pl
+++ b/scripts/vyatta-show-queueing.pl
@@ -55,8 +55,7 @@ sub shaper {
my $qdisc = shift;
my $shaper = $qdisc_types{$qdisc};
- defined $shaper or $shaper = '[' . $qdisc . ']';
- return $shaper;
+ return $shaper ? $shaper : '[' . $qdisc . ']';
}
sub show_brief {
@@ -71,12 +70,19 @@ sub show_brief {
my @lines;
my ( $qdisc, $parent, $ifname, $id );
+ my $root = 'root';
+
while (<$tc>) {
chomp;
my @fields = split;
if ( $fields[0] eq 'qdisc' ) {
+ my ($ptype, $pid);
+ # Examples:
# qdisc sfq 8003: dev eth1 root limit 127p quantum 1514b
- ( undef, $qdisc, $id, undef, $ifname, $parent ) = @fields;
+ # qdisc gred 2: dev eth0 parent 1:
+ ( undef, $qdisc, $id, undef, $ifname, $ptype, $pid ) = @fields;
+
+ $parent = ($ptype eq 'parent') ? $pid : $ptype;
next;
}
@@ -93,8 +99,11 @@ sub show_brief {
if ( $id eq 'ffff:' ) {
$ingress{$ifname} =
[ $ifname, shaper($qdisc), $sent, $drop, $over ];
- }
- elsif ( $parent eq 'root' ) {
+ } elsif ( $qdisc eq 'dsmark' ) {
+ # dsmark is used as a top-level before htb or gred
+ $root = $id;
+ } elsif ( $parent eq $root ) {
+ $root = 'root';
if ($intf_type) {
my $intf = new Vyatta::Interface($ifname);
next unless ( $intf && ( $intf->type() eq $intf_type ) );
@@ -151,6 +160,7 @@ sub get_class {
or die 'tc command failed: $!';
my ( $id, $name, $sent, $drop, $over, $root, $leaf, $parent );
+
while (<$tc>) {
chomp;
/^class/ && do {
@@ -188,7 +198,7 @@ sub get_class {
my ( undef, $rate, undef, undef, undef, $backlog ) = split;
$backlog =~ s/p$//;
$rate =~ s/bit$//;
-
+
# split $id of form 1:10 into parent, child id
my ($maj, $min) = ($id =~ m/([0-9a-f]+):([0-9a-f]+)/);
@@ -204,6 +214,7 @@ sub get_class {
} else {
push @args, shaper($name), $sent, $drop, $over, $rate, $backlog;
}
+
$classes{$id} = {
id => $id,
parent => $parent,
@@ -236,10 +247,12 @@ sub get_qdisc {
chomp;
/^qdisc/ && do {
# qdisc htb 1: root r2q 10 default 20 direct_packets...
- my $t;
+ my $t;
+
( undef, $name, $qid, $t ) = split;
$qid =~ s/:.*$//;
$qid = hex($qid);
+
$root = $qid if ( $t eq 'root' );
next;
};