Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: lwm2m: Improve token handling #28299

Closed
rlubos opened this issue Sep 11, 2020 · 0 comments · Fixed by #29053
Closed

net: lwm2m: Improve token handling #28299

rlubos opened this issue Sep 11, 2020 · 0 comments · Fixed by #29053
Assignees
Labels
Enhancement Changes/Updates/Additions to existing features

Comments

@rlubos
Copy link
Contributor

rlubos commented Sep 11, 2020

Token management in LwM2M library should be improved, as currently, it has its limitations.

If token with 0 length is provided, it's implicitly assumed that it should be autogenerated. It won't work in case the LwM2M server sends a request w/o token. Plus the token generation doesn't seem right (token won't be included anyway as tokenlen is kept 0):

if (msg->tkl == 0U) {
	tokenlen = 0U;
	token = coap_next_token();
}
@rlubos rlubos added the Enhancement Changes/Updates/Additions to existing features label Sep 11, 2020
@rlubos rlubos self-assigned this Sep 11, 2020
rlubos added a commit to rlubos/zephyr that referenced this issue Oct 8, 2020
Improve token handling by removing special meaning of tokenlen == 0,
which allows to handle server requests w/o a token (so far such
requests would cause the lwm2m engine to autogenerate token in the
response).

In order to autogenerate token during message initialization, use
special symbol `LWM2M_MSG_TOKEN_GENERATE_NEW`. If no token is wished to
be used, simply set the tokenlen to 0.

Additionally, fix an issue with token autogeneration, where invalid
token len was used (0 instead of 8).

Fixes zephyrproject-rtos#28299

Signed-off-by: Robert Lubos <[email protected]>
jukkar pushed a commit that referenced this issue Oct 9, 2020
Improve token handling by removing special meaning of tokenlen == 0,
which allows to handle server requests w/o a token (so far such
requests would cause the lwm2m engine to autogenerate token in the
response).

In order to autogenerate token during message initialization, use
special symbol `LWM2M_MSG_TOKEN_GENERATE_NEW`. If no token is wished to
be used, simply set the tokenlen to 0.

Additionally, fix an issue with token autogeneration, where invalid
token len was used (0 instead of 8).

Fixes #28299

Signed-off-by: Robert Lubos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant