dhcpcd icon indicating copy to clipboard operation
dhcpcd copied to clipboard

dhcp: get_option_uint32/16 only accept options with correct len

Open taoyl-g opened this issue 1 year ago • 1 comments

RFC8925 mentions "The client MUST ignore the IPv6-Only Preferred option if the length field value is not 4."

taoyl-g avatar Aug 28 '24 06:08 taoyl-g

I'm not modifying get_option_uint8 now as it's also used to read variant length options. Please suggest if you have other preferred way to fix this (such as adding another helper that does not verify the length)

taoyl-g avatar Aug 28 '24 06:08 taoyl-g

I'm not modifying get_option_uint8 now as it's also used to read variant length options. Please suggest if you have other preferred way to fix this (such as adding another helper that does not verify the length)

That would be the correct way I think. We have two calls that use the uint8 function just to check the existence of an option so we could have a new function that does just that.

rsmarples avatar Aug 30 '24 14:08 rsmarples

Enforcing len==1 in get_option_uint8 as well, and using get_option instead in the mentioned occurrences.

taoyl-g avatar Sep 04 '24 08:09 taoyl-g

Heh, I should look at the larger picture some more. Thanks for your work and replies.

rsmarples avatar Sep 05 '24 13:09 rsmarples