Set broadcast mac in dhcpv4 reply packets when dst. ip is broadcast
When a DHCPv4 client sends messages with the broadcast flag enabled, kea-dhcp4 server correctly responds with a packets destined to the broadcast IP (255.255.255.255), however, the dst. mac address is still set as a client's unicast address. According to rfc2131 (section 4.1), broadcast mac should be used instead:
A server or relay agent sending or relaying a DHCP message directly to a DHCP client (i.e., not to a relay agent specified in the 'giaddr' field) SHOULD examine the BROADCAST bit in the 'flags' field. If this bit is set to 1, the DHCP message SHOULD be sent as an IP broadcast using an IP broadcast address (preferably 0xffffffff) as the IP destination address and the link-layer broadcast address as the link-layer destination address. If the BROADCAST bit is cleared to 0, the message SHOULD be sent as an IP unicast to the IP address specified in the 'yiaddr' field and the link-layer address specified in the 'chaddr' field. If unicasting is not possible, the message MAY be sent as an IP broadcast using an IP broadcast address (preferably 0xffffffff) as the IP destination address and the link- layer broadcast address as the link-layer destination address.
Environment:
- Kea version: 2.1.0
- OS: Ubuntu