summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2022-08-16 18:53:25 +0100
committerGitHub <noreply@github.com>2022-08-16 18:53:25 +0100
commite2b9a945939c4640d473eba4f1f40812acd52193 (patch)
tree9cbf1a6df84dc16669d327385c5f8ca53f271072
parentef2c41e084a3bb6dc57db4351a1a863de831181b (diff)
parent270ca440b30cc848f9b1c7247d0de7a38fe7f000 (diff)
downloadvyatta-cfg-qos-e2b9a945939c4640d473eba4f1f40812acd52193.tar.gz
vyatta-cfg-qos-e2b9a945939c4640d473eba4f1f40812acd52193.zip
Merge pull request #13 from dmbaturin/1.3.2-backports
Backport fixes for T4122 and T681 to equuleus for 1.3.2
-rw-r--r--lib/Vyatta/Qos/Util.pm52
-rw-r--r--templates-skeleton/interface-templates/redirect/node.def1
-rw-r--r--templates-skeleton/qos-match-templates/class/node.tag/match/node.tag/ip/dscp/node.def6
3 files changed, 41 insertions, 18 deletions
diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm
index af18dee..7a9e988 100644
--- a/lib/Vyatta/Qos/Util.pm
+++ b/lib/Vyatta/Qos/Util.pm
@@ -214,12 +214,43 @@ sub getProtocol {
return $proto;
}
-# Parse /etc/iproute/rt_dsfield
-# return a hex string "0x10" or undefined
+my %dsfields = (
+ "default" => 0x0,
+ "lowdelay" => 0x10,
+ "throughput" => 0x08,
+ "reliability" => 0x04,
+ "mincost" => 0x02,
+ "priority" => 0x20,
+ "immediate" => 0x40,
+ "flash" => 0x60,
+ "flash-override" => 0x80,
+ "critical" => 0x0A,
+ "internet" => 0xC0,
+ "network" => 0xE0,
+ "AF11" => 0x28,
+ "AF12" => 0x30,
+ "AF13" => 0x38,
+ "AF21" => 0x48,
+ "AF22" => 0x50,
+ "AF23" => 0x58,
+ "AF31" => 0x68,
+ "AF32" => 0x70,
+ "AF33" => 0x78,
+ "AF41" => 0x88,
+ "AF42" => 0x90,
+ "AF43" => 0x98,
+ "CS1" => 0x20,
+ "CS2" => 0x40,
+ "CS3" => 0x60,
+ "CS4" => 0x80,
+ "CS5" => 0xA0,
+ "CS6" => 0xC0,
+ "CS7" => 0xE0,
+ "EF" => 0xB8
+);
+
sub getDsfield {
my ($str) = @_;
- my $match = undef;
- my $dsFileName = '/etc/iproute2/rt_dsfield';
defined $str or return;
@@ -233,17 +264,8 @@ sub getDsfield {
return $str << 2;
}
- open my $ds, '<', $dsFileName || die "Can't open $dsFileName, $!\n";
- while (<$ds>) {
- next if /^#/;
- chomp;
- my ( $value, $name ) = split;
- if ( $str eq $name ) {
- $match = $value;
- last;
- }
- }
- close($ds) or die "read $dsFileName error\n";
+ # if it's a text description of the value, we need to look it up
+ my $match = $dsfields{$str};
( defined $match ) or die "\"$str\" unknown DSCP value\n";
return $match;
diff --git a/templates-skeleton/interface-templates/redirect/node.def b/templates-skeleton/interface-templates/redirect/node.def
index daff346..cf3a4c2 100644
--- a/templates-skeleton/interface-templates/redirect/node.def
+++ b/templates-skeleton/interface-templates/redirect/node.def
@@ -1,4 +1,5 @@
type: txt
+priority: 620
help: Incoming packet redirection destination
allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=input
diff --git a/templates-skeleton/qos-match-templates/class/node.tag/match/node.tag/ip/dscp/node.def b/templates-skeleton/qos-match-templates/class/node.tag/match/node.tag/ip/dscp/node.def
index 224b002..d7cd316 100644
--- a/templates-skeleton/qos-match-templates/class/node.tag/match/node.tag/ip/dscp/node.def
+++ b/templates-skeleton/qos-match-templates/class/node.tag/match/node.tag/ip/dscp/node.def
@@ -1,9 +1,9 @@
type: txt
help: Match on Differentiated Services Codepoint (DSCP)
syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --dscp $VAR(@)"
-allowed: awk '
- /^#/ { next }
- { printf "%s ", $2 }' </etc/iproute2/rt_dsfield
+allowed: echo "default reliability throughput lowdelay priority immediate flash flash-override critical internet network \
+ AF11 AF12 AF13 AF21 AF22 AF23 AF31 AF32 AF33 AF41 AF42 AF43 \
+ CS1 CS2 CS3 CS4 CS5 CS6 CS7 EF"
val_help: u32:0-63;Differentiated Services Codepoint (DSCP) value
val_help: default; match DSCP (000000)
val_help: reliability; match; DSCP (000001)