dhcpv6: refactor u8 and u16 to u32 to avoid boolean coercion
ubus coerces u8 to boolean, and one workaround suitable is to amend u8
values (despite them being and containing only a u8 int) to u32 values. ubus
coerces u8 to booleans due to historical reasons. Any calls to e.g.
ubus call odhcp6c.eth1 get_state
(and subsequently downstream dependencies which use this invocation)
return booleans(!) where there shall be a number.
Amended calls to blobmsg_add_u8 into blobmsg_add_u32 to resolve this.
Amended calls to blobmsg_add_u16 into blobmsg_add_u32 also.
Apparently u8 and u16 get padded to u32 anyway.
See @nbd168 https://github.com/openwrt/libubox/pull/25#issuecomment-
3512957433
"
I'd prefer to just deprecate treating u8 as integer and deprecate using u16 in
blobmsg entirely. That way we can avoid a lot of compatibility mess and JSON
conversion issues. Due to padding, u8, u16 and u32 attributes have the same
effective size anyway, so there isn't really a good reason to use them for
integer values.
"
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/117
Signed-off-by: Álvaro Fernández Rojas <[email protected]>