From 8b7539f2bf06baf5b5e2d2c6dbda1f9de68cee12 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Thu, 27 Oct 2022 12:22:38 +0100 Subject: [PATCH] block.c: Make sure ETAG option gets properly added It is possible that there is, say, a Block2 option already in the PDU so need to make sure ETAG option is always added in. --- src/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/block.c b/src/block.c index 37756346..7571c218 100644 --- a/src/block.c +++ b/src/block.c @@ -289,7 +289,7 @@ coap_add_data_blocked_response(const coap_pdu_t *request, /* add etag for the resource */ memset(etag, 0, sizeof(etag)); coap_hash(data, length, etag); - coap_add_option_internal(response, COAP_OPTION_ETAG, sizeof(etag), etag); + coap_insert_option(response, COAP_OPTION_ETAG, sizeof(etag), etag); coap_insert_option(response, COAP_OPTION_CONTENT_FORMAT, coap_encode_var_safe(buf, sizeof(buf),