From a8f977758637d1cf3f246e2bc330b0f6382e4d52 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 21 Sep 2023 16:34:11 +0300 Subject: [PATCH] net: lwm2m: Generate new tokens for LwM2M SEND blocks Previously each piece of LwM2M SEND was using token length of zero. I think this was unintentional. Signed-off-by: Seppo Takalo --- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 7aaa42c20ab736..678f358d1ee919 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -307,12 +307,13 @@ STATIC int build_msg_block_for_send(struct lwm2m_message *msg, uint16_t block_nu /* reuse message for next block. Copy token from the new query to allow * CoAP clients to use new token for every query of ongoing transaction */ - tkl = coap_header_get_token(msg->in.in_cpkt, token); lwm2m_reset_message(msg, false); if (msg->type == COAP_TYPE_ACK) { msg->mid = coap_header_get_id(msg->in.in_cpkt); + tkl = coap_header_get_token(msg->in.in_cpkt, token); } else { msg->mid = coap_next_id(); + tkl = LWM2M_MSG_TOKEN_GENERATE_NEW; } msg->token = token; msg->tkl = tkl;