From e1af7e6ee561a59df282d15424b3f0d1f844f931 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 3 Mar 2008 11:47:03 -0800 Subject: 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. --- scripts/VyattaQosUtil.pm | 8 +++++--- 1 file 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"; -- cgit v1.2.3