Skip to content

mbed-coap fixes #4455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/FEATURE_COMMON_PAL/mbed-coap/module.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mbed-coap",
"version": "4.0.3",
"version": "4.0.6",
"description": "COAP library",
"keywords": [
"coap",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct sn_coap_hdr_;
#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES 512 /**< Maximum allowed size of re-sending buffer */
#define SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT 40 /**< Maximum allowed re-sending timeout */

#define RESPONSE_RANDOM_FACTOR 1 /**< Resending random factor, value is specified in IETF CoAP specification */
#define RESPONSE_RANDOM_FACTOR 1.5 /**< Resending random factor, value is specified in IETF CoAP specification */

/* * For Message duplication detecting * */

Expand Down Expand Up @@ -113,9 +113,12 @@ struct sn_coap_hdr_;
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 0 /**< Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 */
#endif

#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
#endif

#ifndef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 10 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 60 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */
#endif

#ifdef YOTTA_CFG_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
Expand Down Expand Up @@ -156,16 +159,13 @@ typedef NS_LIST_HEAD(coap_send_msg_s, link) coap_send_msg_list_t;
/* Structure which is stored to Linked list for message duplication detection purposes */
typedef struct coap_duplication_info_ {
uint32_t timestamp; /* Tells when duplication information is stored to Linked list */

uint8_t addr_len;
uint8_t *addr_ptr;
uint16_t port;

uint16_t msg_id;

uint16_t packet_len;
uint8_t *packet_ptr;
struct coap_s *coap; /* CoAP library handle */

ns_list_link_t link;
sn_nsdl_addr_s *address;
void *param;
ns_list_link_t link;
} coap_duplication_info_s;

typedef NS_LIST_HEAD(coap_duplication_info_s, link) coap_duplication_info_list_t;
Expand Down
9 changes: 4 additions & 5 deletions features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,6 @@ static int8_t sn_coap_parser_options_parse(struct coap_s *handle, uint8_t **pack
/* Get option length WITHOUT extensions */
uint16_t option_len = (**packet_data_pptr & 0x0F);

/* Option number length 15 is reserved for the future use - ERROR */
if (option_len == 15) {
return -1;
}

/* Resolve option delta */
uint16_t option_number = (**packet_data_pptr >> COAP_OPTIONS_OPTION_NUMBER_SHIFT);

Expand Down Expand Up @@ -313,6 +308,10 @@ static int8_t sn_coap_parser_options_parse(struct coap_s *handle, uint8_t **pack
option_len += (*(*packet_data_pptr + 1) << 8) + 269;
(*packet_data_pptr) += 2;
}
/* Option number length 15 is reserved for the future use - ERROR */
else if (option_len == 15) {
return -1;
}

message_left = packet_len - (*packet_data_pptr - packet_data_start_ptr);

Expand Down
Loading