summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-11-15 20:17:29 +0100
committerGitHub <noreply@github.com>2024-11-15 20:17:29 +0100
commit99f414cc69730cb5a33c6d1891e6f7e5e4f3dd16 (patch)
tree71d2a461d4cbed1145b49cd5a786075ac1d1086f
parent89a7e176c1d30a6862976d8b72dc4e7bc0ad5c85 (diff)
parent3fae9e812c21508e12e88b69697cbeb73c19720e (diff)
downloadvyos-1x-99f414cc69730cb5a33c6d1891e6f7e5e4f3dd16.tar.gz
vyos-1x-99f414cc69730cb5a33c6d1891e6f7e5e4f3dd16.zip
Merge pull request #4190 from HollyGurza/6795
T6795: QoS: Fix duplicate entries in class match filters
-rw-r--r--python/vyos/qos/base.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/python/vyos/qos/base.py b/python/vyos/qos/base.py
index 98e486e42..322cdca44 100644
--- a/python/vyos/qos/base.py
+++ b/python/vyos/qos/base.py
@@ -248,6 +248,8 @@ class QoSBase:
if 'match' in cls_config:
has_filter = False
+ has_action_policy = any(tmp in ['exceed', 'bandwidth', 'burst'] for tmp in cls_config)
+ max_index = len(cls_config['match'])
for index, (match, match_config) in enumerate(cls_config['match'].items(), start=1):
filter_cmd = filter_cmd_base
if not has_filter:
@@ -335,15 +337,16 @@ class QoSBase:
elif af == 'ipv6':
filter_cmd += f' match u8 {mask} {mask} at 53'
- cls = int(cls)
- filter_cmd += f' flowid {self._parent:x}:{cls:x}'
- self._cmd(filter_cmd)
+ if index != max_index or not has_action_policy:
+ # avoid duplicate last match rule
+ cls = int(cls)
+ filter_cmd += f' flowid {self._parent:x}:{cls:x}'
+ self._cmd(filter_cmd)
vlan_expression = "match.*.vif"
match_vlan = jmespath.search(vlan_expression, cls_config)
- if any(tmp in ['exceed', 'bandwidth', 'burst'] for tmp in cls_config) \
- and has_filter:
+ if has_action_policy and has_filter:
# For "vif" "basic match" is used instead of "action police" T5961
if not match_vlan:
filter_cmd += f' action police'