Make sure that gnutls_priority_set_direct() is called after
gnutls_priority_set().
Output alert information if an alert occurred.
Handle valgrind slowing things down, causing packet retries.
All this is handled by libcoap with coap-client having the ability to define
an initial Hop Count value for testing. No other application support is
required.
Incoming requests are checked for the Hop Limit option - if found, the value
is decremented in the PDU before passing it up to the application. If it
decrements to 0, a 5.08 response is generated.
coap_add_option() checks if this is a Proxy option for a request. If so, and
Hop Limit option does not exist, then the Hop Limit option is inserted into
the PDU with the default value (16).
coap_send() checks if it is a 5.08 response and if so, prepends the diagnostic
data with the IP address of the transmitting interface. If the IP address
already exists, then the PDU is dropped as the return path for the 5.08 response
is looping. An alternative method for return path looping check is also
used by initially setting, then testing and then decrementing the Hop Limit
value as response packets pass back through the proxies. If a proxy does not
copy the Hop Limit options when returning the 5.08 response, then the IP address
duplication is used.
Makefile.am:
Hide the coap_insert_option(), coap_update_option and coap_pdu_check_resize()
function from applications.
README.md:
Add in RFC8768 is supported by libcoap.
examples/client.c:
Add in the -H hoplimit option.
include/coap2/pdu.h:
Add in the default Hop-Limit: option COAP_OPTION_HOP_LIMIT.
Re-organize the COAP_OPTION_ descriptions to include
the C, U, N, R, E, I and U flags.
Expose the internal coap_pdu_check_resize() function so src/net.c can use it.
Define the two new internal functions coap_insert_option() and
coap_update_option() and expose them so that the test suites can use them.
man/coap-client.txt.in:
Document the new -H hoplimit option.
man/coap.txt.in:
Include the new RFC8768.
man/coap_pdu_setup.txt.in:
Update documentation for the CoAP options.
src/coap_debug.c:
Add in support for printing out COAP_OPTION_HOP_LIMIT.
src/net.c:
Make sure that COAP_OPTION_HOP_LIMIT is not returned in an error response.
Decrement received Hop-limit in handle_request() and generate 5.08 response
if appropriate.
Update coap_send() to prepend IP in 5.08 response.
Support COAP_OPTION_HOP_LIMIT being used in the 5.08 response message.
src/pdu.c:
Report on CoAP options that are repeated, but not defined as repeatable.
Define new (5.08) Hop Limit Reached error response.
Add in new internal coap_insert_option() function. This now means that
callers of coap_add_option() no longer have to have the options in the
correct order.
Add in new internal coap_update_option() function that updates the value of
an option.
Make coap_pdu_check_resize() non-static.
tests/test_pdu.c:
Check that options are getting inserted in the correct order when using
coap_insert_option(), even though they are provided in a random order.
Test the coap_update_option() function.
Support observe for both GET and FETCH.
Correct coap-client programatic addition of observe establish option which
"happened" to work previously because COAP_OBSERVE_ESTABLISH was 0.
coap_add_token() can error for multiple reasons when building the response
PDU - but then the response PDU is not deleted on error if it exists.
The PDU is now deleted on coap_add_token() error.
libtool marks functions included in the Makefile.am CTAGS_IGNORE list as
nm type 't' in .so library files so that they are not globally visible.
This means that tests/testdriver is unable to access these functions.
However, when building .a files, these functions remain as nm type 'T', so
are globally available.
This change causes tests/testdriver to always be be built with the .a
library file.
configure.ac:
Always enable --enable-static if --enable-tests is set.
Include this --enable-static requirement in the help information.
tests.Makefile.am
Change the default library type to always be .a and re-order parameters.
Add in a new PKI_KEY type for PKCS11 URI to get the PKI information from a
smart card or HSM device.
Currently only OpenSSL and GnuTLS are supported.
Makefile.am:
Do not expose coap_dtls_shutdown() function.
examples/client.c:
examples/coap-server.c:
Add in support for using pkcs11: URIs for defining the Certificates and
Private Keys.
include/coap2/coap_dtls.h:
Add in COAP_PKI_KEY_PKCS11 Key type.
man/coap-client.txt.in:
man/coap-server.txt.in:
Update documentation for supporting PKCS11.
man/coap_encryption.txt.in:
Add in documentation for COAP_PKI_KEY_PKCS11.
Correct some typos.
HOWTO.dual.gnutls (new):
HOWTO.dual.openssl (new):
HOWTO.dual.softhsm2 (new):
HOWTO.pkcs11 (new):
HowTo information.
src/coap_gnutls.c:
src/coap_openssl.c:
Add in PKCS11 support.
src/coap_mbedtls.c:
PKCS11 not yet supported.
Add in no-op coap_dtls_shutdown() function.
src/coap_notls.c:
src/coap_tinydtls.c:
Add in no-op coap_dtls_shutdown() function.
src/net.c:
Invoke coap_dtls_shutdown() function in coap_cleanup().
NOTE: There are memory leaks after cleanly closing down. These are not within
libcoap as far as can be determined. These leaks are a work in progress.
If the initial coap_send() PDU initiates a TCP/TLS connection, the PDU is
delayed until the CSM packets are exchanged. If the initial PDU contains
a BLOCK1 or BLOCK2 option, the PDU gets dropped as Block-Wise-Transfer in the
CSM has not been seen yet. Seen if '-b X' option is used for coap-client.
The check is now only when the session has fully established and the
situation only logged and the PDU Not dropped.
These new functions for generating pseudo numbers replace the old
macro-based approach:
coap_prng() replaces prng() to generate new pseudo random numbers.
This function uses getrandom() if HAVE_GETRANDOM is defined at
build time.
coap_prng_init() replaces prng_init() to seed the pseudo random
number generator. The function does nothing if HAVE_GETRANDOM is
set at build time.
coap_set_prng() can be used to register a custom pseudo number
generation function replacing the default.
The storage for query was not released when coap_add_token() has
failed. As the query is used only if successful, the storage
allocation is moved downwards to improve handling of error cases.
This fixes CID 1483550.
If a resource is observed, handle_request() passes the ownership
of a Uri-Query to the observer structure for later retrieval. In
this case, the query is not free'd in handle_request. However, if
the observer data structure ("subscription") was not created due
to insufficient memory, the query string must not be deleted as
it is used for the resource handler callback later in
handle_request(). The solution here passes ownership to the
observer only if case coap_add_observer() is successful.
This fixes CID 1483551.
As the behavior for calling fopen() on a NULL pointer is undefined in
ISO C99, a check is added before passing the file name to fopen().
This fixes CID 1495723.
In coap_io_do_epoll(), read() is called after timeout to clear the
file descriptor associated with the firing timer. As this function is
only called for its side effect, the result is ignored. Coverity scan
reports this as check_return event. A cast to void has been added to
document that the result is ignored on purpose.
This fixes CID 1495728.
coap_session_release() decrements a reference counter and releases
session resources when zero is reached. In certain function call
chains this leads to false positives with Coverity code analysis.
This change adds specific primitives to avoid these false positives.
This behavior is controlled by pre-processor conditionals.
Fix possible null pointer dereference in coap_get_context_server_hint()
and coap_get_context_server_psk().
These issues have been detected by Coverity scan as CIDs 1495725 and
1495729.
src/net.c:
Add in a sanity check that the PDU length is not more that the negotiated
CSM size for incoming data.
Track CSM remote supports block transfer.
Do not allow Block options if CSM has not negotiated block transfer.
src/coap_session.c:
Include block-wise-transfer is supported in the CSM
include/coap2/coap_session.h:
Make MTU size bigger than 32 bits as CSM mtu size can be greater than 32 bits.
Track CSM remote supports block transfer.
include/coap2/pdu.h:
Make COAP_DEFAULT_MAX_PDU_RX_SIZE a unsigned long to be bigger than 32 bits.