Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6795: QoS: Fix duplicate entries in class match filters #4190

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading