summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorIndrajit Raychaudhuri <irc@indrajit.com>2026-05-13 10:52:28 -0500
committerGitHub <noreply@github.com>2026-05-13 18:52:28 +0300
commit2f2bae3232862d07368e4508fa8f335f6f8819d4 (patch)
treee84417332d4c5f4edcb98939e72a3d29cc456f0e /python
parent69b6be91d0eacfd23feb13f96325923f6e26ed25 (diff)
downloadvyos-1x-2f2bae3232862d07368e4508fa8f335f6f8819d4.tar.gz
vyos-1x-2f2bae3232862d07368e4508fa8f335f6f8819d4.zip
dhcp: T8848: Fix timezone pcode data (#5189)
According to Kea documentation: When a data field is a string and that string contains the comma (`,`; U+002C) character, the comma must be escaped with two backslashes (`\\,`; U+005C) because both the routine splitting of CSV data into fields and JSON use the same escape character. A single escape (`\,`) would make the JSON invalid. Accordingly, the pcode generated for time-zone should have the `,` double escaped. For example, `"GMT0BST,M3.5.0/1,M10.5.0"` should be rendered as `"GMT0BST\\,M3.5.0/1\\,M10.5.0"`. See: https://kea.readthedocs.io/en/stable/arm/dhcp4-srv.html#standard-dhcpv4-options
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 5fe070c54..74ffa3fb1 100644
--- a/python/vyos/kea.py
+++ b/python/vyos/kea.py
@@ -144,7 +144,7 @@ def kea_parse_options(config):
if 'time_zone' in config:
with open('/usr/share/zoneinfo/' + config['time_zone'], 'rb') as f:
- tz_string = f.read().split(b'\n')[-2].decode('utf-8')
+ tz_string = f.read().split(b'\n')[-2].decode('utf-8').replace(',', '\\,')
options.append({'name': 'pcode', 'data': tz_string})
options.append({'name': 'tcode', 'data': config['time_zone']})