As the loop unpacking the DNS name from records checks the current
label length on each iteration, it's also needed to update the remaining
buffer length on each iteration, otherwise the buffer length checks
doesn't work as expected.
Additionally, the remaining buffer checks while technically worked, they
were conceptually wrong and unintuitive. The buf->data pointer doesn't
move, so comparing against this pointer when adding new labels doesn't
make sense. It's more intuitive to simply compare the label size vs
the remaining buffer space.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If a thread was sleeping in poll(), monitoring POLLIN only, it should
still be notified if an asynchronous connection, triggered by
non-blocking connect(), failed. Currently that's not the case.
In result the application would never know whether the connection
was successful or not and would be stuck with a disconnected socket
that would not report anything with poll().
This was not an issue if POLLOUT was monitored as well, because POLLOUT
sets up a connect semaphore that was reset in case of errors. POLLIN
however only monitors the recv fifo, which was not waken up in such
case.
Fix this by canceling any pending waits on recv fifo and recv
condition variable.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
- BASS mandates that a remove_source operation is not done if
we are synced to PA or BIS. This PR fixes that
- Update BabbleSim tests to reflect this behavior
- Fixes BASS/SR/SPE/BI-05-C
Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
Do not enable network compatibility mode flag for network tests
so that we will get better coverage of the wrong network APIs
used.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Use the underlaying zsock_ prefixed fcntl macros instead of the
POSIX_API fcntl renames.
After d45cd6716b and this, we do not
anymore use fcntl directly but use the underlaying Zephyr APIs.
So, let's also remove this include.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The BMCA comparator ptp_btca_ds_cmp() did not follow the IEEE1588
ranking order: priority fields handled only the “greater” case, causing
valid winners to fall through to the clockIdentity tie-breaker and
resulting in incorrect grandmaster selection. This also caused the
state transition from TIME_TRANSMITTER to GRAND_MASTER to be missed.
Fixes: #99562Fixes: #99566
Signed-off-by: Peter Büchler <peter.buechler@gmail.com>
MSC BOT can work with just one buffer because buffer to receive CBW is
never queued at the same time as CSW. SCSI buffer needs to be multiple
of bulk endpoint wMaxPacketSize and therefore is suitable for handling
both CBW and CSW. Take advantage of this to reduce memory usage.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Double buffering make it possible to significantly increase the transfer
rates by avoiding idle states. With two SCSI buffers, one buffer can be
used by disk subsystem while the other is being used by UDC (ideally
with DMA).
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When endpoint enqueue fails the device has no reliable means of recovery
other than a reset. Implement 6.6.2 Internal Device Error handling on
failed enqueue.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Let's use CONFIG_NATIVE_LIBC to detect builds with the host C library
instead of pressuming that any build targetting the POSIX architecture
uses it. This has not been the case for several years now, as we can
select different C libraries when targetting the POSIX architecture.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Let's use CONFIG_NATIVE_LIBC to detect builds with the host C library
instead of pressuming that any build targetting the POSIX architecture
uses it. This has not been the case for several years now, as we can
select different C libraries when targetting the POSIX architecture.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Some CID-related symbols were prefixed but not updated in sockets_tls.c
as that configuration was not built by the tests/net/all test suite,
hence easy to miss.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Since we are using sys_getopt now we do not need to pull unistd.h
for anything amore.
Let's remove it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
sys_getopt has now its global status variables prefixed with sys_getopt_
Let's fix the use here. Note this worked as Zephyr's POSIX_C_LIB_EXT
keeps a replica of these variables without the prefix.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
sys_getopt has now its global status variables prefixed with sys_getopt_
Let's fix the use here. Note this worked as Zephyr's POSIX_C_LIB_EXT
keeps a replica of these variables without the prefix, and it is
enabled by default.
And since sys_getopt was split from POSIX_C_LIB_EXT this component
only needs to enable GETOPT and no the whole POSIX_C_LIB_EXT.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
There is no openthread_instance so the assert will always fail so
remove it to prevent compilation issue.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Refactor how receive states are handled in the BAP
shell.
The scan delegator's receive states are not available from
the broadcast sink, and the broadcast sink makes sure to
properly set the pa_sync object in the receive state
struct.
The receive states are now also using the BAP service data to
identity the receive state when using PAST.
The broadcast assistant will now cache data from a remote device,
and makes it available to e.g. CAP.
Additionally if there is a broadcast source, we cache the values
neccesary to identity if a remote receive state represents our
local broadcast source.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When using the add_src and mod_src APIs the
aggregated_bis_syncs variable was only ever set to 0
and never updated, thus making all calls to
bis_syncs_unique_or_no_pref to be true.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix the active client validation in OBEX abort operations to
handle concurrent request scenarios. The check now
ensures that if there is an active client and it's different
from the current client, the operation is rejected with -EBUSY.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
Add STATIC macro definition to conditionally expose static functions
for testing purposes. When CONFIG_ZTEST is enabled, STATIC expands
to nothing, making functions globally visible for unit tests.
Otherwise, STATIC expands to 'static' for normal builds.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
Adds functionality that allows saving a single setting to NVM using
the newly added function in the settings subsystem. This also
replaces calling the subtree save function if it the underlying
Kconfig is enabled to reduce code paths in settings mgmt
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a function that allows saving of a single setting item without
changing the value, or saving a subtree of settings, to the storage
backend
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
- Fixes bug where bis_sync_requests were wrongfully validated.
- Two BISes across subgroups should not have the same bits set
- Remove use of internal->bis_syncs before it's updated in mod_src.
Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
Since 820cd34dbb these net components
use ZVFS_EVENTFD directly instead of thru EVENTFD.
So, let's select ZVFS_EVENTFD directly instead of indirectly
thru EVENTFD.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Since Shorter Connection Intervals changes the unit that connection
intervals can be represented in. It is necessary to change how
they are stored and represented.
This commit deprecates interval in favour of interval_us.
Remove use of interval in internal bt_conn struct since it is no longer
needed.
Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
Adds support for the memory pool statistics (mpstat) command, which
will list details on various memory heaps on the device
Signed-off-by: Jamie McCrae <spam@helper3000.net>
Replaces the img_mgmt specific function with the common SMP
function for resetting the zcbor buffer and allowing a new response
to be sent
Signed-off-by: Jamie McCrae <spam@helper3000.net>
Adds a common zcbor reset buffer function, this allows for the
buffer to be reset after data has been added already to add a
different response, e.g. an error response
Signed-off-by: Jamie McCrae <spam@helper3000.net>
This commit deprecates:
- the `CONFIG_BT_SIGNING` Kconfig option
- `BT_GATT_CHRC_AUTH` property
IOW, this commit deprecates the LE Security mode 2 support.
Explanation:
Erratum ES-26047 introduced in Bluetooth Core Specification v6.2
requires SingCounter to be persistently stored to prevent replay
attacks.
Currently, the Host doesn't store SignCounter, therefore the device is
vulnerable to replay attacks after reboot.
Additionally, the current implementation doesn't assume that SignCounter
of a received message can be incremented by more than one and thus may
not validate correct message.
The Bluetooth Security and Privacy Best Practices Guide recommends to
not using Data signing and recommends to use LE Security mode 1 levels
2, 3 or 4 instead.
The Signed Write Without Response sub-procedure, which is the only user
of Data signing, is optional (see Vol 3, Part G, Table 4.1).
See also ES-18901.
The aforementioned reasons make no sense to keep this feature.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Add Cortex-A320 support to the unified FVP board structure with ARMv9.2-A
specific configuration parameters.
New board target:
- fvp_base_revc_2xaem/a320
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add ARMv9-A architecture support with Cortex-A510 CPU as the default
processor for generic ARMv9-A targets.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Commit updates maximum OOB authentication size from 8 bytes
till 32 bytes according to specification errata ES-27446.
Since previous OOB API does not allow to expose OOB values
with such width the new API has been introduced.
The previous API was deprecated and hidden under
BT_MESH_PROV_OOB_API_LEGACY option and left for backward
compatibility with existing code base.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit removes legacy dependancy on Host crypto.
Additionally, it adapts advertiser stack size if
provisioner feature has been enabled (tested with
mesh_shell and thread analyzer).
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit set zero to not used part of authentication array
to prevent garbage from the previous provisioning using.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit improves oob size checking to catch wrong size
as early as possible and prevents zero size.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Summary:
As Zephyr getopt is not really compatible with Posix getopt, rename
Zephyr getopt to sys_getopt.
Background:
Zephyr getopt module was introduced in #31356 to be used by the shell.
Zephyr's getopt is not the standard one. It has multiple APIs which make
it more suited for a system like Zephyr where different components may
want to use it for different purposes. Including APIs to init it,
get and set its internal state etc.
Several Zephyr modules (shell, net, wifi, ztest) use this getopt with
these special APIs. The getopt module is bundled in the POSIX
compatibility API subsystem (CONFIG_POSIX_C_LIB_EXT).
Problem description:
As it is not the standard getopt(), no C library can possibly provide
a Zephyr compatible version (even if such C library were to provide a
standard getopt()). As it is bundled in Zephyr's POSIX API in
CONFIG_POSIX_C_LIB_EXT), multiple components that depend on it are
selecting CONFIG_POSIX_C_LIB_EXT. Zephyr core components should not
depend on the POSIX API in this way.
Changes done in this commit:
Rename the getopt*() APIs to sys_getopt*() and move them into a module
under lib/utils with its own Kconfig option to enable it.
Zephyr's users are changed to use this new component.
The POSIX subsystem can continue providing getopt() by calling the new
sys_getopt() and in that way retain backwards compatibility for external
users.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Gives access to all log output format flag configurations
for shell backend.
shell log backend doesn't use log_backend_std_get_flags()
and it's debateable if it should, so give it its own fullly
configurable format set for maximum backend bandwidth control
Signed-off-by: Nicholas Lowell <Nicholas.Lowell@lexmark.com>
- When a bonded device is reconnected, check flags for pending
notifications for:
- Lock
- SIRK
- Size
Previously only lock was checked
Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
Compliance checker complains
TYPO_SPELLING: 'in in' may be misspelled - perhaps 'is in'?
for code like this
static struct net_sockaddr_in in_addr_my = {
so change the variable to ipv4_addr_my. Similar change is
done for IPv6 variables for consistency.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>