This script is called from the package's top directory to adjust
all places where the current API version is hard-coded. The
current version is detected from the LIBCOAP_API_VERSION in
configure.ac. The target version is LIBCOAP_API_VERSION + 1 if no
parameter is provided on the command line. Otherwise, the given
value is used as target version.
Note that calling this script also results in 'git mv' operations.
git commit must be called manually after running this script.
Add in some new .in files, but still keep original files in distribution
files.
Essentially, use coap@LIBCOAP_API_VERSION@ (or equivalent) instead of
coap2. so resultant files have the correct value.
coap_config.h.lwip.in: (new)
coap_config.h.riot.in: (new)
include/coap2/coap.h.windows.in: (new)
As per https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html, many of the
coap2/ prefixes are not required for #include, so these have been removed.
Make sure that the test suite accesses the latest source version of
coap@LIBCOAP_API_VERSION@/coap.h by creating a tests/test_common.h.in that
makes the correct tests/test_common.h which is included in all of the test
suite files.
An empty response ACK is ignored if there was a request on the Send-Q.
However if there was a subsequent duplicate ACK this would then fall through
to the general handling logic in coap_dispatch(), and would trigger the ping
handler (if set) and send a RST (if not mcast) which is not correct.
Correct a change added in by #554 so that all empty response ACKs are ignored.
include/coap2/net.h:
src/net.c:
Update code using #587 as a base to fix potential issues.
Fixes CID 1502429
CMakeLists.txt:
cmake_coap_config.h.in:
Test for <net/if.h>
examples/coap-rd.c:
examples/coap-server.c:
man/coap-rd.txt.in:
man/coap-server.txt.in:
Add in -G option to support specifying interface to use for multicasting.
Otherwise, the interface allocated by the O/S is used depending on the
address (if any) bound to.
man/Makefile.am:
man/coap_context.txt.in:
Document the coap_join_mcast_group_intf() function.
src/coap_debug.c:
Make sure that coap_print_addr() returns a NULL terminated buffer.
This change renames `coap_join_mcast_group` to `coap_join_mcast_group_intf`
and adds an extra `const char *ifname` parameter to specify the interface
name.
A `coap_join_mcast_group` macro is defined to maintain backwards API
compatibility.
`coap_is_mcast` has been modified to recognize IPv6-mapped IPv4 multicast
addresses. Without this `coap_network_send` treats these addresses as
unicast which makes `semdmsg` fail with EINVAL.
Examples have been updated to use the new call.
Fixes
CID 1502435:
CID 1502432:
CID 1502423:
False Positives
CID 1502434: Cant see why code is not reached
CID 1502433: Could make blk_size uint8_t:3 I guess.
CID 1502430: Dont know why it is complaining
CID 1502427:
CID 1502426: Code looks fine to me - context->session could be set.
CID 1502424:
Fixed by other PRs
CID 1502422: #610
CID 1502431: #610
CID 1502428: #610
CID 1502429: #587 with my additional fixes
The first block response is unicast, and the client requests the further blocks
using unicast. https://tools.ietf.org/html/rfc7959#section-2.8
However, the hash for the server lookup of incoming data is based on
coap_addr_tuple_t which includes the local address - which changes between
receipt of mcast and unicast requests. This causes 2 sessions to be set up,
and the subsequent request/responses are treated as individual block random
access causing mismatch of information by the client.
Fix is to hash only on the remote address (IP + port) and local port for
servers.
src/coap_tinydtls.c:
Replace UNUSED with COAP_UNUSED that got missed from a merge.
man/examples-code-check.c:
src/pdu.c:
tests/oss-fuzz/pdu_parse_target.c:
Fix trailing white space.
win32/libcoap.vcxproj:
win32/testdriver/testdriver.vcxproj:
Correct include/coap2 paths.
If the response code was set after calling coap_add_data_large_response(),
the continuing blocks were sent with code 0.00.
Now check following call to response handler that the correct code is held
within the lg_xmit information.
CoAP transaction id was formerly defined as a hash of the remote address and
message id of the CoAP PDU. It now only refers to, and is used as, the
message id.
Replace occurences of 'transaction id' with 'message id' to reflect naming in
RFC7252.
Correct the definition of coap_tid_t to what it actually represents.
Replace occurrences of coap_tid_t with coap_mid_t.
Replace uses of tid with mid
Remove unused function coap_find_transaction().
Remove the UNUSED and UNUSED_PARAM definitions and use a single definition
of COAP_UNUSED as defined in libcoap.h
Replace all UNUSED / UNUSED_PARAM usages with COAP_UNUSED.
Correctly track the tokens so that the token that application sees in the
response is the same token as used in the initial request.
Update coap-server so that response data can be sent back to echo the data
that was in the request.
Fixes
CID 1502431
CID 1502428
CID 1502422
Change some of the types of variables, and cast change sizes where known to
be safe.
There still are some C4116 warning and a couple of C4090 warning which are OK,
so disabled by a #pragma.
.github/workflows/main.yml:
Build all the cmake TLS variants.
CMakeLists.txt:
Add in missing file.
examples/tiny.c:
include/coap2/encode.h:
Move COAP_PSEUDOFP_ENCODE_8_4 functions from encode.h to tiny.c.
Fix COAP_PSEUDOFP_ENCODE_8_4_DOWN 'ls' ordering complaint.
man/examples-code-check.c:
Fix compile warning, allow 'Unused but set variables' in examples and set
-Werror when compling the examples.
examples/lwip/Makefile:
Remove compilation option -fpack-struct
Merging #552 and #554 into develop caused Observe CON 2.05 initial block
response not to get an ACK from the client and so the Observe response kept
getting re-transmitted and caused other CON traffic to get queued up.
Troubleshooting highlighted an issue when a PUT/POST was updating the contents
of a resource and an Observe was active sending many payloads in a body.
src/net.c:
Make sure that an ACK is sent (if appropriate) when working with a block based
response.
examples/coap-server.c:
Give dynamic data associated with a resource a reference count, and only free
off the data when the reference count has dropped to 0.