Skip to content

Commit 7ae00ee

Browse files
author
Antti Yli-Tokola
committed
Update mbed-coap to version 4.6.2
Do not clear block2 in subsequent block request. When sending a request with block2 option, eg. indicating need for response to be blockwised, copy the block2 option from the sent_blockwise list item so that the block2 option will be added to all requests. This fixes an issue where previously the block2 was only sent for the first blockwise request and not for the subsequent ones, including the last request. This made the response not follow the request block2 option.
1 parent f78f560 commit 7ae00ee

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

features/frameworks/mbed-coap/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Change Log
22

3+
## [v4.6.2](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.6.2)
4+
5+
Do not clear block2 in subsequent block request.
6+
7+
When sending a request with block2 option, eg. indicating need
8+
for response to be blockwised, copy the block2 option from the
9+
sent_blockwise list item so that the block2 option will be added
10+
to all requests. This fixes an issue where previously the block2
11+
was only sent for the first blockwise request and not for the
12+
subsequent ones, including the last request. This made the response
13+
not follow the request block2 option.
14+
15+
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.6.1...v4.6.2)
16+
317
## [v4.6.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.6.1)
418
**Closed issues:**
519
- IOTCLT-2900 - Blockwise handling leaking memory in some error cases

features/frameworks/mbed-coap/module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mbed-coap",
3-
"version": "4.6.1",
3+
"version": "4.6.2",
44
"description": "COAP library",
55
"keywords": [
66
"coap",

features/frameworks/mbed-coap/source/sn_coap_protocol.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,8 @@ static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn
17961796

17971797
if (src_coap_blockwise_ack_msg_ptr->options_list_ptr) {
17981798
src_coap_blockwise_ack_msg_ptr->options_list_ptr->block1 = COAP_OPTION_BLOCK_NONE;
1799-
src_coap_blockwise_ack_msg_ptr->options_list_ptr->block2 = COAP_OPTION_BLOCK_NONE;
1799+
// Do not clear block2 as it might have been set in the original request to request
1800+
// specific size blocks
18001801
} else {
18011802
if (!sn_coap_parser_alloc_options(handle, src_coap_blockwise_ack_msg_ptr)) {
18021803
tr_error("sn_coap_handle_blockwise_message - (send block1) failed to allocate ack message!");
@@ -1823,6 +1824,7 @@ static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn
18231824
src_coap_blockwise_ack_msg_ptr->payload_len = block_size;
18241825
src_coap_blockwise_ack_msg_ptr->payload_ptr = src_coap_blockwise_ack_msg_ptr->payload_ptr + (block_size * block_number);
18251826
}
1827+
18261828
/* Build and send block message */
18271829
dst_packed_data_needed_mem = sn_coap_builder_calc_needed_packet_data_size_2(src_coap_blockwise_ack_msg_ptr, handle->sn_coap_block_data_size);
18281830

@@ -2245,7 +2247,8 @@ static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn
22452247

22462248
if (src_coap_blockwise_ack_msg_ptr->options_list_ptr) {
22472249
src_coap_blockwise_ack_msg_ptr->options_list_ptr->block1 = COAP_OPTION_BLOCK_NONE;
2248-
src_coap_blockwise_ack_msg_ptr->options_list_ptr->block2 = COAP_OPTION_BLOCK_NONE;
2250+
// Do not clear block2 as it might have been set in the original request to request
2251+
// specific size blocks
22492252
} else {
22502253
if (sn_coap_parser_alloc_options(handle, src_coap_blockwise_ack_msg_ptr) == NULL) {
22512254
tr_error("sn_coap_handle_blockwise_message - (recv block2) failed to allocate options!");

0 commit comments

Comments
 (0)