Issue introduced by OpenSSL 1.1.1c causes valgrind errors to be reported. See
https://www.mail-archive.com/openssl-commits@openssl.org/msg21701.html and
https://github.com/openssl/openssl/pull/8606 which did not make 1.1.1c
scripts/build.sh:
tests/valgrind_suppression:
Temporarily suppress valgrind errors when SSL_CTS_new() is called when running
the tests.
Note: This suppression will also need to be applied when running valgrind
against other CoAP executables using OpenSSL 1.1.1c to prevent the valgrind
errors getting reported.
src/coap_openssl.c:
memset cookie_secret to 0 to stop valgrind warning.
oss-fuzz: Added split_uri target
oss-fuzz: Update usage of coap_show_pdu() in pdu_parse_target
oss-fuzz: Fix split uri issue mentioned in #218
oss-fuzz: Set log level
src/coap_io.c:
ifdef out IPv4 struct in_pktinfo code that does not compile, copying what
has been done later in the same coap_network_send() function.
tests/test_session.c
Correctly reverse the parameters to coap_new_client_session() in t_session6()
so that the test application does not bind to local-address, port 5683 twice.
[It seems that other distrubutions are happy with this when just SO_REUSEADDR
is used on the socket, but FreeBSD needs SO_REUSEPORT enabled as well.]
BUILDING
Record that gmake is required to build TinyDTLS for FreeBSD, not make.
HAVE_GNUTLS -> HAVE_LIBGNUTLS
Correct TinyDTLS version checks as TinyDTLS is now returning the
actual TinyDTLS library version.
For TinyDTLS builds, #undef PACKAGE_* to remove compiler warnings.
This Makefile will be invoked from the OSS Fuzzer to create the
fuzzing executables. Invocation:
make -C tests/oss-fuzz -f Makefile.oss-fuzz
This change closes issue #231 [1].
[1] https://github.com/obgm/libcoap/issues/231
This change extends the continuous integration Makefile.ci with
new rules for creating the executables for OSS-Fuzz [1].
Object files and linked executables are now created in the directory
$OUT which is set to '.' by default.
[1] https://github.com/google/oss-fuzz
New struct coap_binary_t - same as coap_string_t, used for tokens
Deprecate struct str with the intent of removing it downstream as it
polutes namespace.
Make end of coap_string_t data a NUL.
Updated coap_make_str_const(), removing .length= and .s= to keep upstream
compilers happy.
Update Doxygen for str.h
Files:
examples/client.c
examples/coap-rd.c
examples/coap-server.c
examples/contiki/server.c
examples/etsi_iot_01.c
include/coap/resource.h
include/coap/str.h
include/coap/subscribe.h
man/coap_observe.txt.in
src/net.c
src/resource.c
src/str.c
src/uri.c
tests/test_options.c
Update
The sub-directory tests/oss-fuzz contains single files that are
used from the Open Source Software Fuzzer [1]. This change provides
a template Makefile with the proper flags for compiling libcoap
applications in a continuous integration environment such as travis.
Intended usage from top_srcdir is:
make -C test/oss-fuzz -f Makefile.ci check clean
[1] https://github.com/google/oss-fuzz/
coap_show_pdu()'s API is now coap_show_pdu(coap_log_t, coap_pdu_t*)
New function void coap_set_show_pdu_output(int use_fprintf)
Default is use fprintf() instead of coap_log()
The output buffer size can be configuring -DCOAP_DEBUG_BUF_SIZE
Output COAP_OPTION_SIZE2 option as well
For binary data, output ascii readable equivalent immediately under the
hex output for ease of debugging.
include/coap/debug.h
src/debug.c
Update coap_show_pdu() API
New function coap_set_show_pdu_output()
Update coap_show_pdu() code
include/coap/pdu.h
Define the coap debug output debug buffer size
COAP_DEBUG_BUF_SIZE
examples/client.c
examples/contiki/coap-observer.c
src/net.c
tests/test_wellknown.c
tests/test_pdu.c
Update coap_show_pdu() calls
libcoap-2.map
libcoap-2.sym
New function coap_set_show_pdu_output()
build-env/Dockerfile.build-env
scripts/build.sh
Add in valgrind testing of the tests
src/option.c
Issue #199 Better fix of ADVANCE_OPT_CHECK()
src/pdu.c
Issue #214 Validate token length in coap_pdu_parse_header()
src/uri.c
Issue #212 Check not reading off end of buffer in dots()
tests/test_pdu.c
tests/test_uri.c
Tests updated to include tests for #212 & #214
tests/test_pdu.c: Create t_parse_pdu15() which shows the issue
Credit to OSS-Fuzz for finding this - work done by Bhargava Shastry with
the libcoap testing
Update code / examples / man pages with the updated function.
include/coap/libcoap.h:
Add in new define COAP_DEPRECATED to generate compiler warnings when used
include/coap/encode.h
New coap_encode_var_safe() function that includes the size of the output
buffer as a parameter.
Make coap_encode_var_bytes() a wrapper for coap_encode_var_safe() and
mark it as COAP_DEPRECATED for backwards compatability
src/encode.c:
New coap_encode_var_safe() function that includes the size of the output
buffer as a parameter.
examples/coap-server.c:
examples/contiki/server.c:
Make the ticks resource consistent in case
coap_add_optlist_pdu() sorted the options for insertion, but did not update
the coap_optlist_t head (whch may then no longer point to the first entry in the
sorted chain) and so when coap_delete_optlist() was called, the first few
entries of the sorted chain may not get deleted.
Fixed by making it
coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t** optlist_chain)
instead of
coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t* optlist_chain)
Additionally deleted options_start() and options_next() as they are not
required - Issue #184.
examples/client.c:
Fix coap_add_optlist_pdu() call
include/coap/options.h:
Fix coap_add_optlist_pdu() call
libcoap-2.{map|sym}:
Delete options_start()
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
Update docmentation
src/option.c:
Update coap_add_optlist_pdu()
tests/test_pdu.c:
New tests for checkout out coap_insert_optlist() and coap_add_optlist_pdu()
functions
This change replaces the call of abs(v - ref) to avoid a compiler
warning for -Wabsolute-value:
test_session.c:95:11: warning: taking the absolute value of unsigned type 'unsigned int' has no effect
[-Wabsolute-value]
return (abs(v - ref) / 100.0) <= FP_ERR_THRESHOLD;
Created new 'CU_ASSERT_PTR_EQUAL_C(actual, expected)' to handle const variable matching
Where appropriate
Replace 'unsigned char' with 'const uint8_t'
Replace 'str' with 'coap_str_c_t'
Replace 'str' with 'coap_string_t'
Prefix with 'const' some type casts
Update coap_add_attr() calls inline with updated API
Update coap_resource_init() calls inline with updated API
Make use of coap_make_str_const() for defining parameters
tests*/.c
Update code to stop memory leaks (as found by valgrind)
examples/coap-rd.c
Track the fact that uri_path in coap_resource_t is now a pointer
Added several unit tests for coap_get_uri_path():
* Check corner cases such as one or more zero-length Uri-Paths.
* Check percent-encoding of reserved characters.
* Check non-reserved characters that should not be percent-encoded.
This change also removes a couple of trailing LWS by accident.
A simple structure for (D)TLS-specific unit tests has been added.
Currently, only general support and the version number as reported
by coap_get_tls_library_version() are checked.
As unit tests with IPv6 addresses keep failing on docker-based
travis CI, this changes reverts to IPv4 usage in following files:
test_wellknown.c
test_sendqueue.c
Make coap_pdu-t independent of the header style.
Use C99 sized types when applicable.
Use transaction ids in host byte order in the library.
Make coap_pdu_t payload storage grow on demand.
Add parsing and encoding of PDUs with UDP or TCP style headers.
Adapt examples and unit tests to the new PDU format.
When building outside the source tree compilation fails on
examples, because the libcoap headers expect to be all in the
same directory but coap.h is generated under the build
directory, so it is necessary to add an extra include path
for it.
Also, build directories should always appear before source
directories in the include path, so that any leftover
generated files in the source tree are ignored.
Sendqueue nodes and send operations now require a session object.
This modification calls coap_new_client_session() on a global
coap_context_t object to create a fake session on the loopback
interface.
Merge changes from PR #47 related to windows platform support.
Add full windows platform support including correct error checking and working regression tests and examples.
Remove need to build applications using libcoap with -DWITH_POSIX and to include coap_config.h. This applies to the examples as well.
PR #65 reports wrong encoding of option value 269. The new
unit test t_encode_option9() tests for correct encoding
according to [RFC 7252, Section 3.1](https://tools.ietf.org/html/rfc7252#section-3.1).
Free the storage allocated by coap_new_error_response() in unit tests.
This change simplifies automated leak checks as it avoids cluttering
the output with almost false positives.
The build environment was lacking the possibility to get libcoap
buildable out of tree, simply checkable by the running 'make distcheck'.
Without this fix the users are impossible to build libcoap in a own
folder that's independed from the source containing folder. Typical use
case would be:
$ mkdir libcoap-build && cd libcoap-build
$ /path/to/libcoap-source/configure \
--srcdir=/path/to/libcoap-source \
--prefix=/somethere/to-install
This commit enables the out of tree build by adding and changing some
needed variables.
The CUNIT_LIBS are already used, the CUNIT_CFLAGS are also needed to
ensure that get also header files that are not inside the default search
patch of the compiler. For example header within /usr/local/include
instead /usr/include.
CUNIT_LIBS and CUNIT_CFLAGS are generated by PKG_CHECK_MODULES([CUNIT] ...
in configure.ac.
The testdriver was linked against the statically generated library of
libcoap. By this the testdriver will *always* find any symbols, no
matter if it is a private or public symbol.
Due this the testing behavior isn't the same as a user would use the
shared library and can get a potentially pitfall even if the testdriver
was successful.
Due previous changes to the public header the testdriver source needs
now the local header coap_config.h to find all needed functions so there
are small changes needed to the source files.
Some unit tests in tests/test_options.c and tests/test_pdu.c check
for error cases, causing warning messages to be emitted by the
library code. As the expected result is checked separately, the
warnings can be suppressed to avoid confusion.