Skip to content

Commit

Permalink
Merge pull request #4190 from HollyGurza/6795
Browse files Browse the repository at this point in the history
T6795: QoS: Fix duplicate entries in class match filters
  • Loading branch information
c-po authored Nov 15, 2024
2 parents 89a7e17 + 3fae9e8 commit 99f414c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions python/vyos/qos/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ def update(self, config, direction, priority=None):

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:
Expand Down Expand Up @@ -335,15 +337,16 @@ def update(self, config, direction, priority=None):
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'
Expand Down

0 comments on commit 99f414c

Please sign in to comment.