Commit Graph
2375 Commits
Author SHA1 Message Date
Jon Shallow df72a53f2d coap_openssl.c: Support Microsoft VS builds
Correct reported errors

Update workflow for ms-build to include OpenSSL.
2022-02-21 12:37:44 +00:00
obgm ce88036fc4 Merge pull request #830 from mrdeep1/distribution
doc/Makefile.am: Include module_api_wrap.h in a distribution
2022-02-21 11:02:39 +01:00
obgm 9a0d1c2fe4 Merge pull request #831 from mrdeep1/warn_error
builds: Set CFLAGS += -Werror in all linux subdirectory compilations
2022-02-21 11:01:35 +01:00
Jon Shallow 19928e81bd builds: Set CFLAGS += -Werror in all linux subdirectory compilations 2022-02-18 14:23:43 +00:00
Jon Shallow b2ad43319a doc/Makefile.am: Include module_api_wrap.h in a distribution 2022-02-18 13:34:24 +00:00
obgm 69b865cd3b Merge pull request #823 from mrdeep1/pdu_setup_docs
coap_pdu_setup.txt.in: Clarify / more make readable the pdu setup information
2022-02-16 09:15:32 +01:00
Jon Shallow 93f2738c45 coap_pdu_setup.txt.in: Clarify / more make readable the pdu setup information 2022-02-14 17:05:00 +00:00
obgm a5eb61d25d Merge pull request #824 from mrdeep1/windows_2022
github workflow: Support windows-2022
2022-02-10 11:15:30 +01:00
obgm f9c3e13a18 Merge pull request #804 from mrdeep1/insert_option
pdu.c: Fix coap_insert_option with delta = 269
2022-02-10 10:21:43 +01:00
Jon Shallow 5b32d716fa github workflow: Support windows-2022
The provided host for windows-latest is migrating across from
windows-2019 to windows-2022 on github.  This allows things to be built on
a windows-2022 system.
2022-02-09 21:44:37 +00:00
Jon Shallow bd9ced550e pdu.c: Fix coap_insert_option with delta = 269
Fix off-by-one error for option delta = 269.

Correct / clarify the tests in coap_insert_option() when working out extended
option delta for inserting new option.
2022-02-09 16:51:39 +00:00
Olaf Bergmann ba585f848f [OSS-Fuzz] pdu_parse_target.c: Check result of coap_pdu_parse()
When coap_pdu_parse() returns 0, the contents of pdu are undefined and
must not be processed. This change proceeds fuzzer tests only if parsing
succeeded.

Fixes OSS-Fuzz issue 44503 [1]

[1] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44503
2022-02-09 16:34:35 +01:00
Olaf Bergmann a2e0046c80 [OSS-Fuzz] pdu_parse_target.c: Fix compiler warning
Declare prototype for internal function coap_pdu_encode_header().
2022-02-09 16:32:00 +01:00
obgm afb4f2b7a1 Merge pull request #812 from mrdeep1/multiple_sessions
sessions: Prevent multiple client session confusion
2022-02-09 12:38:35 +01:00
Jon Shallow b3d503cbff sessions: Prevent multiple client session confusion
Prevent multiple coap_new_client_session*() calls that are connecting to
the same server/port being bound to the same local ip/port.

Update logging for session creation / removal to easily differentiate between
sessions that have the same 4-tuple.

Document that coap_new_endpoint() is not required in client based code.

If coap-client '-p port' but not '-a addr' is provided, fix code so that
the port is bound to.

Only remove outstanding CON requests with token matches if there is an
ACK response.

Update the logging to differentiate between the 6 occurrences where the mid
is removed.
2022-02-08 16:52:15 +00:00
obgm 6aa967cee1 Merge pull request #809 from mrdeep1/cmake_tinydtls
cmake_coap_config.h.in: Fix definitions for when building with tinydtls
2022-02-08 15:43:36 +01:00
obgm dc4994f1d1 Merge pull request #821 from mrdeep1/block_docs
coap_block.txt.in: Clarify / more make readable the block handling information
2022-02-08 15:42:36 +01:00
obgm 838b2d9e39 Merge pull request #813 from mrdeep1/pdu_ordering
pdu building: Enforce the application order of building a PDU
2022-02-08 15:42:01 +01:00
Jon Shallow 726b9630e5 coap_block.txt.in: Clarify / more make readable the block handling information 2022-02-08 14:16:27 +00:00
Jon Shallow 756bb04239 pdu building: Enforce the application order of building a PDU
Make coap_add_option() invalid after calling a coap_add_data*() function.
Add in internal support for adding options to PDUs that contain data with
a replacement coap_add_option_internal() function.  Call this new function
in the appropriate places in the libcoap src.

Add coap_log warnings when the application tries to build a PDU in the wrong
order and then return failure.

Update documentation re-inforcing the PDU building order.
2022-02-08 14:14:51 +00:00
obgm 0d6c7d686b Merge pull request #819 from mrdeep1/coap_access_pdu
coap_pdu_access.txt.in: Add in documentation for coap_get_uri_path()
2022-02-07 17:33:00 +01:00
obgm 6504b667d3 Merge pull request #818 from mrdeep1/proxy_uri
proxy_uri: Fix handling the resource for uri path in Proxy-Uri
2022-02-07 17:32:31 +01:00
Jon Shallow c02ca5f097 coap_pdu_access.txt.in: Add in documentation for coap_get_uri_path()
Also document the return values of the various functions.
2022-02-07 14:50:03 +00:00
Jon Shallow aaf6115594 proxy_uri: Fix handling the resource for uri path in Proxy-Uri
If the server recieving a Proxy request determines that it is the final
endpoint of the request, the resource that the request was sent to
was wrong. The update to coap_get_uri_path() fixes this issue.

There is now also parameter support for the proxy definition for the
coap-server where any defined host is treated as being the final endpoint
is in:

  coap-server -P ,

This allows any actual server to be the final endpoint of any proxy request
without have to define all the names or IP addresses that the coap-server is
known by.  Note that if there is nothing following the , (comma), anything
before the , (comma) will never be used.

Documentation updated.
2022-02-07 14:46:46 +00:00
obgm 1fceff7cc3 Merge pull request #814 from mrdeep1/build_version
versioning: Make current git describe available
2022-02-07 14:38:34 +01:00
obgm 5e793d4852 Merge pull request #816 from mrdeep1/coap_encode
coap_pdu_setup.txt.in: Better document coap_encode_var_safe8()
2022-02-07 13:24:47 +01:00
Jon Shallow a8c00f2af9 coap_pdu_setup.txt.in: Better document coap_encode_var_safe8()
Document return value can be 0 for both being valid and returning on error.
Same is true for coap_encode_var_safe().

[Error should assert() by default]
2022-02-02 21:37:54 +00:00
Jon Shallow 64e5641017 versioning: Make current git describe available
Add new function coap_package_build() which returns "git describe --tags"
if available at library build time, else standard package version.

The value of "git describe --tags" is created at run time and passed in as
a compiler -D definition.

Update copyright end dates for updated files.
2022-02-02 11:24:52 +00:00
Jon Shallow 0a16d790ce cmake_coap_config.h.in: Fix definitions for when building with tinydtls
Build the coap_config.h file in the same way that the make system does
without wrapping the definitions with ""
2022-01-01 13:26:08 +00:00
obgm 2a329e1c76 Merge pull request #771 from mrdeep1/server_post
coap-server: Add in POST support for unknown request handler
2021-12-22 15:31:37 +01:00
obgm fce44ba52a Merge pull request #779 from mrdeep1/mid_testing
coap_session.c: Do not check for duplicate mids if reliable protocol
2021-12-22 15:05:02 +01:00
obgm 17f7fe8c52 Merge pull request #780 from mrdeep1/multicast_get
coap-client.c: Allow time for all server responses to mcast
2021-12-22 14:16:36 +01:00
obgm 0da7c50c54 Merge pull request #790 from mrdeep1/mbedtls_lib
configure.ac: Fix have mbedtls lib, but no mbedtls-dev issue
2021-12-22 14:15:03 +01:00
obgm ffc1f4f938 Merge pull request #791 from mrdeep1/resource_delete
resource.c: Support deleting resources that have not yet been added
2021-12-22 14:04:05 +01:00
Jon Shallow 74582eddde resource.c: Support deleting resources that have not yet been added
Support deleting a resource both before and after calling
coap_delete_resource().

Make the coap_delete_resource() usage in examples less complex.
2021-12-22 12:59:32 +00:00
obgm efe18d2845 Merge pull request #781 from mrdeep1/large_tcp_writes
coap_write_session: Account correctly for partial TCP writes
2021-12-22 13:55:28 +01:00
obgm dc0db3a238 Merge pull request #796 from mrdeep1/block_boundaries
block: Check block size space correctly
2021-12-22 12:04:27 +01:00
obgm cbe387614c Merge pull request #799 from mrdeep1/cmake_bin_install
cmake: Install example programs if examples enabled
2021-12-22 12:02:49 +01:00
obgm 470f36b45e Merge pull request #801 from mrdeep1/request_overlap
block.c: Do not match large response if no Block2 option in request
2021-12-22 12:02:27 +01:00
obgm 571807bcc5 Merge pull request #803 from mrdeep1/request_handler_log
request_handler: Report only when app's request handler is actually called
2021-12-22 12:00:13 +01:00
Jon Shallow 32d2d0e1c6 request_handler: Report only when app's request handler is actually called
Aids tracking issues with the libcoap block handling logic to easily
differentiate when libcoap sends a response and when app handler is called
to send a response.
2021-12-22 10:23:34 +00:00
Jon Shallow 5dc2dfca86 block.c: Do not match large response if no Block2 option in request
Allows a following request not to match cached multi-payload large response.
2021-12-20 20:31:37 +00:00
Jon Shallow 18888cd0dd cmake: Install example programs if examples enabled 2021-12-20 12:24:00 +00:00
Jon Shallow c0e032ffad block: Check block size space correctly
Account correctly for larger stateless tokens.
2021-12-18 15:16:45 +00:00
obgm 997c31fa62 Merge pull request #792 from kkrentz/return-pr
Corrects return value in net.c#coap_send_internal
2021-12-16 08:58:29 +01:00
kkrentz 693a4e2313 net.c: correct return value in coap_send_internal()
The interface description of coap_send_internal says that COAP_INVALID_MID
is returned  in the case of errors. Presently, it, however, returns
"(coap_mid_t)bytes_written" in a special case. Accidentally,
bytes_written == -1 == COAP_INVALID_MID in this specific case, which is why
no problems occur in practice due to this. As a cosmetic fix, this commit
changes the return value to COAP_INVALID_MID.
2021-12-14 15:37:34 +01:00
Jon Shallow 38bffb7f99 configure.ac: Fix have mbedtls lib, but no mbedtls-dev issue
Do not make it a hard error if mbedtls library exists, but the mbedtls
development environment is missing.

Just remove mbedtls support if this is the case.
2021-12-13 10:04:49 +00:00
obgm cca9c858b9 Merge pull request #737 from mrdeep1/proxy_fix
coap-server.c: Fix proxy response type and code
2021-12-08 15:59:33 +01:00
Jon Shallow 694a205f28 coap-server.c: Fix proxy response type and code
Handle "separate" response types correctly.

Make proxy based traffic handling mode COAP_BLOCK_SINGLE_BODY to remove
complexities.

Rename proxy_message_handler() to proxy_response_handler() as it is a
response handler.

Build a dummy 'received' PDU for use with coap_add_data_large_response() in
proxy_response_handler() to be consistant across all uses of
coap_add_data_large_response().

Add appropriate resource_flags (so that NON can be used in observe) for
resources "async" and "example_data".
2021-12-08 11:09:15 +00:00
Jon Shallow e8e33f0424 coap-server: Add in POST support for unknown request handler 2021-12-07 21:30:35 +00:00