wakaama icon indicating copy to clipboard operation
wakaama copied to clipboard

LwM2M Client Name limit in a custom LwM2M server

Open dovydas-girdvainis opened this issue 6 years ago • 2 comments

Description

When compiling our custom LwM2M server based on **wakaama/core/liblwm2m.h" with -O2 optimization level, LwM2M Client Names are limited to 11 characters, compiling the same code without any optimizations avoids this problem. This was tested with wakaama lwm2mclient example.

Possible solution

Adding volatile keyword to size_t option_len in wakaama/core/er-coap-13/er-coap-13.c:257 fixes the problem.

-- coap_add_multi_option(multi_option_t **dst, uint8_t *option, size_t option_len, uint8_t is_static)
++ coap_add_multi_option(multi_option_t **dst, uint8_t *option, volatile size_t option_len, uint8_t is_static)

I am using 9865bd30910a7d3d4c1a3dbd1546e7ab3886f152 commit of wakaama with a few changes (I know it is very old), but as far as I see neither the changes nor the outdated commit should cause this behaviour. I haven't checked if other functions need the keyword volatile. Could anyone else try to replicate this problem?

dovydas-girdvainis avatar Jan 23 '19 18:01 dovydas-girdvainis

@sbertin-telular, what do you think about this ?

sbernard31 avatar Nov 03 '20 17:11 sbernard31

I can confirm that the problem exists, but I have not identified the cause.

sbertin-telular avatar Nov 04 '20 19:11 sbertin-telular