Commit adds implementation of the specification
recommendations regarding randomization of
responses on the access layer.
3.7.3.1 Transmitting an Access messages
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The 2 issues were found after CONFIG_OSDP_SC_ENABLED was enabled:
- missing curly brace after if
- typo in type name
Signed-off-by: Arkadiusz Wadowski <wadowski.arkadiusz@gmail.com>
Added missing command and message handling for use existing
modem cmux for DCE role.
DCE CMUX connection can be now initialized from DTE side.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
Add a "input kbd_matrix_state" shell command. This prints the state of
a keyboard matrix in a much more compact representation than the normal
input event dump, but also keeps track of any key seen during the
execution and reports that on the "off" command. The output can be used
to help setting the actual-key-mask property.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
SNTP response is not analyzed for uncertainty, and no uncertainty is given
to the `struct sntp_time` returned. Fix it with a Kconfig option that adds
optional SNTP uncertainty and timestamp fields in SNTP time struct, and
calculates these when parsing the response.
Adds two helper functions to convert Q16.16/Q32.32 in seconds to `int64_t`
in microseconds to facilitate this.
Also changes combined `lvm` field in `struct sntp_pkt` to bit-fields
`li`, `vn`, and `mode`.
Signed-off-by: Jasper Smit <git@jrhrsmit.nl>
This error message may confuse when `CONFIG_BT_MESH_ACCESS_LAYER_MSG` is
enabled and all messages are processed by the callback anyway.
This error message also confuses when a node is subscribed to the same
address as it publishes to, which makes it generating the error message
every time it publishes a message.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This change allows a custom RPL use pending mechanism and the mesh
settings work to store pending RPL entries. `bt_mesh_rpl_pending_store`
is a public API and should be implemented anyway. The custom RPL
implementation has to trigger settings with the
`BT_MESH_SETTINGS_RPL_PENDING` flag to ask the mesh settings work to
call `bt_mesh_rpl_pending_store`.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Don't assert that `pm_device_runtime_get` is not running in an ISR
context, as `runtime_suspend` properly handles that condition.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Modify the VCP volume controller callbacks to support
multiple registers by making it into a linked list.
This allow for multiple applications to get the information
from procedures or notifications.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add const prefix for service uuid and char uuid.
Since Service UUID and Char UUID should not change in the service
definition, they are most reasonably defined as rodata, also for
save some ram footprint.
The field `attr->user_data` type is `void *`, as this PR change
all Service UUID to rodata, so there must add (void *) to avoid warning.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Add Kconfig choice for the user to select how Network Events are
handled. It's own thread, the system work queue or synchronous when
events are emitted.
By default a separate thread is created to be backwards compatible.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The CAP Initiator and the CAP Commendar share quite a lot of
functionality in terms of discovery and performing set-based
procedures.
The code for handling most of this has been moved to
cap_common.c to avoid duplicating code.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Prevents the user from potentially bricking a device by erasing
the MCUboot or currently running application flash areas with the
mcuboot erase command
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
It's bad form, especially since in that case, it's always the same function
that is called `bt_att_sent()`.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This reverts commit 5227f24815.
The coap observer events will be replaced with net_mgmt events.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Dynamic command handlers should be fully initialized to avoid undefined
behavior. Also, fix the number of arguments required by each command,
since llext_call_fn requires both the llext and the name of the function
to be called.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
On architectures that have separate data and instruction caches, such as
the Cortex-M7, it is required to flush the reloc changes to the actual RAM
storage before trying to execute any code from the newly loaded llext.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
It is not safe to assume that on entry to llext_load, *ext contains
either NULL or a previous reference to the same ext being loaded. For
example, the shell sample was passing an uninitialized value.
Initialize *ext from a search of the llext by name. If NULL, it is the
first instance of this llext (and on load error, it stays that way). If
not NULL, increment use count and return.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
`pm_device_runtime_get` and `pm_device_runtime_put` have returned `0`
when device runtime PM is not enabled since #56222. Manually checking
the state is no longer required.
Additionally, the functions have been able to run in an ISR context
since #60785, which removed the need to special case `k_is_in_isr()`.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Reinstate the `SHELL_UART_DEFINE` macro and moved the struct
declarations to header file, making it possible to create
another UART shell backend instance by doing
`SHELL_UART_DEFINE()` + `SHELL_DEFINE()` + `shell_init()`.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
A device can be reset before the error code list is communicated
to a LwM2M server so optionally store error list in settings so it
can restored after reset.
Signed-off-by: Nick Ward <nix.ward@gmail.com>
To avoid having "notification scheduled in 0ms" in the log,
check to verify that the delay is not K_NO_WAIT.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This adds the function that sets the available contexts value per
connection object so that API user can set different available contexts
per connection.
The lifetime of such overriden value is the same as connection lifetime,
so on reconnection or device reboot all devices return to having the
same available contexts value again.
Fixes: #64968
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes client lookup that was done with use of bt_conn_index while
the size of the client array is CONFIG_BT_MAX_PAIRED.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Disallow further changes of supported audio contexts characteristic is
the GATT Characteristic Notify Property is not set.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Enforcing the peer's behavior is not strictly necessary. All the host
should do is make sure it is resilient to a spec-violating peer.
Moreover, a growing number of platforms were disabling the check, as the
spec allows "batching" HCI num complete packets events, stalling ATT RX.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Add GDBSTUB_TRACE config option to extend GDB backend debug logging
for remote commands received and to debug the GDB stub itself.
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Add function to get a volume controller from a connection
pointer.
This is required for the CAP to get a vol_ctlr pointer
from the provided bt_conn.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This removes the fixed size bt_bap_base, which provides
2 improvements:
1) The RAM usage of the broadcast sink has been reduced.
For the Broadcast Sink sample it is a reduction of 120
octets, but with much better scaling for supporting
more or larger BASEs.
2) The functions to parse BASEs now support arbitrary sized
BASEs, where they were previously restricted by our
local Kconfig options. This allow us to parse any BASE
from a remote device, without encounting memory issues.
We are still memory restricted on the devices we
actually want to sync to.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Iterating over connection list w/o mutex lock could lead to a crash on
constant incoming packet flow. Fix this by:
1. Adding mutex lock when iterating over an active connection list, to
prevent list corruption.
2. Create a copy of the callback and user data pointers before releasing
lock, to prevent NULL pointer dereference in case connection is
released before callback is executed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Eliminate race between TCP input thread and TCP work queue, when
dereferencing connection. This normally would not manifest itself during
standard TCP operation, but could be a potential opening for abuse, when
the already closed TCP connection is kept being spammed with packets.
The test scenario involved sending multiple TCP RST packets as a
response to establishing the connection, which could result in system
crash. The following changes in the TCP stack made it stable in such
scenario:
1. Use `tcp_lock` when searching for active connections, to avoid
potential data corruption when connection is being removed when
iterating.
2. Avoid memset() during connection dereference, not to destroy mutex
associated with the connection. The connection context is only
cleared during allocation now.
3. Lock the connection mutex while releasing connection.
4. In tcp_in(), after locking the mutex, verify the connection state,
and quit early if the connection has already been dereferenced.
5. When closing connection from the TCP stack as a result of RST or
malformed packet, verify connection state to make sure it's only done
once, even if multiple RST packets were received.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Silently drop the IPv6 Neighbor Advertisement if we receive it
for an unknown neighbor or if there some some issue in the packet.
Returning error here would cause the ICMP module to print an
actual error which just pollutes the log without any apparent
benefit.
Fixes#66063
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Enable the automatic power domain management to release the domain as
many times as it was claimed, instead of only once.
This fixes the domain being permanently enabled if the supported device
is claimed more than once.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
If server registration fails, allow fallback to secondary server,
or fallback to bootstrap.
Also allow fallback to different bootstrap server.
Add API to tell RD client when server have been disabled by
executable command.
Changes to RD state machine:
* All retry logic should be handled in NETWORK_ERROR state.
* New state SERVER_DISABLED.
* Internally disable servers that reject registration
* Temporary disable server on network error.
* Clean up all "disable timers" on start.
* Select server first, then find security object for it.
* State functions return void, error handling is done using states.
* DISCONNECT event will only come when client is requested to stop.
* NETWORK_ERROR will stop engine. This is generic error for all kinds
of registration or network failures.
* BOOTSTRAP_REG_FAILURE also stops engine. This is fatal, and we cannot
recover.
Refactoring:
* Server selection logic is inside server object.
* sm_handle_timeout_state() does not require msg parameter. Unused.
* When bootstrap fail, we should NOT back off to registration.
This is a fatal error, and it stops the engine and informs application.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
React to disable executable, as well as add callback that allows
disabling server for a period of time.
Also add API that would find a next server candidate based on the
priority and server being not-disabled.
Move all server related functions into its own header.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This board have an NXP MPU with 8 configurable regions, of which five
of them are already used by the static MPU configuration. Many of
these tests are failing due to lack of MPU regions or free partition
slots available, even when HW stack protection is disabled when
building with userspace support.
Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Fixing typo from the original implementation in
44705b698c725166834f19d6fd5db2804f9a0d60, which resulted in
the name of current shell instance getting print over and over
again.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Zephyr has its own multicast join/leave API but for
interoperability, it is possible to use the multicast
socket API and IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP
socket options.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Zephyr has its own multicast join/leave API but for
interoperability, it is possible to use the multicast
socket API and IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP
socket options.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The current code triggers a false positive from the heuristic "Macro
compares unsigned to 0". It's triggered because of a use of `IN_RANGE`
that checks against the extremal values of a enum type.
This patch replaces the use of `IN_RANGE` with an explicit list of the
possible values of the enum.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/65575
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
We are creating a multicast address in mDNS or LLMNR
responder so set the TTL or hoplimit using the multicast
variant API.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>