zorun / kea-hook-runscript

This a hook for the Kea DHCP server that allows to run an external script at various points in the processing of DHCP requests and responses.
Mozilla Public License 2.0
54 stars 23 forks source link

Fix dhcp4 mac address retrieve method #17

Closed schenot closed 4 years ago

schenot commented 4 years ago

The getMAC method of pkt4 seems to retrieve the mac of the packet sender which is not the client MAC if a dhcp-relay is used.

The getHWAddr seems to be the method used in the KEA server (it's used in src/bin/dhcp4/dhcp4_srv.cc of the KEA 1.6.1 sources) and return the expected MAC address.

I test this patch with KEA 1.6.1 sources and hook release v1.3.1, it work as expected. Without this path the MAC address in KEA_QUERY4_HWADDR is the MAC address of my default gateway, because the packet is forwarded from a dhcp-relay.

zorun commented 4 years ago

Hmm, strange, I would have said it works the other way around:

But since I haven't actually tested it with a relay and you have, I'm going to trust you and merge this!

zorun commented 4 years ago

Merged and released as 1.3.2, thanks!