Valgrind reports Syscall param sendmsg(msg.msg_control) points to
uninitialised byte(s) due alignment padding in the CMSG macros
leaving uninitialized gaps in struct sent to the sendmsg system call.
This issue was reported including this patch on the libcoap-developers
mailing list [1].
[1] https://sourceforge.net/p/libcoap/mailman/message/36141279/
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
If a TCP connection connection fails, or a an ICMP Unreachable is received
for a UDP packet, then the file descriptor is not closed off. Eventually
all fails when no more file descriptors are allowed.
Update functions appropriately.
Move coap_new_client_session_pki() back into coap_session.h (its correct place)
Add in enum coap_asn1_privatekey_type_t
A simple structure for (D)TLS-specific unit tests has been added.
Currently, only general support and the version number as reported
by coap_get_tls_library_version() are checked.
As unit tests with IPv6 addresses keep failing on docker-based
travis CI, this changes reverts to IPv4 usage in following files:
test_wellknown.c
test_sendqueue.c
When determing whether to do a re-transmit timeout based on
coap_dtls_get_timeout, if s->tls is not set (unable to set up TLS session,
TLS error etc.), then coap_write() assert's when calling
coap_dtls_get_timeout(). This fix just sets the timeout to 0 if s->tls is not
set.
Update coap_context_set_psk() to return on failure. Add in call to
coap_dtls_context_set_psk() function
Add in new function coap_context_set_pki()
Update #includes for compilation
Update coap_new_client_session_psk() to clean up and return on error. Add in
call to coap_dtls_context_set_psk()
Add in new function coap_new_client_session_pki()
Additional check for a call of coap_new_client_session_*() in
coap_new_endpoint()
Remove PSK specifics from coap_dtls_new_context() and put into new
coap_dtls_context_set_psk().
Create a new coap_dtls_context_set_pki() for PKI.
Include checks that either of coap_dtls_context_set_psk() or
coap_dtls_context_set_pki() have been called before setting up a (D)TLS
session
Update #includes for compilation
If the application needs to see CoAP ping requests or CoAP TCP pong responses
then this update provides calling the configured handlers at the appropriate
points.
If the application needs to see CoAP ping requests or CoAP TCP pong responses
then there needs to be a handler that can be set up that is called
appropriately.
Add in coap_get_tls_library_version() for determining TLS build base + version
Do not allow a dynamic openssl library to be loaded and used at application
runtime that is less than OpenSSL version 1.1.0.
A new function coap_get_tls_library_version() that returns a pointer to a
coap_tls_version_t structure that contains both the TLS library type libcoap
was compiled against as well as the current TLS library version.
For a client, if a DTLS session is closed with ICMP unavailable packet, when
the TLS session is closed in the application with SSL_shutdown(), the OpenSSL
underlying library triggers a BIO_write() which calls coap_dgram_write() which
then 'assert's in coap_session_send().
(sock->flags == COAP_SOCKET_EMPTY && session->endpoint == NULL).
Fix is not to call coap_session_send() from coap_dgram_write() if socket is
closed and this is not an endpoint (not a server).
John Carter has provided this (slightly edited) patch to set len to 0
for PDUs that do not contain a payload. This makes this function more
robust for callers that do not care about the function result.
This change fixes issue 120 [1].
[1] https://github.com/obgm/libcoap/issues/120