From 24ae8f2ee8a50a9bd6b99e5ea4c69910583247c4 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Tue, 1 Sep 2026 17:55:36 +0100 Subject: [PATCH] Block: Make sure SizeX option is added for small sizes with blocks --- src/coap_block.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/coap_block.c b/src/coap_block.c index 7e598e90..d0a6d19c 100644 --- a/src/coap_block.c +++ b/src/coap_block.c @@ -1295,6 +1295,19 @@ coap_add_data_large_internal(coap_session_t *session, option, coap_encode_var_safe(buf, sizeof(buf), (0 << 4) | (0 << 3) | blk_size), buf); + if (COAP_PDU_IS_REQUEST(pdu)) { + coap_update_option(pdu, + COAP_OPTION_SIZE1, + coap_encode_var_safe(buf, sizeof(buf), + (unsigned int)length), + buf); + } else { + coap_update_option(pdu, + COAP_OPTION_SIZE2, + coap_encode_var_safe(buf, sizeof(buf), + (unsigned int)length), + buf); + } } add_data: if (get_func) {