Commit Graph
2954 Commits
Author SHA1 Message Date
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
kkrentz a1a16f3f5a Contiki-NG: Fix compilation error "unknown type name 'u_char'" 2024-07-04 10:59:01 +01:00
Jon Shallow cab876aa5d Zephyr: Support Mbed TLS 3.6.0 2024-07-02 21:29:40 +01:00
Jon Shallow f16e019e9d Zephyr: Support later Mbed TLS versions 2024-07-01 19:32:55 +01:00
Jon Shallow e5b7b98681 RIOT: Fix file name typo 2024-07-01 19:31:26 +01:00
Jon Shallow 15576ed6c3 RIOT: Pick up any uncommited changes when doing a local RIOT build 2024-06-29 08:16:03 +01:00
Jon Shallow 8157d0452f coap-client.c: Add in correct Uri-Host / Uri-Port for proxy 2024-06-29 08:11:09 +01:00
Jon Shallow 319ffb02c1 coap_net.c: Stop unnecessary coap_lg_crcv_t generation 2024-06-28 10:02:24 +01:00
Jon Shallow 3c720f232f release 4.3.5rc2: Release candidate 2 for 4.3.5 v4.3.5-rc2 2024-06-25 09:31:27 +01:00
Jon Shallow eff1f38f9f path_query parsing: Remove need to define scratch buffer
Create new options coap_uri_into_optlist(), coap_path_into_optlist() and
coap_query_into_optlist() to be used instead of coap_uri_into_options(),
coap_split_path() and coap_split_query() functions so the requirement
for a scratch buffer is not needed.

Getting the minimum size for a scratch buffer is not straight forward and
potential for unexpected boundary condition errors to occurif too small.

Correct parsing and stripping out of "%2E%2E" ("..") and "%2E" (".")
path segments.  ".." now removes the previous segment (if it exists).

Update documentation and unit testcases.

Update examples to use new options.
2024-06-25 08:23:33 +01:00
Jon Shallow 63c5077cf0 coap_cleanup: Support multiple usage 2024-06-21 16:08:41 +01:00
Jon Shallow b1d305c842 dtls_writes: Handle write errors 2024-06-21 15:29:06 +01:00
Jon Shallow 5fbbd27765 coap_resource.c: Remove debug test statement. 2024-06-17 09:53:15 +01:00
Jon Shallow 0fbe59fc55 block: Handle separate responses that then are followed with Block2
Set up lg_crcv if separate ACK response received for a coap_send() CON
request to be able to handle Block2 responses.

Handle Block1 request getting back a Block2 request that has an initial
separate response once the Block1 has completed by adjusting the stateless
token counter.

Separate response is typical for proxy support (OSCORE previously handled)..
2024-06-14 11:43:18 +01:00