Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing check that c.ifaceHWAddr == msg.ClientHWAddr #430

Open
vulcanfan opened this issue Jun 3, 2021 · 2 comments
Open

Existing check that c.ifaceHWAddr == msg.ClientHWAddr #430

vulcanfan opened this issue Jun 3, 2021 · 2 comments

Comments

@vulcanfan
Copy link

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

@pmazzini
Copy link
Collaborator

pmazzini commented Jun 7, 2021

I'm trying to use the package as a form of DHCP relay

This is a client after all and not a relay. I think it may be fair to make it configurable and have an option to disable it if you know what you are doing (relay).

can we not rely on the NIC filtering incoming unwanted dest MAC addresses from reaching the DHCP client?

This is filtering at the DHCP packet content level and not MAC layer.

@vulcanfan
Copy link
Author

Hi,

That would be great if it was made an option as you suggest. Defaulting to keeping the existing check of course.

Would be much appreciated if that could be done in due course?

Many thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants