Commit Graph
2987 Commits
Author SHA1 Message Date
Jon Shallow d9a600edb9 Bug fix update to 4.3.5a 2025-11-25 16:12:20 +00:00
Jon Shallow 079fbbcaba coap_io.c: Cleanup MinGW builds
Move the MinGW #if tests to after where mswsock.h is included.

Tidy up documentation.

Tested against MSYS2 UCRT64, CLANG64, MINGW32 and MINGW64 on Windows 11.
Fixed a couple of minor build issues found.
2025-11-25 16:12:20 +00:00
Jon Shallow f3133e87f6 coap_io.c: Support MinGW build with _WIN32_WINNT == 0x0a00 2025-11-25 16:12:20 +00:00
Jon Shallow b2e10d1d1b MinGW: Fix latest MinGW support build 2025-11-25 16:12:20 +00:00
Jon Shallow 923a1a8f93 coap_uri.c: Fix sending Uri-Host option
Ipv6 Hosts with %interface suffix were incorrectly getting sent
with a Uri-Host option which included the &interface as well.
2025-11-25 10:29:50 +00:00
Jon Shallow 285eb02671 coap-rd.c: Sanity check POST query lengths 2025-11-25 10:29:50 +00:00
Patryk Jarosz 9d9b941c40 fixed memory leak coap_send 2025-11-25 10:29:36 +00:00
Jon Shallow bdbcf29bd1 coap_session.c: Fix GCC array bounds warning for memcpy
Note assert() added from #1209 has now been removed as not needed by #1628,
and if NDEBUG is defined then the assert() would have been a noop anyway.
2025-11-25 09:59:39 +00:00
Jon Shallow 054a55cbd6 coap_openssl.c: Check return values in case internal OpenSSL issue
And other other OpenSSL updates.
2025-09-27 15:24:42 +01:00
Jon Shallow 5fdd219118 testdriver: Suppress log Warning when error detecting 2025-09-20 14:04:03 +01:00
Jon Shallow 88f8c2e01f CI: Fix CI windows-2025 ms-build image build 2025-09-20 14:04:03 +01:00
Jon Shallow d2d9bd2b6d coap_uri.c: Fix parsing Unix Domains 2025-09-20 14:04:03 +01:00
Jon Shallow cc9aba6e01 coap_address.c: Validate length of provided host name
Host names larger than 255 bytes will cause an internal buffer overflow.

Hostnames provided to coap_resolve_address_info() now have their length validated.

Discovered by SecMate (https://secmate.dev).

Sanity check host lengths when parsing a CoAP URI when using the coap_split_uri()
function.
2025-09-16 11:41:41 +01:00
Jon Shallow af54b3d826 coap_session.c Fix CID update check 2025-09-16 11:41:41 +01:00
Jon Shallow 84d2b94421 CMakeLists.txt: Remove need for deprecated CMP0115 2025-09-16 11:41:41 +01:00
Jon Shallow d56fb48bff OSCORE: Fix OSCORE configuration file parsing issue
With a large boolean parameter value, (longer than "false"), memory
would be read past the "true" or "false" string boundaries in the ".rodata"
section when doing a memcmp(), potetially causing the application to crash
when calling coap_new_oscore_conf() with a specially crafted configuration
file.

It also can provide a mechanism to determine the byte values following the
"true" or "false" string boundaries which could lead to accessing sensitive
information. The standard libcoap library does not have defined keys or
certificates. This can only be done by a specially crafted local application.

Discovered by SecMate (https://secmate.dev).

Now fixed.
2025-09-16 11:41:41 +01:00
Jon Shallow 216802874b coap_block.c: Stop premature deletion of lg_srcv 2025-09-16 11:41:41 +01:00
Jon Shallow 959a0ba746 coap_mbedtls.c: Fix SNI hostname definition if not provided
MbedTLS based PKI clients may report

SSL - Attempt to verify a certificate without an expected hostname.
This is usually insecure.  In TLS clients, when a client authenticates a
server through its certificate, the client normally checks three things: ....

The application provided client_sni may have been removed as per
https://datatracker.ietf.org/doc/html/rfc6066#section-3

   Literal IPv4 and IPv6 addresses are not permitted in "HostName".

and so MbedTLS is now explicitly told that therw is no hostname.
2025-09-16 11:41:41 +01:00
Jon Shallow 33ad2707ab coap_session_mfree: Check for lg_crcv all cleared out if failure
Call to coap_cancel_observe_lkd() may cause session->lg_crcv to be cleared
out if transmission failure.
2025-09-16 11:41:41 +01:00
Jon Shallow bcf7d62342 RIOT: Fix building RIOT with RIOT's utlist.h change 2025-09-16 11:41:41 +01:00
Jon Shallow e2c57e1857 RIOT: Move examples to new directory structures 2025-09-16 11:41:41 +01:00
Jon Shallow 528402312e RIOT: Fix examples client issue
Bring the code up to the latest libcoap spec.
2025-09-16 11:41:41 +01:00
Jon Shallow f7cae1614a client code: Make sure static variables are re-initialized if needed
For embedded applications that can call the 'main()' function multiple
times, they  need to have any statically (globally) defined variables
reset to their default values.
2025-09-16 11:41:41 +01:00
Jon Shallow 993c12ac92 Copyright: Update to 2025 where appropriate 2025-09-16 11:41:41 +01:00
Jon Shallow b1ae24d4ce CIFuzz: Make sure libcoap is running when calling coap_delete_pdu() 2025-09-16 11:41:41 +01:00
Jon Shallow eb119c6ddb coap_block.c: Handle missing Size1 option when using Block1 2025-09-16 11:41:41 +01:00
Jon Shallow ba42209ed3 coap_digest_free: Handle NULL pointer 2025-09-15 17:21:10 +01:00
Jon Shallow ba90416186 coap_net.c: Fix TCP boundary read condition
Increment session->partial_read correctly.
2025-09-15 17:20:42 +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