Skip to content

Commit 7edaf6d

Browse files
Antti Yli-Tokola0xc0170
authored andcommitted
Update mbed-coap to version 5.1.4
Add also 4.13 (Request Entity Too Large) responses to duplicate info list. Add client library configurations for DEFAULT_RESPONSE_TIMEOUT and SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED. Increased the default timeouts of DEFAULT_RESPONSE_TIMEOUT and SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED to 300 seconds. These two are critical parameters for low-bandwidth high-latency networks. The defaults should be more geared towards such networks that are likely to have issues with transmissions. The increased defaults can increase the runtime HEAP usage when there is a lot of duplicates or retransmissions.
1 parent 61c5c74 commit 7edaf6d

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

features/frameworks/mbed-coap/CHANGELOG.md

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

3+
## [v5.1.4](https://github.com/ARMmbed/mbed-coap/releases/tag/v5.1.4)
4+
5+
- Add also 4.13 (Request Entity Too Large) responses to duplicate info list.
6+
- Add client library configurations for `DEFAULT_RESPONSE_TIMEOUT` and `SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED`.
7+
- Increased the default timeouts of `DEFAULT_RESPONSE_TIMEOUT` and `SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED` to 300 seconds.
8+
* These two are critical parameters for low-bandwidth high-latency networks. The defaults should be more geared towards such networks that are likely to have issues with transmissions.
9+
* The increased defaults can increase the runtime HEAP usage when there is a lot of duplicates or retransmissions.
10+
311
## [v5.1.3](https://github.com/ARMmbed/mbed-coap/releases/tag/v5.1.3)
412

513
- Fix potential integer overflow when calculating CoAP data packet size: IOTCLT-3748 CVE-2019-17211 - mbed-coap integer overflow

features/frameworks/mbed-coap/mbed-coap/sn_config.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016 ARM Limited. All rights reserved.
2+
* Copyright (c) 2020 ARM Limited. All rights reserved.
33
* SPDX-License-Identifier: Apache-2.0
44
* Licensed under the Apache License, Version 2.0 (the License); you may
55
* not use this file except in compliance with the License.
@@ -98,6 +98,11 @@
9898
* \brief Sets the CoAP re-send interval in seconds.
9999
* By default is 10 seconds.
100100
*/
101+
102+
#ifdef MBED_CONF_MBED_CLIENT_DEFAULT_RESPONSE_TIMEOUT
103+
#define DEFAULT_RESPONSE_TIMEOUT MBED_CONF_MBED_CLIENT_DEFAULT_RESPONSE_TIMEOUT
104+
#endif
105+
101106
#ifndef DEFAULT_RESPONSE_TIMEOUT
102107
#define DEFAULT_RESPONSE_TIMEOUT 10 /**< Default re-sending timeout as seconds */
103108
#endif
@@ -219,8 +224,12 @@
219224
* \brief Maximum time in seconds howe long message is kept for duplicate detection.
220225
* By default 60 seconds.
221226
*/
227+
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
228+
#define SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
229+
#endif
230+
222231
#ifndef SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
223-
#define SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED 60 /** RESPONSE_TIMEOUT * RESPONSE_RANDOM_FACTOR * (2 ^ MAX_RETRANSMIT - 1) + the expected maximum round trip time **/
232+
#define SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED 300 /** RESPONSE_TIMEOUT * RESPONSE_RANDOM_FACTOR * (2 ^ MAX_RETRANSMIT - 1) + the expected maximum round trip time **/
224233
#endif
225234

226235
/**
@@ -234,7 +243,7 @@
234243
#endif
235244

236245
#ifndef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
237-
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 60 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */
246+
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 300 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */
238247
#endif
239248

240249
/**

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,14 @@ sn_coap_hdr_s *sn_coap_protocol_parse(struct coap_s *handle, sn_nsdl_addr_s *src
759759
goto cleanup;
760760
}
761761

762+
#if SN_COAP_DUPLICATION_MAX_MSGS_COUNT
763+
// copy data buffer to duplicate list for resending purposes
764+
if (!sn_coap_protocol_update_duplicate_package_data(handle, src_addr_ptr, resp, packet_data_size, packet_data_ptr)) {
765+
tr_error("sn_coap_protocol_parse - failed to update duplicate info!");
766+
goto cleanup;
767+
}
768+
#endif
769+
762770
sn_coap_parser_release_allocated_coap_msg_mem(handle, resp);
763771

764772
handle->sn_coap_tx_callback(packet_data_ptr, packet_data_size, src_addr_ptr, param);

0 commit comments

Comments
 (0)