Closed candlerb closed 3 months ago
(This example uses option code 108, from RFC8925, which is not provided as a predefined OptionCode)
It is in here: https://github.com/insomniacslk/dhcp/blob/master/dhcpv4/types.go#L242
I got it added in #524 :-)
But I think the point about detecting GenericOptionCodes still stands.
I think this is because you are comparing optionCode
against GenericOptionCode
, different types.
https://github.com/insomniacslk/dhcp/blob/master/dhcpv4/dhcpv4.go#L486
Certainly it may be a question of expectations and/or documentation. However, I note that:
IsOptionRequested
takes an OptionCode
as its argument, not an optionCode
OptionCode
is an interfaceOptionCode
interface is implemented by both optionCode and GenericOptionCodeTherefore, it was my expectation that this function would work for any argument implementing the OptionCode interface (and AFAIK there's no other way to generate a custom optionCode
value, since it's a private type).
What if the comparison were changed to o.Code() == requested.Code()
?
I was expecting that if I added a GenericOptionCode to a Parameter Request List, then IsOptionRequested() would be able to detect it - but it does not.
Here is a failing test case:
(This example uses option code 108, from RFC8925, which is not provided as a predefined OptionCode)