summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRuben Herold <ruben@puettmann.net>2026-09-04 11:03:16 +0200
committerViacheslav Hletenko <seversss265@gmail.com>2026-10-15 16:05:57 +0300
commitda0bea0d10020bfd76d2f763965947db905cab9b (patch)
tree70c669984bda7f78054abd6833475991623077ee /python
parent579fc38cea44993318a429e195ba74b1081fbcc1 (diff)
downloadvyos-1x-da0bea0d10020bfd76d2f763965947db905cab9b.tar.gz
vyos-1x-da0bea0d10020bfd76d2f763965947db905cab9b.zip
dhcp-server: T9267: drop standalone substring "length" option
The byte length compared by a hostname/vendor-class-id "substring" match is always derived from "value" for a meaningful equality test: a shorter length never matches (comparing fewer option bytes against the full value literal), and a longer one is silently clamped by Kea to the available bytes, turning what looks like a prefix match into an exact match of the whole remainder. There is no legitimate use for setting it independently of "value", so drop the leaf rather than add another verify() constraint around it. Reported by alexk37 in review of PR #5436.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/kea.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/vyos/kea.py b/python/vyos/kea.py
index b782111c9..71ec82045 100644
--- a/python/vyos/kea.py
+++ b/python/vyos/kea.py
@@ -749,7 +749,7 @@ def _build_option_match_condition(option_number, match_config):
# length is expressed in bytes; a hex literal is '0x' + 2 hex digits per
# byte, rounded up since Kea itself pads an odd number of hex digits
# with a leading zero
- length = substring_config.get('length') or str((len(value_hex) - 1) // 2)
+ length = str((len(value_hex) - 1) // 2)
return f'substring({kea_path}.hex, {offset}, {length}) == {value_hex}'
return _build_hex_condition(kea_path, match_config['value'])