summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorl0crian1 <ryan.claridge13@gmail.com>2025-05-21 11:47:34 -0400
committerl0crian1 <ryan.claridge13@gmail.com>2025-05-21 11:47:34 -0400
commitb80973d0e9f7aa266b079ebb04758c2c3dec4531 (patch)
tree283bb1a5eda961a907325692755231b333e3c84c
parent0e58ab45a6e1db0495cf7c66e66b89220d0d6069 (diff)
downloadvyos-1x-b80973d0e9f7aa266b079ebb04758c2c3dec4531.tar.gz
vyos-1x-b80973d0e9f7aa266b079ebb04758c2c3dec4531.zip
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.
-rw-r--r--interface-definitions/include/qos/tcp-flags.xml.i32
-rwxr-xr-xsrc/conf_mode/qos.py8
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 @@
<!-- include start from qos/tcp-flags.xml.i -->
-<leafNode name="tcp">
+<node name="tcp">
<properties>
<help>TCP Flags matching</help>
- <completionHelp>
- <list>ack syn</list>
- </completionHelp>
- <valueHelp>
- <format>ack</format>
- <description>Match TCP ACK</description>
- </valueHelp>
- <valueHelp>
- <format>syn</format>
- <description>Match TCP SYN</description>
- </valueHelp>
- <constraint>
- <regex>(ack|syn)</regex>
- </constraint>
</properties>
-</leafNode>
+ <children>
+ <leafNode name="ack">
+ <properties>
+ <help>Match TCP ACK</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="syn">
+ <properties>
+ <help>Match TCP SYN</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+</node>
<!-- include end -->
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