Kea 1.6.0 dropping packets with a null in hostname
Describe the bug With Kea 1.6.0, DHCP packets received with a null char in the hostname are being dropped. Some BMC devices send like that when their hostname is empty.
To Reproduce Steps to reproduce the behavior:
- Run Kea dhcpv4.
- A client sends a discover packet with a \0 (null) char in DHCP option 12.
- Kea drops the packet: "2019-09-09 12:01:58.353 DEBUG [kea-dhcp4.bad-packets/28891] DHCP4_PACKET_DROP_0001 failed to parse packet from 10.xxx.xxx.xxx to 10.xxx.xxx.xxx, received over interface lo, reason: failed to parse an option '12' holding string value' was empty or contained only NULLs"
Expected behavior The server should not drop the packet, it should clear the hostname as it did before 1.6.0.
Environment:
- Kea version: 1.6.0 (tarball)
- OS: CentOS 7.6.1810 x86_64
- Which features were compiled in (in particular which backends):
log4cplus 1.1.3
OpenSSL 1.0.2k-fips 26 Jan 2017
database:
Memfile backend 2.1
Additional information It seems this was introduced with git commit 8d1f1d7f. You can trigger the issue with this: https://gist.github.com/lero/bf7659214a6fc0c7bb238c935a17bd83. This is what you see in tcpdump:
DHCP-Message Option 53, length 1: Discover
Hostname Option 12, length 1: "^@"