Skip to content

Commit

Permalink
Anjay 3.3.1
Browse files Browse the repository at this point in the history
Improvements
- `anjay_disable_server()` and `anjay_disable_server_with_timeout()` can now be
  be called on servers that are not enabled as well

Bugfixes
- Fixed resetting of counter for the Communication Sequence Retry Count resource
- Fixed a regression in 3.2.0 that prevented the bootstrap connection to be
  properly closed if the Bootstrap Server is reconfigured in the new bootstrap
  information and legacy Server-Initiated Bootstrap is disabled
  • Loading branch information
Mateusz Kwiatkowski committed Mar 10, 2023
1 parent 2c88f02 commit 19841d6
Show file tree
Hide file tree
Showing 25 changed files with 332 additions and 90 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 3.3.1 (March 10th, 2023)

### Improvements

- `anjay_disable_server()` and `anjay_disable_server_with_timeout()` can now be
be called on servers that are not enabled as well

### Bugfixes

- Fixed resetting of counter for the Communication Sequence Retry Count resource
- Fixed a regression in 3.2.0 that prevented the bootstrap connection to be
properly closed if the Bootstrap Server is reconfigured in the new bootstrap
information and legacy Server-Initiated Bootstrap is disabled

## 3.3.0 (February 21st, 2023)

### Features
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cmake_minimum_required(VERSION 3.6.0)

project(anjay C)
set(ANJAY_VERSION "3.3.0" CACHE STRING "Anjay library version")
set(ANJAY_VERSION "3.3.1" CACHE STRING "Anjay library version")
set(ANJAY_BINARY_VERSION 1.0.0)

set(ANJAY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
1 change: 1 addition & 0 deletions demo/demo_args.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef struct cmdline_args {
#endif // ANJAY_WITH_LWM2M11

bool alternative_logger;

} cmdline_args_t;

int demo_parse_argv(cmdline_args_t *parsed_args, int argc, char **argv);
Expand Down
6 changes: 3 additions & 3 deletions doc/sphinx/snippet_sources.md5
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ c2fdb37415d974d06387a40f7e87ed2d demo/demo_cmds.c
cd5ba3adb34a01fdd2ceceb6a35d5be2 demo/objects/ipso_objects.c
90e172b4b00a21b7290510a21498e0b8 deps/avs_coap/include_public/avsystem/coap/tcp.h
4670a0997896b4ab2b973fb833c4a039 deps/avs_coap/include_public/avsystem/coap/udp.h
cb2f72863dde53754f158b723a70810f deps/avs_commons/include_public/avsystem/commons/avs_addrinfo.h
632ec469b37df582ff65792fc01d81ce deps/avs_commons/include_public/avsystem/commons/avs_addrinfo.h
b02b7236e89497c73496ab2e5503ed14 deps/avs_commons/include_public/avsystem/commons/avs_base64.h
045968e7cbf1891b418ed417b6b8d189 deps/avs_commons/include_public/avsystem/commons/avs_crypto_common.h
477cd70c144b9fba0f1be35f0c049f76 deps/avs_commons/include_public/avsystem/commons/avs_crypto_pki.h
Expand All @@ -11,7 +11,7 @@ b02b7236e89497c73496ab2e5503ed14 deps/avs_commons/include_public/avsystem/commo
0691a3c8a2dbb7f8f22c74e09db381ce deps/avs_commons/include_public/avsystem/commons/avs_socket_v_table.h
1dc558d1f1b72af3da021cf9c1fca4f4 deps/avs_commons/include_public/avsystem/commons/avs_utils.h
6805fe6ea07bc0eabd90a52923abfc77 deps/avs_commons/src/net/avs_net_global.h
0bde43a45d34f3428024363be4264d56 deps/avs_commons/src/net/avs_net_impl.h
ca82847266e70bd9728611eda7b1a19e deps/avs_commons/src/net/avs_net_impl.h
646826b1669c1dfa639d3c1899f26ba3 deps/avs_commons/src/utils/compat/posix/avs_compat_time.c
9bba955ab235e4c315b28aa83589e010 examples/commercial-features/CF-CorePersistence/src/main.c
4613be67a0c66ba130fe5601e75ef5f0 examples/commercial-features/CF-EST-PKCS11/src/main.c
Expand Down Expand Up @@ -82,7 +82,7 @@ f971df7872a8f052bb72ae64610a8031 examples/tutorial/firmware-update/basic-implem
844cd7d9d0ebe80007dc5ae8d6a719b0 examples/tutorial/firmware-update/download-resumption/src/firmware_update.c
077f6b89dad59ef3b9b58e2abe93aff6 examples/tutorial/firmware-update/secure-downloads/src/firmware_update.c
af2f0e0ac0de25dc04713f05a378d469 include_public/anjay/attr_storage.h
905feb6369f49041b7a505c074cb000b include_public/anjay/core.h
40556bc52ee8a6b3080840a40d200a88 include_public/anjay/core.h
01253f147521b96a08d08ff533b7d789 include_public/anjay/dm.h
bd04d42f0c35a3fdd16173a3003af577 include_public/anjay/fw_update.h
c14cc4edd6db240a0a6c5d93170a0010 include_public/anjay/io.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,13 @@
*
* Specify an optional header with a list of modules for which log level
* is set. If a log level for specific module is not set, the DEFAULT level
* will be taken into account. Value of the default logging level is set to
* will be taken into account. Value of the default logging level is set to
* DEBUG, but can be overwritten in this header file with AVS_LOG_LEVEL_DEFAULT
* define. Messages with lower level than the one set will be removed during
* compile time. Possible values match @ref avs_log_level_t.
*
* That file should contain C preprocesor defines in the:
* - "#define AVS_LOG_LEVEL_FOR_MODULE_<Module> <Level>" format,
* - "#define AVS_LOG_LEVEL_FOR_MODULE_<Module> <Level>" format,
* where <Module> is the module name and <Level> is allowed logging level
* - "#define AVS_LOG_LEVEL_DEFAULT <Level>" format, where <Level> is the
* allowed logging level
Expand All @@ -573,7 +573,7 @@
* <code>
* #ifndef AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
* #define AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
*
*
* // global log level value
* #define AVS_LOG_LEVEL_DEFAULT INFO
*
Expand All @@ -589,9 +589,9 @@
/* #undef AVS_COMMONS_WITH_EXTERNAL_LOG_LEVELS_HEADER */

/**
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
*
* The macros avs_log_set_level and avs_log_set_default_level
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
*
* The macros avs_log_set_level and avs_log_set_default_level
* will not be available.
*
*/
Expand Down Expand Up @@ -713,6 +713,20 @@
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_IN6_IS_ADDR_V4MAPPED */

/**
* Should be defined if IPv4-mapped IPv6 addresses (<c>::ffff:0.0.0.0/32</c>)
* are <strong>NOT</strong> supported by the underlying platform.
*
* Enabling this flag will prevent avs_net from using IPv4-mapped IPv6 addresses
* and instead re-open and re-bind the socket if a connection to an IPv4 address
* is requested on a previously created IPv6 socket.
*
* This may result in otherwise redundant <c>socket()</c>, <c>bind()</c> and
* <c>close()</c> system calls to be performed, but may be necessary for
* interoperability with some platforms.
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT */

/**
* Is the <c>inet_ntop()</c> function available?
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,13 @@
*
* Specify an optional header with a list of modules for which log level
* is set. If a log level for specific module is not set, the DEFAULT level
* will be taken into account. Value of the default logging level is set to
* will be taken into account. Value of the default logging level is set to
* DEBUG, but can be overwritten in this header file with AVS_LOG_LEVEL_DEFAULT
* define. Messages with lower level than the one set will be removed during
* compile time. Possible values match @ref avs_log_level_t.
*
* That file should contain C preprocesor defines in the:
* - "#define AVS_LOG_LEVEL_FOR_MODULE_<Module> <Level>" format,
* - "#define AVS_LOG_LEVEL_FOR_MODULE_<Module> <Level>" format,
* where <Module> is the module name and <Level> is allowed logging level
* - "#define AVS_LOG_LEVEL_DEFAULT <Level>" format, where <Level> is the
* allowed logging level
Expand All @@ -573,7 +573,7 @@
* <code>
* #ifndef AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
* #define AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
*
*
* // global log level value
* #define AVS_LOG_LEVEL_DEFAULT INFO
*
Expand All @@ -589,9 +589,9 @@
/* #undef AVS_COMMONS_WITH_EXTERNAL_LOG_LEVELS_HEADER */

/**
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
*
* The macros avs_log_set_level and avs_log_set_default_level
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
*
* The macros avs_log_set_level and avs_log_set_default_level
* will not be available.
*
*/
Expand Down Expand Up @@ -713,6 +713,20 @@
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_IN6_IS_ADDR_V4MAPPED */

/**
* Should be defined if IPv4-mapped IPv6 addresses (<c>::ffff:0.0.0.0/32</c>)
* are <strong>NOT</strong> supported by the underlying platform.
*
* Enabling this flag will prevent avs_net from using IPv4-mapped IPv6 addresses
* and instead re-open and re-bind the socket if a connection to an IPv4 address
* is requested on a previously created IPv6 socket.
*
* This may result in otherwise redundant <c>socket()</c>, <c>bind()</c> and
* <c>close()</c> system calls to be performed, but may be necessary for
* interoperability with some platforms.
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT */

/**
* Is the <c>inet_ntop()</c> function available?
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,13 @@
*
* Specify an optional header with a list of modules for which log level
* is set. If a log level for specific module is not set, the DEFAULT level
* will be taken into account. Value of the default logging level is set to
* will be taken into account. Value of the default logging level is set to
* DEBUG, but can be overwritten in this header file with AVS_LOG_LEVEL_DEFAULT
* define. Messages with lower level than the one set will be removed during
* compile time. Possible values match @ref avs_log_level_t.
*
* That file should contain C preprocesor defines in the:
* - "#define AVS_LOG_LEVEL_FOR_MODULE_<Module> <Level>" format,
* - "#define AVS_LOG_LEVEL_FOR_MODULE_<Module> <Level>" format,
* where <Module> is the module name and <Level> is allowed logging level
* - "#define AVS_LOG_LEVEL_DEFAULT <Level>" format, where <Level> is the
* allowed logging level
Expand All @@ -573,7 +573,7 @@
* <code>
* #ifndef AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
* #define AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
*
*
* // global log level value
* #define AVS_LOG_LEVEL_DEFAULT INFO
*
Expand All @@ -589,9 +589,9 @@
/* #undef AVS_COMMONS_WITH_EXTERNAL_LOG_LEVELS_HEADER */

/**
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
*
* The macros avs_log_set_level and avs_log_set_default_level
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
*
* The macros avs_log_set_level and avs_log_set_default_level
* will not be available.
*
*/
Expand Down Expand Up @@ -713,6 +713,20 @@
*/
#define AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_IN6_IS_ADDR_V4MAPPED

/**
* Should be defined if IPv4-mapped IPv6 addresses (<c>::ffff:0.0.0.0/32</c>)
* are <strong>NOT</strong> supported by the underlying platform.
*
* Enabling this flag will prevent avs_net from using IPv4-mapped IPv6 addresses
* and instead re-open and re-bind the socket if a connection to an IPv4 address
* is requested on a previously created IPv6 socket.
*
* This may result in otherwise redundant <c>socket()</c>, <c>bind()</c> and
* <c>close()</c> system calls to be performed, but may be necessary for
* interoperability with some platforms.
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT */

/**
* Is the <c>inet_ntop()</c> function available?
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,13 @@
*
* Specify an optional header with a list of modules for which log level
* is set. If a log level for specific module is not set, the DEFAULT level
* will be taken into account. Value of the default logging level is set to
* will be taken into account. Value of the default logging level is set to
* DEBUG, but can be overwritten in this header file with AVS_LOG_LEVEL_DEFAULT
* define. Messages with lower level than the one set will be removed during
* compile time. Possible values match @ref avs_log_level_t.
*
* That file should contain C preprocesor defines in the:
* - "#define AVS_LOG_LEVEL_FOR_MODULE_<Module> <Level>" format,
* - "#define AVS_LOG_LEVEL_FOR_MODULE_<Module> <Level>" format,
* where <Module> is the module name and <Level> is allowed logging level
* - "#define AVS_LOG_LEVEL_DEFAULT <Level>" format, where <Level> is the
* allowed logging level
Expand All @@ -573,7 +573,7 @@
* <code>
* #ifndef AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
* #define AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
*
*
* // global log level value
* #define AVS_LOG_LEVEL_DEFAULT INFO
*
Expand All @@ -589,9 +589,9 @@
/* #undef AVS_COMMONS_WITH_EXTERNAL_LOG_LEVELS_HEADER */

/**
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
*
* The macros avs_log_set_level and avs_log_set_default_level
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
*
* The macros avs_log_set_level and avs_log_set_default_level
* will not be available.
*
*/
Expand Down Expand Up @@ -713,6 +713,20 @@
*/
#define AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_IN6_IS_ADDR_V4MAPPED

/**
* Should be defined if IPv4-mapped IPv6 addresses (<c>::ffff:0.0.0.0/32</c>)
* are <strong>NOT</strong> supported by the underlying platform.
*
* Enabling this flag will prevent avs_net from using IPv4-mapped IPv6 addresses
* and instead re-open and re-bind the socket if a connection to an IPv4 address
* is requested on a previously created IPv6 socket.
*
* This may result in otherwise redundant <c>socket()</c>, <c>bind()</c> and
* <c>close()</c> system calls to be performed, but may be necessary for
* interoperability with some platforms.
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT */

/**
* Is the <c>inet_ntop()</c> function available?
*
Expand Down
6 changes: 6 additions & 0 deletions include_public/anjay/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,9 @@ int anjay_schedule_bootstrap_request(anjay_t *anjay);
* the invocation of this function (during next @ref anjay_sched_run) and is
* <strong>not</strong> updated upon any subsequent Writes to that resource.
*
* If the server is already disabled, its re-enable action will be re-scheduled
* according to the value of the Disable Timeout resource added to current time.
*
* @param anjay Anjay object to operate on.
* @param ssid Short Server ID of the server to put in a disabled state.
* NOTE: disabling a server requires a Server Object Instance
Expand All @@ -914,6 +917,9 @@ int anjay_disable_server(anjay_t *anjay, anjay_ssid_t ssid);
*
* The server will become disabled during next @ref anjay_sched_run call.
*
* If the server is already disabled, its re-enable action will be re-scheduled
* or cancelled, according to the @p timeout argument.
*
* NOTE: disabling a server with dual binding (e.g. UDP+SMS trigger) closes both
* communication channels. Shutting down only one of them requires changing
* the Binding Resource in Server object.
Expand Down
5 changes: 5 additions & 0 deletions src/anjay_config_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ static inline void _anjay_log_feature_list(void) {
#else // AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_RECVMSG
_anjay_log(anjay, TRACE, "AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_RECVMSG = OFF");
#endif // AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_RECVMSG
#ifdef AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT
_anjay_log(anjay, TRACE, "AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT = ON");
#else // AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT
_anjay_log(anjay, TRACE, "AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT = OFF");
#endif // AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT
#ifdef AVS_COMMONS_NET_WITH_DTLS
_anjay_log(anjay, TRACE, "AVS_COMMONS_NET_WITH_DTLS = ON");
#else // AVS_COMMONS_NET_WITH_DTLS
Expand Down
27 changes: 10 additions & 17 deletions src/core/anjay_bootstrap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,28 +718,21 @@ static int bootstrap_finish_impl(anjay_unlocked_t *anjay,
retval = schedule_bootstrap_timeout(anjay);
}
}
// Server might have been invalidated during
// _anjay_notify_perform_without_servers() above
bootstrap_connection.server =
_anjay_servers_find_active(anjay, ANJAY_SSID_BOOTSTRAP);
if ((flags & BOOTSTRAP_FINISH_DISABLE_SERVER) && !retval
&& bootstrap_connection.server) {
if (!anjay->bootstrap.allow_legacy_server_initiated_bootstrap) {
if (!(retval =
_anjay_schedule_disable_server_with_explicit_timeout_unlocked(
anjay, ANJAY_SSID_BOOTSTRAP,
AVS_TIME_DURATION_INVALID))) {
// Server is now invalidated
bootstrap_connection.server = NULL;
}
}
}
if (!retval && !anjay->bootstrap.allow_legacy_server_initiated_bootstrap
&& (flags & BOOTSTRAP_FINISH_DISABLE_SERVER)) {
retval = _anjay_schedule_disable_server_with_explicit_timeout_unlocked(
anjay, ANJAY_SSID_BOOTSTRAP, AVS_TIME_DURATION_INVALID);
}
// Server might have been invalidated during the calls above
bool server_still_active =
(bootstrap_connection.server
&& !!_anjay_servers_find_active(anjay, ANJAY_SSID_BOOTSTRAP));
if (retval) {
anjay_log(WARNING,
_("Bootstrap Finish failed, re-entering bootstrap phase"));
avs_error_t err = start_bootstrap_if_not_already_started(
anjay, bootstrap_connection, true);
if (avs_is_err(err) && bootstrap_connection.server) {
if (avs_is_err(err) && server_still_active) {
_anjay_server_on_server_communication_error(
bootstrap_connection.server, err);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/anjay_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
VISIBILITY_SOURCE_BEGIN

#ifndef ANJAY_VERSION
# define ANJAY_VERSION "3.3.0"
# define ANJAY_VERSION "3.3.1"
#endif // ANJAY_VERSION

#ifdef ANJAY_WITH_LWM2M11
Expand Down
3 changes: 3 additions & 0 deletions src/core/anjay_downloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ _anjay_downloader_set_next_block_offset(anjay_downloader_t *dl,
void _anjay_downloader_abort(anjay_downloader_t *dl,
anjay_download_handle_t handle);

bool _anjay_downloader_same_socket_transfer_ongoing(anjay_downloader_t *dl,
avs_net_socket_t *socket);

void _anjay_downloader_suspend_same_socket(anjay_downloader_t *dl,
avs_net_socket_t *socket);

Expand Down
Loading

0 comments on commit 19841d6

Please sign in to comment.