Skip to content

Commit

Permalink
net: lwm2m: Generate new tokens for LwM2M SEND blocks
Browse files Browse the repository at this point in the history
Previously each piece of LwM2M SEND was
using token length of zero. I think this was unintentional.

Signed-off-by: Seppo Takalo <[email protected]>
  • Loading branch information
SeppoTakalo authored and carlescufi committed Sep 27, 2023
1 parent 1606d35 commit a8f9777
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion subsys/net/lib/lwm2m/lwm2m_message_handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a8f9777

Please sign in to comment.