dhcpv6: potential bug fix for checking DHCPV6_OPT_STATUS
authorPaul Donald <[email protected]>
Tue, 4 Nov 2025 18:30:58 +0000 (19:30 +0100)
committerÁlvaro Fernández Rojas <[email protected]>
Wed, 5 Nov 2025 07:12:13 +0000 (08:12 +0100)
commita92f199d6b8d83e4779e884e49f9e516b3812669
tree3bc9082352356b53b065c21b876978cba4016e35
parente5cfea8f6ef83c0a5fce556c4adb018daa125246
dhcpv6: potential bug fix for checking DHCPV6_OPT_STATUS

follow-up to b65ff293a96924f9b19dff8855232bfb9054b976

The previous logic checked that the DHCPV6_OPT_STATUS was more than 2 bytes,
which meant that it would only be evaluated if the options *also* contained a
status message. We should handle this option being exactly 2 bytes, so that
DHCPV6_OPT_STATUS lacking a status message are correctly handled.

The relevant RFC section does not state that status message can be absent
https://www.rfc-editor.org/rfc/rfc8415#section-21.13
but the status message field is variable length and sets no mandates on its
size.

This ensures differing interpretations of this portion are handled adequately.
It's not uncommon that various options behave in this 'can be zero length' way,
so let's handle this option similarly.

Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/113
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/dhcpv6.c