keactrl reload can load invalid configs
Currently (versions 2.2.0 and 2.3.3) a host reservation like this:
"reservations": [
{
"hw-address": "00:0c:01:02:03:04"
}
]
are considered invalid configs. If you attempt to load such a config with kea-dhcp4, you will get an error similar to:
ERROR [kea-dhcp4.dhcp4/3236.281473173614608] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file 'kea-dhcp4.conf': specified reservation for DUID: hwtype=1 00:0c:01:02:03:04 must include at least one resource, i.e. hostname, IPv4 address, IPv6 address/prefix, options (kea-dhcp4.conf:19:26)
However, if the server is already running with a reservation like:
"reservations": [
{
"hw-address": "00:0c:01:02:03:04",
"hostname": "somehost"
}
]
and then you change to the previous configuration without the hostname and issue keactrl reload
you will get errors similar to:
ERROR [kea-dhcp4.dhcp4/3274.281473783189520] DHCP4_PARSER_FAIL failed to create or run parser for configuration element shared-networks: specified reservation for DUID: hwtype=1 00:0c:01:02:03:04 must include at least one resource, i.e. hostname, IPv4 address, IPv6 address/prefix, options (kea-dhcp4.conf:19:26)
FATAL [kea-dhcp4.dhcp4/3274.281473783189520] DHCP4_CONFIG_UNRECOVERABLE_ERROR DHCPv4 server new configuration failed with an error which cannot be recovered
ERROR [kea-dhcp4.dhcp4/3274.281473783189520] DHCP4_CONFIG_LOAD_FAIL configuration error using file: kea-dhcp4.conf, reason: specified reservation for DUID: hwtype=1 00:0c:01:02:03:04 must include at least one resource, i.e. hostname, IPv4 address, IPv6 address/prefix, options (kea-dhcp4.conf:19:26)
FATAL [kea-dhcp4.dhcp4/3274.281473783189520] DHCP4_DYNAMIC_RECONFIGURATION_FAIL dynamic server reconfiguration failed with file: kea-dhcp4.conf
but the server will continue to run. It will no longer serve any clients or (it seems) process any packets as no further logs are generated.
I would have expected that the server would have not loaded the config file that is currently considered bad as it does if you simply have a syntax error like some random 'xxx' somewhere in the file. In such situations, it continues with the old file.
This was tested on 2.2.0 and 2.3.3 in Linux (Debian 11 x86_64).