KEA fails to start due to lease file corrupted by an invalid IPv4 address
name: Bug report
about: kea-dhcp4 -v 1.8.2
Describe the bug The KEA DHCP server that provides DHCP for our network couldn't be started (after being stopped) because the lease file was corrupted.
After some digging we found the issue: The lease file contained an invalid IPv4 address. The KEA DHCP service wouldn't start because of an error: Failed to convert string to address '10.20010.200.0.35': Invalid arg.
This IP address almost seems to have been written to the .csv possibly when another entry was being added due to the IPv4 format here as 10.200 are the first two octets in this IP range and duplicated in the invalid entry.
To Reproduce Steps to reproduce the behavior:
- Unsure how to add a client with an IPv4 that is invalid such as noted and have it saved into the KEA .csv entries. Possibly hand edit a .csv entry to mimic this invalid IPv4 address entry.
- stop the kea service
- start the kea service
- look at the logging. In this case /var/log/syslog:
May 03 15:09:22 dhcp1 kea-dhcp4[2998]: 2023-05-03 15:09:22.853 ERROR [kea-dhcp4.dhcpsrv/2998.140331595758656] DHCPSRV_MEMFILE_LEASE_LOAD_ROW_ERROR discarding row 10401053, error: Failed to convert string to address '10.20010.200.0.35': Invalid arg
- Check the status of kea-dhcp4-server.service such as:
systemctl status isc-kea-dhcp4-server
- Note that the kea-dhcp4-server.service failed to start
Expected behavior Invalid IPv4 address entries are logged as such but does not cause the kea-dhcp4-server.service to fail starting. Ignore the invalid entry and continue loading the kea-dhcp4-server.service.
Environment:
- Kea version: 1.82
- OS: Ubuntu 18.04.6 LTS
Additional Information Example invalid IP address:
10.20010.200.0.35