Commit Graph
2967 Commits
Author SHA1 Message Date
Jon Shallow 4803f161f0 zephyr: Examples support
New examples/zephyr directory that contains a sample coap-client.
Building the coap-client assumes that the zephyrproject has already been
installed and set up (default directory ~/zephyrproject).
2024-10-10 16:48:50 +01:00
Mario Kicherer 7b4a20f64e coap_join_mcast_group_intf: fix interface selection on windows 2024-10-10 16:48:15 +01:00
Jon Shallow 8e407cc514 documentation: Various doc tidyup
configure.ac: Tidy up coap_defines.h generation

doc/upgrade_4.3.4_4.3.5.txt: Document upgrade requirements

doc/Makefile.am: Include upgrade_4.3.4_4.3.5.txt

cmake_coap_defines.h.in: Add brief description
src/coap_sha1.c: Add in brief description

Note: With Ubuntu 24.04.01, when running a2x, spurious entries
 <unknown>:1: SyntaxWarning: invalid escape sequence '\S'
occur. Fixed by https://github.com/asciidoc-py/asciidoc-py/pull/267
2024-10-05 09:58:49 +01:00
Jon Shallow 3cba2974ee coap_tinydtls.c: Fix server only build for CID 2024-09-26 13:12:02 +01:00
Jon Shallow 79a6630478 blocks: Better reporting for large transfers
Update stateless token to track 20 bits - the largest no of blocks
as per RFC7959.

Make output of data detail configurable for coap_show_pdu().

Add in new function coap_enable_pdu_data_output() to do this.

Add -x option to coap-client and coap-server to enable this dropping
of data detail.
2024-09-26 10:50:31 +01:00
kkrentz ac83b32b33 Improve MTU handling
by:
- Correcting Contiki-NG's value of COAP_DEFAULT_MAX_PDU_RX_SIZE
- Denying to create PDUs longer than COAP_DEFAULT_MAX_PDU_RX_SIZE
- Using the MTU setter, thereby not overriding stack-specific limits
- Using existing constants for L4-specific header sizes
2024-09-17 13:28:44 +01:00
Jon Shallow e234acae9f CMakeLists.txt: Handle Proxy configurations and existing built coap.h 2024-09-11 08:42:59 +01:00
Jon Shallow da539d85ad doc: Update documentation for future reference 2024-09-10 16:43:19 +01:00
Jon Shallow 7cf7465b78 Release 4.3.5: Fix SO and ABI version for new release v4.3.5 2024-09-06 11:13:56 +01:00
Jon Shallow 0d240530b4 Release 4.3.5: Release 4.3.5 2024-09-06 09:47:22 +01:00
Jon Shallow 493b503bca Zephyr: Fix k_realloc build errors for zephyr < 3.7.0 2024-09-04 15:17:06 +01:00
Jon Shallow eaff6928d6 Coverity-Scan: Fix CID 1599559-1599562 2024-09-04 12:08:47 +01:00
@pawel.szwarnowski abd0a027db Use Zephyr heap for Zephyr targets 2024-08-28 15:18:53 +01:00
Mario Kicherer 1c97907f2f coap_net.h: add ifdef WITH_LWIP around lwip functions 2024-08-27 11:59:23 +01:00
Daniel Mangum a705e04ced man: fix typo in logging documentation
Fixes small typo in logging documentation.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2024-08-27 09:10:22 +01:00
Jon Shallow c2b34daa9b mcast_loop: Drop mcast packet that server sent on different socket
Server enabled for mcast receipt.  When the server is acting as a proxy
sends a mcast packet out over a slave client type socket, it receives
the mcast packet on the server socket (which could then be forward out
of the client socket....).

This change prevents the server socket from passing up the libcoap stack
a mcast packet that it knows the client socket is sending.
2024-08-23 10:51:20 +01:00
Jon Shallow e220c371be coap.h: Remove need for different coap.h files for different OS
./autogen.sh and ./configure no longer need to be run prior to running
make for Contiki, LwIP or RIOT from the appropriate examples sub-directory.

scripts/fix_version.sh now handles updating coap.h for the different
LIBCOAP_ and PACKAGE_ definitions.
2024-08-23 10:39:37 +01:00
Mario Kicherer 8899063a4a coap_ws: accept longer header lines and specific header sent by firefox browser 2024-08-23 10:39:17 +01:00
Jon Shallow 3d790a5964 reverse-proxy: Provide dedicated reverse-proxy handler setup function 2024-08-16 13:33:31 +01:00
Jon Shallow 626d4632d1 multicast: Document coap_mcast_set_hops() 2024-08-16 13:30:30 +01:00
Jon Shallow 79e6fcdb26 examples: Do CI pre-commit checks on man page examples 2024-08-16 13:16:11 +01:00
kkrentz 7dab8f6fb2 Contiki-NG: Fix coap_resolve_address_info 2024-08-12 17:03:40 +01:00
kkrentz 76502319fc coap_proxy.c: Fix error "'.*' expects argument of type 'int'" 2024-08-12 15:41:20 +01:00
Jon Shallow 540fede1b9 release 4.3.5rc3: Release candidate 3 for 4.3.5 v4.3.5-rc3 2024-08-07 14:14:07 +01:00
Jon Shallow 82b721d7d2 coap-server.c: Replace SERVER_CAN_PROXY with COAP_PROXY_SUPPORT
Make use of the new coap_defines.h file.
2024-08-07 13:59:10 +01:00
Jon Shallow 92198b00b3 Supported: Break out run-time checks and libcoap build #defines
Group together and document the run-time checks available for checking
the libcoap built-in functionality based on the ./cconfigure and / or
CMakeLists.txt options.

Create include/coap3/coap_defines.h file that contains a list of
COAP_ #defines created from the options defined when running ./configure
or cmake.

Add additional coap_*_is_supported() functions.
2024-08-07 10:23:19 +01:00
Jon Shallow 5f3d7eb244 reverse-proxy: Add in reverse proxy support to coap-server
Tidy up the general proxy logic by moving common functionality
into libcoap.

New functions coap_proxy_forward_request(), coap_proxy_forward_response()
and coap_proxy_is_supported() added.

New --enable-proxy-code support added to configure.

New ENABLE_PROXY_CODE support added to CMakeLists.txt.

Support for common shared connection to next hop.

Support for round-robin balancing across multiple next hops.
2024-08-07 09:33:46 +01:00
Jon Shallow af024f9138 Connection-ID: Only change source port when CID has been negotiated
Only support changing the client's source port if the DTLS library
has support / configured for CID.

Used when debugging server handling source address changes and CID
is in use.

Add in support for TinyDTLS (Client only) if TinyDTLS is patched
appropriately (not currently available on TinyDTLS main branch).

Add in new function coap_dtls_cid_is_supported().
2024-08-07 09:13:52 +01:00
Jon Shallow 83718a6d2f Cleanup building header files for different OS
'make distclean' removes header files built from the .in files, which
means that they are not available for different OS builds.

The same is true for CMakeLists.txt.

Remove the need for the .in files and update for libcoap revisions
by using a new script scripts/fix_version.sh created from
scripts/fix_version.sh.in.

CI has been updated to check revisions have been updated in the
appropriate places.

Do not remove libcoap-3.sym and libcoap-3.map when doing 'make distclean'
as they are git tracked files.
2024-08-06 16:56:19 +01:00
Jon Shallow 9656876b41 configure.ac: Not all pkg-config support PKG_CHECK_MODULES_STATIC
PKG_CHECK_MODULES_STATIC is only supported by pkg-config > 0.29

Use pkg-config --static instead.
2024-07-25 09:08:36 +01:00
Jon Shallow 4851806c09 scan-build: CI Fail if scan-build warnings 2024-07-22 11:37:42 +01:00
Jon Shallow 8b2fb390b8 Connection-ID: Support changing client IP addresses
Support of RFC9146. Currently only Mbed TLS supported.

New function coap_context_set_cid_tuple_change() for a client to
force periodic source port changes to test out CID.

Configurable support for the client to use Connection-ID
assuming underlying DTLS library is configured for or supports it.
2024-07-22 08:56:17 +01:00
Jon Shallow b75c784a20 Constrained Stack: No need for individual locks
If a proxy reads in a packet via coap_read_endpoint, which then
invokes an ongoing proxy TCP connection, while waiting for the CSM
response of the new session, coap_read_endpoint would get invoked
again if there is any data to read on any of the listening endpoints..

With a Constrained Stack, the read in data is protected by mutex
m_read_enpoint - which is still locked when trying to wait for the
CSM.

As the code is either single threaded, or protected by global_lock
if multi-threaded, there is no need to maintain mutexes such as
m_read_endpoint.  This PR removes these not needed mutexes.
2024-07-22 08:47:05 +01:00
Jon Shallow 48b56aa830 coap_prng: Provide global_lock protection 2024-07-19 10:28:05 +01:00
Jon Shallow bbefdfc501 src/coap_mbedtls.c: Support EC-JPAKE with Client Only builds
General tidy up of EC-JPAKE coding.
2024-07-19 10:11:14 +01:00
Jon Shallow bd32823746 client-coap.c: Fix client spin loop for NO_SYS == 0
Do not call coap_free_context() from within sigint handler.
Always call coap_io_process().
Use sys_arch_sem_wait() for timeouts while waiting for input.
2024-07-19 10:05:30 +01:00
Jon Shallow f4094636ab Locking: Remove locking initialization from coap_new_context() 2024-07-18 08:39:40 +01:00
Jon Shallow d87af11903 coap_openssl.c: Fix libcoap shutdown restart issues 2024-07-17 15:38:30 +01:00
Jon Shallow 62686555b2 Locking: Unlock global_lock after coap_free_context() call 2024-07-17 14:15:10 +01:00
Jon Shallow f9c7223ecd Locking: Use single global lock instead of context lock
When context is de-allocated, other threads can still access the
context lock held within context. Indicating being freed when
coap_free_context() was called worked in most cases, but not all.
2024-07-17 08:52:50 +01:00
Jon Shallow af7da4596a TLS: EC-JPAKE support (RFC8236)
Currently only supported by Mbed TLS if the optional
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED is defined for the Mbed TLS
library build.
2024-07-17 08:51:31 +01:00
Jon Shallow 7551d2e147 block handling: Update lg_crcv->last_used when sending Block1
This prevents premature de-allocation of the lg_crcv when large
files are getting uploaded.
2024-07-16 11:11:33 +01:00
Jon Shallow bfdbdc3e25 coap_block.c: Replace usage of p with lg_xmit, lg_srcv, lg_crcv
To help debug block issues by replacing the over use of p-> with
the appropriate lg_xmit->, lg_srcv-> an lg_crcv->. No other code
changes.
2024-07-12 15:28:13 +01:00
Jon Shallow d84d863904 LwIP: Update to STABLE 2.2.0 2024-07-12 15:25:46 +01:00
Mario Kicherer aac5de9e55 enable HAVE_STRUCT_CMSGHDR when building with mingw 2024-07-12 09:49:01 +01:00
Jon Shallow 53e9333947 Locking: Make sure all app callbacks are properly locked.
Recursive lock issues happen for some of the app callbacks that then call a
libcoap public API that tries to lock up the CoAP context.

All libcoap callbacks into app code should now be fixed.
2024-07-11 13:13:33 +01:00
Jon Shallow aa46177e8e Coverity: Fix CID 1382579, CID 1502425, CID 1594471 and CID 1594475 2024-07-11 13:03:32 +01:00
Jon Shallow 7d5e5f3b8c coap-mbedtls.c: Support 3.6.0 Mbed TLS
TLS1.3 is enabled by default in 3.6.0. This PR fixes the supported
encryption algorithms as well as handling a new session ticket
indication for coaps+tcp://.

However, if client certificates are not defined, then MbedTLS fails with
no certificate CA, even if the CA Cert is presented along with the Server
Cert during the processing of the server certificate and fails with
"SSL - No CA Chain is set, but required to operate"
when coaps+tcp:// is used.

Workaround (with examples/coap-client) is to set the -R options (when the
-c option is not set), or to programmatically call
coap_context_set_pki_root_cas();
2024-07-11 12:51:58 +01:00
Hugo Hakim Damer 2ae46c9da2 configure.ac: use MbedTLS pkg-config if available
Additionally, this change allows overriding the MbedTLS compiler and
linker flags (just like with the other DTLS libraries).
2024-07-10 17:46:17 +01:00
Mario Kicherer 72045d89bd coap-debug.c: remove quotation when printing Unix domain socket paths, see #1460 2024-07-10 17:45:51 +01:00