config-write causes syntax error with "retry-on-startup" database parameter
Problem: triggering a config-write
API call encloses the boolean value of "retry-on-startup"
within "
which is a syntax error. A subsequent restart of Kea fails. I only tested hosts-database and lease-database but it could also apply to configuration backend.
Tested: 2.6.1
- To reproduce,
start with a very simple configuration
{
"Dhcp4": {
"control-socket": {
"socket-name": "/tmp/kea4-ctrl-socket",
"socket-type": "unix"
},
"hooks-libraries": [
{
"library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_subnet_cmds.so"
}
],
"hosts-databases": [
{
"connect-timeout": 1,
"host": "127.0.0.1",
"max-reconnect-tries": 1800,
"name": "kea",
"on-fail": "stop-retry-exit",
"password": "kea",
"reconnect-wait-time": 1000,
"retry-on-startup": true,
"type": "postgresql",
"user": "kea"
}
],
"lease-database": {
"connect-timeout": 1,
"host": "127.0.0.1",
"max-reconnect-tries": 1800,
"name": "kea",
"on-fail": "stop-retry-exit",
"password": "kea",
"reconnect-wait-time": 1000,
"retry-on-startup": false,
"type": "postgresql",
"user": "kea"
},
}
}
- Run the server:
sudo /usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf
- Trigger a
config-write
with the API:sudo echo '{"command": "config-write"}' | sudo socat UNIX:/tmp/kea4-ctrl-socket -,ignoreeof| jq .
- Restart the server
ctrl+c
and
it fails to start
$ sudo /usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf
2024-09-13 18:14:46.627 INFO [kea-dhcp4.dhcp4/7970.140053932713024] DHCP4_STARTING Kea DHCPv4 server version 2.6.1 (stable) starting
2024-09-13 18:14:46.629 ERROR [kea-dhcp4.dhcp4/7970.140053932713024] DHCP4_CONFIG_LOAD_FAIL configuration error using file: /etc/kea/kea-dhcp4.conf, reason: /etc/kea/kea-dhcp4.conf:63.29-34: syntax error, unexpected constant string, expecting boolean
2024-09-13 18:14:46.629 ERROR [kea-dhcp4.dhcp4/7970.140053932713024] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/etc/kea/kea-dhcp4.conf': /etc/kea/kea-dhcp4.conf:63.29-34: syntax error, unexpected constant string, expecting boolean
- Check configuration file and find that the
"retry-on-startup": true,
and"retry-on-startup": false,
are now"retry-on-startup": "true",
and"retry-on-startup": "false",
respectively. - Remove the extra
"
surrounding the boolean values of"retry-on-startup"
throughout the configuration and it will again start.
Configuration file post config-write
: kea-dhcp4.conf