summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-03 11:47:03 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-03 11:47:03 -0800
commite1af7e6ee561a59df282d15424b3f0d1f844f931 (patch)
treed78b7da2627660bccf7e8da48345e2152be34873
parenta39ee11767413589386ac0c3c8c5d442aa8cf487 (diff)
downloadvyatta-cfg-qos-e1af7e6ee561a59df282d15424b3f0d1f844f931.tar.gz
vyatta-cfg-qos-e1af7e6ee561a59df282d15424b3f0d1f844f931.zip
DSCP values should be scaled
For compatiablity use DSCP values in the 0..63 range and scale in the script, rather than uses raw header values. This makes configuration more familar to IOS users.
-rw-r--r--scripts/VyattaQosUtil.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/VyattaQosUtil.pm b/scripts/VyattaQosUtil.pm
index 3ae6916..9782961 100644
--- a/scripts/VyattaQosUtil.pm
+++ b/scripts/VyattaQosUtil.pm
@@ -111,11 +111,13 @@ sub getDsfield {
defined $str or return;
+ # match number (or hex)
if ($str =~ /^([0-9]+)|(0x[0-9a-fA-F]+)$/) {
- if ($str < 0 || $str > 255) {
- die "$str is not a valid dsfield value\n";
+ if ($str < 0 || $str > 63) {
+ die "$str is not a valid dscp value\n";
}
- return $str;
+ # convert DSCP value to header value used by iproute
+ return $str << 2;
}
open my $ds, '<', $dsFileName || die "Can't open $dsFileName, $!\n";