[odhcpd] Is “dhcpv6_for_each_option()” correctly implemented?
Kevin Vigouroux
ke.vigouroux at laposte.net
Wed Apr 2 07:37:36 PDT 2025
Hi!
It seems to me that this macro isn’t correct.
Why aren't the “otype”, “olen” and “odata” fields initialized at loop entry?
This macro is defined in the file dhcpv6.h provided by odhcpd.
#+BEGIN_SRC C
#define dhcpv6_for_each_option(start, end, otype, olen, odata)\
for (uint8_t *_o = (uint8_t*)(start); _o + 4 <= (end) &&\
((otype) = _o[0] << 8 | _o[1]) && ((odata) = (void*)&_o[4]) &&\
((olen) = _o[2] << 8 | _o[3]) + (odata) <= (end); \
_o += 4 + (_o[2] << 8 | _o[3]))
#+END_SRC
--
Best regards,
Kevin Vigouroux
More information about the openwrt-devel
mailing list