From b80973d0e9f7aa266b079ebb04758c2c3dec4531 Mon Sep 17 00:00:00 2001 From: l0crian1 Date: Wed, 21 May 2025 11:47:34 -0400 Subject: T7415: Fix tcp flags matching Empty leaf nodes are cleaned, causing the tcp ack and syn flags to not match. These values are exempted from being cleaned. --- interface-definitions/include/qos/tcp-flags.xml.i | 32 +++++++++++------------ src/conf_mode/qos.py | 8 +++++- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/interface-definitions/include/qos/tcp-flags.xml.i b/interface-definitions/include/qos/tcp-flags.xml.i index b439e837a..81d70d1f3 100644 --- a/interface-definitions/include/qos/tcp-flags.xml.i +++ b/interface-definitions/include/qos/tcp-flags.xml.i @@ -1,21 +1,21 @@ - + TCP Flags matching - - ack syn - - - ack - Match TCP ACK - - - syn - Match TCP SYN - - - (ack|syn) - - + + + + Match TCP ACK + + + + + + Match TCP SYN + + + + + diff --git a/src/conf_mode/qos.py b/src/conf_mode/qos.py index 59e307a39..aed9407de 100755 --- a/src/conf_mode/qos.py +++ b/src/conf_mode/qos.py @@ -85,7 +85,13 @@ def _clean_conf_dict(conf): } """ if isinstance(conf, dict): - return {node: _clean_conf_dict(val) for node, val in conf.items() if val != {} and _clean_conf_dict(val) != {}} + preserve_empty_nodes = {'syn', 'ack'} + + return { + node: _clean_conf_dict(val) + for node, val in conf.items() + if (val != {} and _clean_conf_dict(val) != {}) or node in preserve_empty_nodes + } else: return conf -- cgit v1.2.3