Description
Hi,
In dhcpv4/nclient4/client.go:receiveLoop() there is a check that if a client MAC address is included in an incoming packet and if that client MAC address does not match the local bound interface then the packet is discarded. There is also an accompanying comment:
// This is a somewhat non-standard check, by the looks
// of RFC 2131. It should work as long as the DHCP
// server is spec-compliant for the HWAddr field.
if c.ifaceHWAddr != nil && !bytes.Equal(c.ifaceHWAddr, msg.ClientHWAddr) {
// Not for us.
continue
}
My question is this 'non-standard' check needed at all? In my own case I'm trying to use the package as a form of DHCP relay, where it issues DHCP messages on behalf of multiple 'virtual' clients, identified by the ClientHWAddr field which has a modifier applied to it, but at the network layer it uses the same physical MAC address. Ie the clientHWAddresses are many any varied and never matches the single c.ifaceHWAddr. The check above prohibits me using the package in this way. If I comment out the check all works, in the way I'm using it anyway.
In other more standard scenarios than mine, can we not rely on the NIC filtering incoming unwanted dest MAC addresses from reaching the DHCP client?
Thanks