As travis-ci gets not triggered anymore, continuous integration has
been changed in commit 57a5a7e0 to use GitHub Actions. This change
updates the build status badges to report the GitHub Actions result
for the branches master and develop.
CoAP response codes in examples represented by non-human-readable magic
numbers. It makes code harder to read, understand, and maintain.
Magic numbers there where replaced by human-readable enums.
Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
configure.ac:
Add in explicit library version checking as .pc file is not available.
m4/ac_check_cryptolibs.m4:
Add in AX_CHECK_MBEDTLS_VERSION for checking version compatibility.
configure.ac:
src/coap_mbedtls.c:
Correct brand name to Mbed TLS.
The use of the verify_peer_cert and require_peer_cert variables in the
coap_dtls_pki_t structure was giving inconsistent results across all the
TLS libraries. This primarily was down to the large numbers of options
available to control the TLS handshakes in OpenSSL compared to the limited
control available to mbedTLS port which followed later. require_peer_cert is
not easy to control in mbedTLS as it is an implicit configuration based on how
other, not always related, items were configured.
require_peer_cert was used by the server to control whether the client could
use anonymous certificates or not. This is now controlled by verify_peer_cert.
require_peer_cert variable has been replaced with check_common_ca, so that
the OpenSSL functionality can continue, but enable GnuTLS / mbedTLS to
produce the same results. This allows peers to mutually authenticate (because
the peer certs are signed by the same common CA) or not which was in effect
controlled by verify_peer_cert previously.
If check_common_ca is set, then allow_self_signed is ignored.
If is_rpk_not_cert is set, then all certificate validation is ignored.
In the examples, use of the -R option unsets check_common_ca, so disables
mutual authentication support by having a common CA. This was needed as
mbedTLS and GnuTLS only have a single trust store for CAs.
configure.ac:
Increase the number of mbed libraries to use when checking for mbedTLS.
examples/client.c:
examples/coap-rd.c:
examples/coap-server.c:
Add in -n (unset verify_peer_cert) option. In the case of coap-server and
coap-rd, make -n refer to verify_peer_cert.
Add in TLS library capabilites in usage().
Update usage() documentation as appropriate, with some changes to fit
everything into a 80 column output.
include/coap2/coap_dtls.h:
include/coap2/net.h:
Update with variable changes, and make the coap_dtls_pki_t parameter const for
the *_context_set_pki() functions.
man/coap-client.txt.in:
man/coap-rd.txt.in:
man/coap-server.txt.in:
Update documentation to reflect the examples option usage.
man/coap_context.txt.in:
man/coap_encryption.txt.in:
man/coap_session.txt.in:
Update with the new variable name and document as appropriate.
src/coap_gnutls.c
src/coap_mbedtls.c
src/coap_notls.c
src/coap_openssl.c
coap_tinydtls.c
Update to make variable usage consistent. Update logging from LOG_WARNING to
LOG_INFO where there is an override of a PKI check failure by one of the
coap_dtls_pki_t variables.
Timing window closed for TLS where the peer does not like a certificate, sends
fatal alert and closes connection. local then fails on writing the next
handshake - but now also reads in alert and reports on it.
src/coap_io.c:
Update logging from LOG_WARNING to LOG_INFO for EPIPE or ECONNRESET errors in
coap_socket_write().
src/net.c:
Handle the const coap_dtls_pki_t parameter in coap_context_set_pki() function.
coap_show_pdu() reports the Message ID (mid) as a hex value prefixes by i:.
Elsewhere it is reported as an integer or unsigned making those entries
difficult to match up with the reported PDU.
examples/coap-rd.c:
examples/etsi_iot_01.c:
src/async.c:
src/coap_session.c:
src/net.c:
Replace tid=%d, message %d and transaction %d with mid=0x%x for clarity.
On systems where read() is declared with the attribute
warn_unused_result, a cast to void is not sufficient to suppress the
resulting warning. This change therefore checks the result explicitly.
coap_opt_length() must be called next_option_safe() to avoid
out-of-bound reads for malformed options.
Thanks to Marten Geuking for providing a detailed bug report.
1. since coap_add_option_later() has been removed, so remove
coap_add_option_later in lib-coap-2.(map,sym) and pdu.h
2. [PRNG] need include coap_prng.c into visual studio project too, since new
functions for generating pseudo numbers replace the old macro-based
approach.
3. [PRNG] need define coap_prng() coap_prng_init() coap_set_prng() for
windows too since these function are exported in lib-coap-2.(map,sym)
Make documentation more consistent across doxygen output.
Add in caching module.
Add in encoding/decoding module.
Add in application i/o internal module.
Move deprecated items out of respective modules.
See https://sourceforge.net/p/libcoap/mailman/message/37039434/
Works for
Computer: Windows 10 64 bit & CYGWIN_NT-10.0 x86_64
Cygwin: 3.1.5-1
OpenSSL: 1.1.1g
gcc:9.3.0
and gcc-10.2.0 + openssl1.1.1f
configure.ac:
Support cygwin build environment. If so, set -D_CYGWIN_ENV in CFLAGS.
libtool: warning: undefined symbols not allowed in x86_64-pc-cygwin shared libraries; building static only
still to be fixed.
.gitignore:
Ignore *.exe filenames
src/coap_io.c:
define ipi_spec_dst as ipi_addr if _CYGWIN_ENV
examples/client.c:
examples/coap-rd.c:
examples/coap-server.c:
examples/etsi_iot_01.c
man/examples-code-check.c:
src/coap_io.c:
src/coap_tcp.c:
Fix compiler warnings.
sizeof(socklen_t) != sizeof(size_t) [-Wsign-compare]
isdigit() etc. complain about byte size array subscripts [-Wchar-subscripts]
snprintf size checks [-Wformat-truncation=]
Update
The technical lower bound of COAP_DEBUG_BUF_SIZE in the code is 5.
Sensible values should be significantly larger than 32 to ensure that
information can be displayed through this buffer.
There are 2 output buffers - outbuf[] and buf[]. buf[] is limited in size
but used for printing out the data portion of the PDU before getting included
in outbuf[].
Make the printing of the data portion of the PDU go straight into outbuf[] to
get around the buf[] limitation.
Now the maximium amount of the printing out of the PDU can be controlled by
CPPFLAGS="-DCOAP_DEBUG_BUF_SIZE=xxxx" as a parameter to ./configure, where
xxxx is the output buffer size (e.g. use 4096).
examples/client.c:
Add in -w option to add in a NL at end of receiving data - including after
re-assembling a BLOCK2 set of data.
man/coap-client.txt.in:
Document -w option.
Request raised by Issue #473.
Add code to better support the Proxy-Uri: and Proxy-Scheme: CoAP Options.
examples/client.c:
Make sure that the Proxy-Uri: option is added (if set) when clearing down an
observation (fixes#112).
Check that Proxy-Uri: option has a maximum data length of 1034 bytes.
Handle user defined Proxy-Scheme: option correctly.
Update -P option to include scheme to be used when connecting to the proxy.
examples/coap-server.c:
Add in hnd_proxy_uri() handler function. This has support for a direct or ongoing
proxy connection for the coap* protocols. The ongoing connection is set up as a
different CoAP session and is assocated with the incoming session for relaying
requests / responses.
Internal functions taken from client.c are used where appropriate.
Proxy support code has a SERVER_CAN_PROXY wrapper, so footprint can easily be
reduced if required.
New -P and -u options added to support ongoing connections.
include/coap2/net.h:
Add in tracking the proxy uri handler into coap_context_t.
include/coap2/resource.h:
Track whether a resource definition is for Proxy-Uri:/Proxy-Scheme:.
Define the coap_resource_proxy_uri_init() function for handling the Proxy-Uri:
option or Proxy-Scheme: option in an incoming request.
include/coap2/uri.h:
Add in COAP_URI_SCHEME_HTTP and COAP_URI_SCHEME_HTTPS as valid Proxy-Uri:
schemes.
Define the coap_split_proxy_uri() function (similar to coap_split_uri() but
supports the proxy extras. Both now use a common sub function internally.
libcoap-2.map:
libcoap-2.sym:
Expose the new coap_resource_proxy_uri_init() and coap_split_proxy_uri()
functions.
man/Makefile.am:
Handle coap_resource_get_userdata(3) now being over the 10 definition limit
in man/coap_resource.txt.in.
man/coap-client.txt.in:
Update documentation for the -P option.
man/coap-server.txt.in:
Document the new -P proxy option.
Document the new -u user option.
man/coap_resource.txt.in:
Include documentation for coap_resource_proxy_uri_init().
src/coap_debug.c:
Output the Proxy-Scheme: Option as text.
src/net.c:
Sanity check and handle COAP_OPTION_PROXY_URI and COAP_OPTION_PROXY_SCHEME
in handle_request().
src/resource.c:
Add in coap_resource_proxy_uri_init() function.
Handle the addition of a proxy uri handler in coap_add_resource().
src/uri.c:
Rename coap_split_uri() to coap_split_uri_sub() and add in extra proxy
handling support based on input parameters.
Create new coap_split_uri() and coap_split_proxy_uri() which call
coap_split_uri_sub() appropriately.
TODO:
Remove reference to Proxy support required
src/coap_gnutls.c:
Fix a double deallocate found during testing