From: Philippe Coval Date: Fri, 10 Mar 2017 15:14:16 +0000 (+0100) Subject: connectivity: Fix discovery+blockwise regression X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=140ed7a8076919160f98633573bd78aec2a11ed6;p=contrib%2Fiotivity.git connectivity: Fix discovery+blockwise regression A regression has been reported on discovery when large payloads are used. After investigation in blockwise feature, it appeared that regression occurred with this change: https://gerrit.iotivity.org/gerrit/#/c/17419/ Author assumed that payload should fit into CoAP PDU (1400c), which is against the blockwise feature's design. Adjusting those tests, seems to fix the problem. Bug: https://jira.iotivity.org/browse/IOT-1902 Change-Id: I0aa6d97de0987d13c54b426b537b5d83235517b7 Thanks-to: Pawel Winogrodzki Signed-off-by: Philippe Coval Reviewed-on: https://gerrit.iotivity.org/gerrit/17827 Tested-by: jenkins-iotivity Reviewed-by: Pawel Winogrodzki Reviewed-by: Dan Mihai --- diff --git a/resource/csdk/connectivity/src/cablockwisetransfer.c b/resource/csdk/connectivity/src/cablockwisetransfer.c index ba565df..c35f011 100644 --- a/resource/csdk/connectivity/src/cablockwisetransfer.c +++ b/resource/csdk/connectivity/src/cablockwisetransfer.c @@ -1406,8 +1406,7 @@ CAResult_t CAAddBlockOption(coap_pdu_t **pdu, const CAInfo_t *info, VERIFY_NON_NULL(options, TAG, "options"); VERIFY_TRUE(((*pdu)->transport_hdr->udp.token_length <= UINT8_MAX), TAG, "pdu->transport_hdr->udp.token_length"); - VERIFY_TRUE((info->payloadSize <= COAP_MAX_PDU_SIZE), TAG, - "info->payloadSize"); + VERIFY_TRUE((info->payloadSize <= UINT_MAX), TAG, "info->payloadSize"); CAResult_t res = CA_STATUS_OK; unsigned int dataLength = 0; @@ -1526,7 +1525,7 @@ CAResult_t CAAddBlockOption2(coap_pdu_t **pdu, const CAInfo_t *info, size_t data VERIFY_NON_NULL(info, TAG, "info"); VERIFY_NON_NULL(blockID, TAG, "blockID"); VERIFY_NON_NULL(options, TAG, "options"); - VERIFY_TRUE((dataLength <= COAP_MAX_PDU_SIZE), TAG, "dataLength"); + VERIFY_TRUE((dataLength <= UINT_MAX), TAG, "dataLength"); // get set block data from CABlock list-set. coap_block_t *block1 = CAGetBlockOption(blockID, COAP_OPTION_BLOCK1); @@ -1633,7 +1632,7 @@ CAResult_t CAAddBlockOption1(coap_pdu_t **pdu, const CAInfo_t *info, size_t data VERIFY_NON_NULL(info, TAG, "info"); VERIFY_NON_NULL(blockID, TAG, "blockID"); VERIFY_NON_NULL(options, TAG, "options"); - VERIFY_TRUE((dataLength <= COAP_MAX_PDU_SIZE), TAG, "dataLength"); + VERIFY_TRUE((dataLength <= UINT_MAX), TAG, "dataLength"); // get set block data from CABlock list-set. coap_block_t *block1 = CAGetBlockOption(blockID, COAP_OPTION_BLOCK1); diff --git a/resource/csdk/connectivity/src/caprotocolmessage.c b/resource/csdk/connectivity/src/caprotocolmessage.c index 5060163..cdadc6f 100644 --- a/resource/csdk/connectivity/src/caprotocolmessage.c +++ b/resource/csdk/connectivity/src/caprotocolmessage.c @@ -259,7 +259,7 @@ coap_pdu_t *CAGeneratePDUImpl(code_t code, const CAInfo_t *info, VERIFY_NON_NULL_RET(info, TAG, "info", NULL); VERIFY_NON_NULL_RET(endpoint, TAG, "endpoint", NULL); VERIFY_NON_NULL_RET(transport, TAG, "transport", NULL); - VERIFY_TRUE_RET((info->payloadSize <= COAP_MAX_PDU_SIZE), TAG, + VERIFY_TRUE_RET((info->payloadSize <= UINT_MAX), TAG, "info->payloadSize", NULL); size_t length = COAP_MAX_PDU_SIZE;