Add reference count checks for coap_pdu_t usage.
Make coap_delete_pdu thread safe.
Fix a proxy referencing stale data.
Corrrectly replace Proxy-Uri with appropriate Uri-* options when directly
forwarding a PDU to a specified server and COAP_PROXY_DIRECT_STRIP is set.
If an Observe is de-registered, but an unsolicited Observe response is received
before the de-register response is received, then the unsolicited response
failed to get decrypted.
When a FETCH request is OSCORE-protected the Content-Format option is
an inner (encrypted) option per RFC 8613 §4.1.3.1 and is legitimately
absent from the outer CoAP message. The existing RFC 8132 §2.3.1
check unconditionally rejects such requests with 4.15 (Unsupported
Content-Format) even when COAP_OSCORE_SUPPORT is disabled and the
application uses its own OSCORE stack.
Only enforce the Content-Format presence rule when no OSCORE option
is present in the outer request.
Fixes: https://github.com/obgm/libcoap/issues/1936
coap_new_cache_entry() does not correctly check for no PDU data when called
with COAP_CACHE_RECORD_PDU. No current libcoap code (examples and library)
call coap_new_cache_entry() with COAP_CACHE_RECORD_PDU set.
Internal function coap_pdu_resize() can be used to reduce a PDU size,
creating current options confusion. Fix is not to reduce PDU if new
size is smaller than the current used size. No current libcoap code calls
coap_pdu_resize() to reduce the size.
If there is an issue with the PDU options where the maximum used option
value is larger than the last defined option value, an assert() is triggered.
All of the coap_*_option() functions correctly manage pdu->max_opt, but
this issue could occur if coap_pdu_resize() was called to reduce the PDU size
below that of pdu->used_size.
If an app request call-back modifies any data associated with a resource,
then multiple threads can attempt to unsafely modify the data at the same time.
Lock the resource when calling the app request handler (as global_lock is
unlocked) to prevent concurrent changes to the resource information.
If the app request handler is definately known to not modify the resource
information, then COAP_RESOURCE_SAFE_REQUEST_HANDLER can be set in the flags
for coap_resource_init(). Usually if there is a PUT, POST, PATCH or IPATCH
handler it is unsafe to set this. Setting this will reduce lock contention.
Fixes future Node.js 20 deprecation for github workflows.
There are still some other actions that continue to use Node.js 20 which will
need to be updated when they have also been ugraded to stop CI Action run warnings.
This change adds in the compatibility with the mbedtls-4.0 release.
This release has deprecated the classic mbedtls crypto APIs in favour
of standardized PSA crypto APIs.
For more information please refer to:
https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.0.0
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.