summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-14 11:02:35 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-14 11:02:35 -0800
commit79452d12e993754f853b21ec94d4752437de6c3c (patch)
treeedca8f7833853932daa45e7bddf2c5bfe12c2718
parent1ec568314f1c91e55702db314d8b2c518d234ce0 (diff)
downloadvyatta-op-qos-79452d12e993754f853b21ec94d4752437de6c3c.tar.gz
vyatta-op-qos-79452d12e993754f853b21ec94d4752437de6c3c.zip
Fix sorting of class id
Bug 5138 Hex class numbers not translated correctly.
-rwxr-xr-xscripts/vyatta-show-queueing.pl14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/vyatta-show-queueing.pl b/scripts/vyatta-show-queueing.pl
index 5dfca4b..47b6b74 100755
--- a/scripts/vyatta-show-queueing.pl
+++ b/scripts/vyatta-show-queueing.pl
@@ -117,11 +117,14 @@ sub show_brief {
}
}
+# Sort by class id which is a string of form major:minor
+# NB: numbers are hex
sub byclassid {
my ($a1, $a2) = ($a =~ m/([0-9a-f]+):([0-9a-f]+)/);
my ($b1, $b2) = ($b =~ m/([0-9a-f]+):([0-9a-f]+)/);
- return $a2 <=> $b2 if ($a1 == $b1);
- return $a1 <=> $b1;
+
+ return hex($a2) <=> hex($b2) if ($a1 == $b1);
+ return hex($a1) <=> hex($b1);
}
sub class2tree {
@@ -186,8 +189,13 @@ sub get_class {
$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]+)/);
- next if ($maj != $rootq);
+
+ # TODO handle nested classes??
+ next if (hex($maj) != $rootq);
+
+ # record info for display
my @args = ( hex($min) );
if ($leaf) {
my $qdisc_info = $qdisc->{$leaf};