From 2f2bae3232862d07368e4508fa8f335f6f8819d4 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Wed, 13 May 2026 10:52:28 -0500 Subject: 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 --- python/vyos/kea.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python') 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']}) -- cgit v1.2.3