From 332f0178e7fa330b5f6a9f7a40066075e3835320 Mon Sep 17 00:00:00 2001
From: Viacheslav Hletenko <v.gletenko@vyos.io>
Date: Sun, 2 Jul 2023 15:24:51 +0000
Subject: T5048: QoS index priority should be used only for shaper

QoS index priority should be used only for qostype 'shaper'
otherwise we set priority 2 times, that is incorrect.

OSError: [Errno 255] failed to run command:
tc filter add dev eth2 parent 1: prio 5 protocol all prio 1 u32 match ip src 10.1.1.0/24 flowid 1:1e
exit code: 255

Fix it
---
 python/vyos/qos/base.py          | 3 ++-
 python/vyos/qos/trafficshaper.py | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/python/vyos/qos/base.py b/python/vyos/qos/base.py
index b992fe904..afeaaee0b 100644
--- a/python/vyos/qos/base.py
+++ b/python/vyos/qos/base.py
@@ -217,7 +217,8 @@ class QoSBase:
                 if 'match' in cls_config:
                     for index, (match, match_config) in enumerate(cls_config['match'].items(), start=1):
                         filter_cmd = filter_cmd_base
-                        filter_cmd += f' prio {index}'
+                        if self.qostype == 'shaper':
+                            filter_cmd += f' prio {index}'
                         if 'mark' in match_config:
                             mark = match_config['mark']
                             filter_cmd += f' handle {mark} fw'
diff --git a/python/vyos/qos/trafficshaper.py b/python/vyos/qos/trafficshaper.py
index 573283833..c63c7cf39 100644
--- a/python/vyos/qos/trafficshaper.py
+++ b/python/vyos/qos/trafficshaper.py
@@ -22,6 +22,7 @@ MINQUANTUM = 1000
 
 class TrafficShaper(QoSBase):
     _parent = 1
+    qostype = 'shaper'
 
     # https://man7.org/linux/man-pages/man8/tc-htb.8.html
     def update(self, config, direction):
-- 
cgit v1.2.3