It is always possible to bind to same port if the sockets
are in different address family.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Turn the nested arrays of `scan_params->chan` into a single array.
This adds the requirement to specify the band for each channel, but
eliminates the large amount of dead memory for unused bands. Overall,
this saves 50% of the RAM space for this variable.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Make the maximum number of channels that can be manually scanned
configurable by the application. The previous value of 233 was vastly
overallocating memory as the largest band only contains 60 allocated
channels.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
A few attributes isn't cloned togerder with pkt.
This commit add missing part.
Additionally, because the `eof` flag in net_pkt structure is
avilable unconditionally hence `#if defined(CONFIG_NET_SOCKETS)`
guard has been removed form setter and getter functions for
this flag.
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
In net_pkt structure couple of flags are no longer used.
Flag pkt_queued can be removed permanently togeter with setter
and getter functions.
Second flag sent_or_eof has been renamed because it is still
used partially only for indicating EOF. Additionally unused setter
and getter for 'sent_' part of this flag are removed.
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
Maximize BIG event length to extend upto ISO interval, and
allow PTO and Control subevents to be pre-emptible.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Calculate Broadcast ISO event overheads due to extended and
periodic advertising events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Updates possible return errors for fs mgmt file upload, to clarify
when a provided path is on a read-only filesystem or if the mount
point does not exist.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
In spec:
The LwM2M Client MUST reject any LwM2M Server operation on
the Security Object (ID: 0) with an "4.01 Unauthorized" response
code.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
With bootstrap one function is unused. Fix by changing
ifdef to if (IS_ENABLED()) so linker can drop it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If autoinit is not enebled, it is allowed to build a few backends and
initialize a proper one in runtime.
Check number of backends only if autoinit is enabled.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
The header file contains mixture of functions and static arrays.
Replacing static arrays to functions.
Initialize functions in C file.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Fix missing Coded PHY implementation conditional compile
causing compile error when disabling Coded PHY support in
SoCs that have radio that support Coded PHY.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Revert EVENT_OVERHEAD_START_US value for Coded PHY support,
needed to pass LL/DDI/SCN/BV-21-C and LL/DDI/SCN/BV-25-C.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Reduce number of successive calls to ticker_job() by
disabling mayflies in the ULL_HIGH priority, enqueue
ticker_yield_abs() and ticker_start() before re-enabling
so that single ticker_job() handles both yield and start.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix short prepare handling when more than one event is
enqueued in the pipeline and the short prepare is placed at
the end of the prepare pipeline.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticks_slot_window use in Observer, do not use for
unreserved continuous scanning, and do not use when scanning
on both 1M and Coded PHY simultaneously.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use ticker_ticks_diff_get consistently when calculating
difference between ticker ticks when determining short
prepare requests.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use the state/role context parameter in prepare pipeline
to identify the preempt timeout that was setup.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
These change are reverted as part of fixing regression
failure in LL/DDI/SCN/BV-21-C and LL/DDI/SCN/BV-25-C.
This reverts commit 0d54ca8761.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add support for reading and writing long values (> MTU)
when using the CAP API.
This change does make it slightly slower to execute the
CAP procedures as it is now done on a one-by-one basis,
which affect multi-ACL setups, but that also means
that the buffer requirements for CAP will generally be lower.
There is still room for improvement as we can perform the BAP
operations in parallel on each ACl, which should return this to
its former performance.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove the wifi_mgmt interface overriding default values with values
from kconfig. The defaults were only applied when a `params` struct was
provided by the application.
This is the case when the application is explicitly setting the options
it wants, why is the mgmt API changing these. When `params` is NULL and
thus modem defaults are requested, these defaults aren't applied. This
is the opposite behaviour from what seems reasonable.
In addition, these options are:
* Undocumented
* Using non-trivial string parsing functions (strtok)
* Adding complexity to the API implementation by forcing support for
ROM versions of command line arguments.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add parsers to retrieve metadata values from codec
capabilities and codec configuration structs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the order of operation in
broadcast_sink_iso_disconnected so that when the application
gets the last stopped callback, the BIG has already been cleaned
up, and the broadcast sink is in a reusable state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of calling ase_release for each ASE in the ACL
disconnected callback, we now call the state_transition_work_handler
directly. This is to ensure that when the disconnected callback
returns, the bt_conn object has been properly unref'ed in
a timely manner.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Replace the BT_AUDIO_CODEC_LC3_ID macro with the
BT_HCI_CODING_FORMAT_LC3 as there is no reason to
define and use the LC3 ID different than the other
allowed codec IDs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When using BT_HCI_CODING_FORMAT_TRANSPARENT as the codec_id, the
codec configuration (cc) len sent to the controller shall be 0.
Since this goes for all devices, we ensure that we don't
send invalid codec ID and cc data over air.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the bt_bap_broadcast_source_reconfig to use the same
parameter struct as bt_bap_broadcast_source_create so that
the two are more similar, since they both set the same values.
This allow for full control of which subgroups and stream
are updated.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There was a new Kconfig for USB-C init priority that is conflicting
with currently used Kconfig for init of VBUS and TCPC.
This commit changes the names to more specific related to the subsystem
they belong to.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
This commits adds support for the SO_REUSEPORT socket option.
The implementation follows the behavior of BSD and tries to also follow
the specific additional features of linux with the following
limitations:
* SO_REUSEADDR and SO_REUSEPORT are not "the same" for client sockets,
as we do not have a trivial way so identify a socket as "client"
during binding. To get the Linux behavior, one has to use SO_REUSEPORT
with Zephyr
* No prevention of "port hijacking"
* No support for the load balancing stuff for incoming
packets/connections
There is also a new Kconfig option to control this feature, which is
enabled by default if TCP or UDP is enabled.
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
This commit adds support for the SO_REUSEADDR option to be enabled for
a socket using setsockopt(). With this option, it is possible to bind
multiple sockets to the same local IP address / port combination, when
one of the IP address is unspecified (ANY_ADDR).
The implementation strictly follows the BSD implementation and tries to
follow the Linux implementation as close as possible. However, there is
one limitation: for client sockets, the Linux implementation of
SO_REUSEADDR behaves exactly like the one for SO_REUSEPORT and enables
multiple sockets to have exactly the same specific IP address / port
combination. This behavior is not possible with this implementation, as
there is no trivial way to identify a socket to be a client socket
during the bind() call. For this behavior, one has to use the
SO_REUSEPORT option in Zephyr.
There is also a new Kconfig to control this feature similar to other
socket options: CONFIG_NET_CONTEXT_REUSEADDR. This option is enabled by
default if TCP or UDP are enabled. However, it can still be disabled
explicitly.
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
Fix the order of setting the flag that indicates that
preempt timeout has been successfully requested versus
the request is waiting to be scheduled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker implementation to prefer to keep ticker node
started in case of race condition to start and stop.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
While matching source address for a given Link-Local destination the
functions iterate over interfaces and return a first result with a
valid LL-address. However, they should first try to fetch address of
the default interface as it not always the first one on the list.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Allow Bootstrap server to close the DTLS connection immediately
after receiving Ack to Bootstrap-Finish command.
This is not an error as either parties are allowed to tear down
the connection.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Allow certain RD-client states to timeout.
As stated in LwM2M specification:
The bootstrap procedure failed when the LwM2M Client did not
receive the "Bootstrap-Finish" operation after the
EXCHANGE_LIFETIME time period expired.
The EXCHANGE_LIFETIME parameter is defined in RFC 7252
We must handle the case where Bootstrap server is not sending
information towards us.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Add state checks for the get_id and get_base functions, as the
ID and base are not valid when the state of the broadcast
source is BT_BAP_EP_STATE_IDLE.
Since the broadcast_source_get_state uses the slist functions,
the broadcast source object for bt_bap_broadcast_source_get_id
can no longer be `const`.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When publish buffer run out, no thread active process work.
Fix this, by reschedule process work.
Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
Current MQTT-SN topic and publish allocators are not thread safe.
Fix this, by using k_mem_slab instead of arrays.
Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
Releasing the lock before notifying condvar led to a race condition
between a thread calling k_condvar_wait to wait for a condition variable
and another thread signalling for this same condition variable. This
resulted in the waiting thread to stay pending and the handle to it
getting removed from the notifyq, meaning it couldn't get woken up
again.
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
When a packet can't be cloned we crash as we try to initialize the
cursor on a nullptr. We should check if we have a valid pointer,
and if we don't we drop the packet along with a warning.
Signed-off-by: Andreas Ålgård <aal@ixys.no>
In low memory conditions, its possible for socketpair memory allocation
to fail and then the socketpair is freed but after that the remote
semaphore is released causing a crash.
Fix this by freeing the socketpair after releasing the semaphore. Add a
test case to induce low memory conditions (low HEAP and high socketpair
buffer size), with the fix issue is not seen.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit optimizes the performance of the script chats by
storing the size of requests with the chat script chat, negating
the need to use strlen() within the modem_chat module every time
a chat script chat request is sent.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
This commit adds one new feature, modem_chat_run_script(),
which synchronously runs a script.
The existing function modem_chat_script_run() is async,
and doesn't follow the naming convention created for the
other modem modules, specifically, all functions are sync,
unless appended with _async.
To preserve backwards compatibility, the existing function
modem_chat_script_run() will remain until deprecated. It
simply calls modem_chat_run_script_async().
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
Intent is to pass Ellisys ISOAL quality tests for framed TX scenarios
where the TX SDU includes a time stamp that is not based on the
controller's clock.
Changes:
-- Include controller's reception time as a separate field in the TX SDU
information
-- Include decision on whether SDU time stamp is valid and based on the
controller's clock
-- Arbitrate and select / compute time stamp for the SDU
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Changes:
-- Corrected reading and writing time offset in framed segment header to
account for endianness
-- Corrected bit positioning of time offset bit field in the segment
header structure definition
-- Fixed upstream Zephyr BSIM test build failure due to debug logging
39-bit variable
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Changes:
-- Disregards target event after segmenting the first TX SDU and instead
decide event based on the next payload and feasibility to fragment
for that event (time-offset > 0)
-- Corrected error SDU release logic when an error occurs while
expecting the start of a new SDU, to avoid releasing an SDU which
could be received in the next payload or event
-- Included additional debug logging
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Revert back the EVENT_OVERHEAD_END_US value to original
value in initial commit 5c3709c13f ("bluetooth:
controller: Add def's re. update to slot reservation calc").
40 us is a sufficient margin considering ~30 us being the
worst case Rx chain delay for S8 Coded PHY on nRF5x SoCs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rather than yielding to idle thread, keep the part awake.
So debugger can still access it,
since some SOCs cannot be debugged in low power states.
Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
This adds support for the Upload OOB Start message to the DFD server, by
providing callbacks that the application can use to hook any OOB scheme
into the model behavior.
There are also extensive changes to the dfu_slot module, to accomodate
the new needs that appeared with the support for OOB transfer (mainly,
fwid, size and metadata are no longer available when the slot is
allocated, they appear later in the handling).
Signed-off-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
All WiFi channel numbers fit within a 8 bit number, as the maximum
allocated channel is 233. This halves the memory requirement.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
The errors are printed in hex, but no prefix was used. This could be
confused with usual errno return values. The 0x prefix makes clear
that it's a hex value.
Also a missing minus sign is added to one log message.
Signed-off-by: Martin Jäger <martin@libre.solar>
NET_STATISTICS_PPP are dependend on NET_L2_PPP, not on NET_PPP.
This allows to use statistics also in modem subsys.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
Add check for device busy when CONFIG_PM_NEED_ALL_DEVICES_IDLE is
set to y because one or more devices may still in busy and causes
problem when system go into low power in Intel ISH platform.
Signed-off-by: Leifu Zhao <leifu.zhao@intel.com>
Usage of application level for device drivers needs to be avoided. Also
introduced a new init level, with default to 90 as other dependencies of
USB-C run at priority 80.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Convert the driver to a dt-based device. Also update Kconfig so that it
depends on the right compatible being enabled, initialize in POST_KERNEL
(APPLICATION should not be used for devices) and remove one redundant
include.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
The device model was not used for anything useful, only to call some
init code. Change to SYS_INIT instead.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This is the final step in making the `zephyr,memory-attr` property
actually useful.
The problem with the current implementation is that `zephyr,memory-attr`
is an enum type, this is making very difficult to use that to actually
describe the memory capabilities. The solution proposed in this PR is to
use the `zephyr,memory-attr` property as an OR-ed bitmask of memory
attributes.
With the change proposed in this PR it is possible in the DeviceTree to
mark the memory regions with a bitmask of attributes by using the
`zephyr,memory-attr` property. This property and the related memory
region can then be retrieved at run-time by leveraging a provided helper
library or the usual DT helpers.
The set of general attributes that can be specified in the property are
defined and explained in
`include/zephyr/dt-bindings/memory-attr/memory-attr.h` (the list can be
extended when needed).
For example, to mark a memory region in the DeviceTree as volatile,
non-cacheable, out-of-order:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_VOLATILE |
DT_MEM_NON_CACHEABLE |
DT_MEM_OOO )>;
};
The `zephyr,memory-attr` property can also be used to set
architecture-specific custom attributes that can be interpreted at run
time. This is leveraged, among other things, to create MPU regions out
of DeviceTree defined memory regions on ARM, for example:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-region = "NOCACHE_REGION";
zephyr,memory-attr = <( DT_ARM_MPU(ATTR_MPU_RAM_NOCACHE) )>;
};
See `include/zephyr/dt-bindings/memory-attr/memory-attr-mpu.h` to see
how an architecture can define its own special memory attributes (in
this case ARM MPU).
The property can also be used to set custom software-specific
attributes. For example we can think of marking a memory region as
available to be used for memory allocation (not yet implemented):
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_NON_CACHEABLE |
DT_MEM_SW_ALLOCATABLE )>;
};
Or maybe we can leverage the property to specify some alignment
requirements for the region:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_CACHEABLE |
DT_MEM_SW_ALIGN(32) )>;
};
The conventional and recommended way to deal and manage with memory
regions marked with attributes is by using the provided `mem-attr`
helper library by enabling `CONFIG_MEM_ATTR` (or by using the usual DT
helpers).
When this option is enabled the list of memory regions and their
attributes are compiled in a user-accessible array and a set of
functions is made available that can be used to query, probe and act on
regions and attributes, see `include/zephyr/mem_mgmt/mem_attr.h`
Note that the `zephyr,memory-attr` property is only a descriptive
property of the capabilities of the associated memory region, but it
does not result in any actual setting for the memory to be set. The
user, code or subsystem willing to use this information to do some work
(for example creating an MPU region out of the property) must use either
the provided `mem-attr` library or the usual DeviceTree helpers to
perform the required work / setting.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Fix missing lazy calculation when using ticker interface
required for Central CIS create.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix initialization of CIS lazy_active event count used when
first CIS event is active. Now initialization for first and
any subsequent CISes made active.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Reduce the max timeout for shell to 1 second.
Change the sip_svc open shell function to take millisecond as timeout
argument.
Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
This PR makes the modem_pipe instances track if they have
data ready to receive, and invoke the RECEIVE_READY event
every time they are attached if the backend implementing
the pipe has notified that receive is ready.
This mechanism ensures that modules attaching to a pipe
get the async RECEIVE_READY event immediately after
attaching to a pipe if there is data ready, instead of
having to poll the pipe, or worse, wait until newer data
becomes available.
The addition revealed a timing issue in the cmux test
suite. Specifically the CMUX instance now immediately
receives the response to a command which the CMUX
instance has not sent yet, causing it to drop the
response.
The CMUX test suite now uses the transaction
mechanism of the mock_pipe to wait for the command
before sending the response.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
This patch amends the existing L2CAP accept callbacks to use the new
accept signature that includes a pointer to the L2CAP server structure.
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
Add a pointer to the associated server structure in the L2CAP accept()
callback. This allows the callee to know which server an incoming L2CAP
connection is associated with.
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
The bt_conn_exists_le is commonly hit by users attempting
to connect (either as central or peripheral) to a device
they are already connected to in some way. The current log statement
does not provide particularly much information, so added more.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix some compiler instruction re-ordering. Mayfly code with
cpu_dmb() help avoid stalled memq_ull_rx processing when
rx_demux is to be executed using mayfly.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
ISO-TP CAN-FD support can be enabled at runtime.
Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
Signed-off-by: Martin Jäger <martin@libre.solar>
SWO reference frequency was set based on `swo-ref-frequency` under `itm`
nodelabel or `/cpus/cpu@0/clock-frequency` property. Not all platforms
configure those.
All ST devices configure CPU frequency in `clock-frequency` under `rcc`
nodelabel. Configuring the same value for each board in
`/cpus/cpu@0/clock-frequency` would be one way to make SWO work out of the
box. There is lots of copy-pasting involved in this, which makes this very
error-prone.
Introduce Kconfig option, which will default to values configured in `itm`
or `/cpus/cpu@0`. The main advantage will be for platforms like ST, where
CPU clock frequency is already configured in another place. Thsoe could
override default value in SoC, board or any other platform specific layer.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
The current implementation uses both, host and card capabilites to derive
the maximum bus width to be used. However, in cases where a MMC device is
not connected to the host via shdc using the full bus width of 8 lines,
device initialization fails. Introducing the `bus-width` property
circumvents this by reducing the host bus capabilites and forcing
communication with the MMC device using 1, 4 or 8 lines.
Signed-off-by: Mourad Kharrazi <mourad.kharrazi@ithinx.io>
This change brings in support for setting various Wi-Fi modes and
enables a specific Wi-Fi interface to be also placed into a sniffer
operation via monitor mode and promiscuous mode. A raw TX- packet
Injection mode is also introduced
Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
Even though the OOB information is optional we can add it
to extended scan reports in cases there is detected unprovisoned
devices.
Referring to MshPRT section 4.4.5.3:
When the Remote Provisioning Extended Scan procedure completes without
receiving an advertisement from the unprovisioned device, the
OOBInformation and AdvStructures fields shall be skipped. When the
obtained data is empty, the AdvStructures field shall be skipped. The
Status field shall be set to Success.
and referring to MshPRT section 4.3.4.9:
The OOBInformation field contains the OOB Information of either the
unprovisioned device or the Remote Provisioning Server.
Signed-off-by: Alperen Şener <alperen.sener@nordicsemi.no>
This adds support to allow any priority from the user instead of
limiting to the protocol values (0-7). This is useful in conveying
custom priorities from application to the driver/chipset.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This is handy in testing of setting priority directly rather than
deriving from DSCP. Please note ICMP doesn't use net context.
This is applicable for both shell and API.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This is a private kernel header with private kernel APIs, it should not
be exposed in the public zephyr include directory.
Once sample remains to be fixed (metairq_dispatch), which currently uses
private APIs from that header, it should not be the case.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit adds the DFM (DevAlert target side code) module and
moves the TraceRecorder module into the percepio module, which
results in the TraceRecorder module definition being removed
from the west manufest and module definition within zephyr.
Signed-off-by: Aron Lander <aron.lander@percepio.com>
This commit adds support for partial matches for the modem_chat
module. A match is a combination of an expected response to a
request along with delimiters to use and a handler for the
parsed response.
The usual behavior of the modem_chat script is to continue to
the next step when any expected response is received. The partial
flag indicates that the script should not proceed to the next
step if the response matches the match. This is useful for
commands which respond with an unspecified number of lines,
followed by an "OK". This flag allows the script to essentially
run in a "while" loop until OK is received.
Along with this addition, a more scalable macro for initializing
the modem_chat match struct, MODEM_CHAT_MATCH_INITIALIZER().
Without this macro, we will need 4 different macros to initialize
the 4 variants of a chat_match, and 8 when the next feature is
added...
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
The ICMSG backend now has a dedicated workqueue to process incoming IPC
messages. The system workqueue is no longer utilized for that purpose.
Testing shows that in certain scenarios substituting a RPMsg backend
with ICMsg results in deadlocks.
The deadlocks were a symptom of running a synchronous RPC protocol from
the context of the system workqueue and transpired as follows:
1. The RPC protocol sends a request over the ICMsg backend on the system
workqueue thread.
2. The RPC protocol puts the thread to sleep until response is received.
This puts the system workqueue thread to sleep.
3. The response to the request arrives over ICMsg backend.
4. The backend signals a work item to the system workqueue.
5. The system workqueue is unable to process the response due to being
previously pended on the RPC request.
The deadlock was initially observed with the nrf-802154 driver in
conjuntion with the IPv6 stack.
To prevent this condition from occurring, the approach was selected to
give ICMsg a dedicated workqueue thread.
Added a Kconfig option that enables the dedicated workqueue by default.
The config can be disabled, if the user wants to preserve RAM capacity
and is certain that the deadlock condition is not encountered.
Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
wifi_utils_parse_scan_ssids could cause a crash if a constant string is
passed to it. Fix this by duplicating the input string parameter before
parsing it with strtok_r.
Also limit the range of the CONFIG_WIFI_SCAN_SSID_FILT_MAX parameter
from 1 to 4 to avoid stack overflow due to users specifying a large
value for this parameter.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
wifi_utils_parse_scan_bands could cause a crash if a constant string is
passed to it. Fix this by duplicating the input string parameter before
parsing it with strtok_r.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Stores persistent on-demand private GATT proxy state in separate
settings entry. This is implemented to avoid issues related to
backwards compatibility between device firmware updates.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Stores persistent private beacon state in separate settings entry.
This is implemented to avoid issues related to backwards compatibility
between device firmware updates.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Makes the long workqueue init priority configurable and sets
the default to 50, this is to allow for relocating bluetooth
libraries to other parts of memory e.g. external flash, and
allows for those flash drivers to be initialised prior to
calling functions residing in them.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit delegates the modem_pipe_notify_closed() call
resulting from the UART async API UART_RX_DISABLED event
to the workqueue. This is neccesary as the async UART
callback may be called from ISR context.
modem_pipe_notify_closed() must be called from outside of
the ISR context as it takes a mutex.
The commit also adds a missing break to the async UART
callback, and adds a missing dependency to the Kconfig
for the UART backends, RING_BUFFER=y
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
The variables are usually placed into an output region located in FLASH
memory when linking, but the variables are not marked `const`, so the
section ends up with `W` writeable section flag:
```bash
❯ arm-zephyr-eabi-readelf --section-headers build/zephyr/zephyr.elf | \
grep -E '(Section Headers:)|( \[Nr\])|(zephyr_dbg_info)'
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[10] zephyr_dbg_info PROGBITS 60012298 01238c 000040 00 WA 0 0 4
```
Set them as const to set the output section to read-only:
```bash
❯ arm-zephyr-eabi-readelf --section-headers build/zephyr/zephyr.elf | \
grep -E '(Section Headers:)|( \[Nr\])|(zephyr_dbg_info)'
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[10] zephyr_dbg_info PROGBITS 60012298 01238c 000040 00 A 0 0 4
```
Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
cur_inst is the copy of ots_client instance to prevent duplicate
API call while client is in middle of read/write procedure.
But cur_inst can only be cleared while write_obj_tx_done or read rx_done.
If ACL is disconnected while read/write is on-going, there is no chance
for cur_inst being cleared.
This causes ots client will no longer perform select/read/write
procedure anymore. API will always return -EBUSY.
Let l2cap_disconnect check if cur_inst is NULL and NULL it
unconditionally as what it is designed.
Make bt_ots_client_unregister public API.
Signed-off-by: Pirun Lee <pirun.lee@nordicsemi.no>
This adds endpoint by stream lookup function used to find the active
endpoints that use the stream object provided. The function is used
instead of dereferencing stream->ep that may be not valid if application
did not memset the stream object.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Once the application bt_bap_stream_ops.released callback is called make
sure the stream->ep pointer is valid so that application can still access
the endpoint details like e.g. endpoint direction.
Fixes: ASCS/SR/ACP/BV-{24,25,26,27,28,29,30,31}-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
When using the LC3 codec, the cid and vid fields of the
codec shall both be 0x00, as per the BAP and ASCS specs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a network configuration option to configure whether IEEE 802.15.4
packets are expected to be ACKed or not.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
In the IEEE 802.15.4 area certain settings must be set before
net_if_up() may be called (e.g. the channel).
Also net_if_up() may not be called if
CONFIG_IEEE802154_NET_IF_NO_AUTO_START=y.
This fixes the set-up order and handling of
CONFIG_IEEE802154_NET_IF_NO_AUTO_START.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Use the HAL event clear functions to clear EVENTS
instead of accessing the registers directly.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Use the HAL event clear function to clear the RTC EVENT
instead of accessing the register directly.
This allows using an updated version of the RTC HW models
which generate level interrupts (as the real HW) and in
which if the EVEN register is not properly cleared,
the interrupts are kept high, resulting in the interrupt
handler reentering immediately after exiting.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The command was missing a metalen check, and attempted
to access array of size 0, which could give a build
warning.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds support for composition data page 2 & 130.
In this implementation the responsibillity for filling the page 2
buffer is left to the application through the new comp page 2 cb API.
Only the application can know/decide if the device is NLC compliant,
and must thus be given the responsibillity for cheking the NLC profile
requirements, defined in the NLC specs, and filling the response buffer
for comp data page 2.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
If the central disconnects a CIS while it is being
established, then we receive both a CIS established event
with BT_HCI_ERR_OP_CANCELLED_BY_HOST and a disconnect complete
event.
In this case we should not call bt_iso_disconnected in the
CIS established event handler, as that will also be
called from the disconnect complete event handler.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
As per the core spec, the CIS is not allowed to disconnect
a CIS if it is pending (i.e. in the connecting state).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
So far only object tracing/tracking could be individually disabled (e.g.
CONFIG_TRACING_SEMAPHORE=n). Now tracing of any API may be disabled
(e.g. CONFIG_TRACING_PM=n).
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The CIS Central uses the algorithm described in BT Core 5.4 Vol 6,
Part G, Section 2.2 to calculate the Max_PDU value for framed mode.
However, HAP needs the Max_PDU to be calculated according to "Core
enhancement for ISOAL CR" coming with the "Atlanta" update. With this
update, the fragmentation is controlled via a parameter at CIG creation.
Enabling CONFIG_BT_CTLR_CONN_ISO_AVOID_SEGMENTATION will set the
ISO_Interval to 7.5 ms for a 10 ms framed CIG, and calculate Max_PDU to
45/65 for 16/24 kHz.
Signed-off-by: Morten Priess <mtpr@oticon.com>
In case RST packet is received or malformed packet is received, the TCP
should not proceed with the state machine execution (which may process
the invalid packet) but rather jump directly to exit, where the
connection will be closed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The net_mgmt subsystem offers a function which waits (blocks)
until a specified net event occurs. An event callback is
pushed to the stack, then added to the net_mgmt_event_callback
list. If the event occurs, the net_mgmt thread calls the
callback and deletes the callback from the list. However, if
the event does not occur within the timeout specified when
invoking mgmt_event_wait_call() the function will return,
corrupting the callback structure the stack is reused.
This PR fixes the issue by deleting the callback before exiting
in case the event does not occur.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
The previous design with dedicated bits in the structure required a
user to explicitly set each bit.
Using one flags variable allows to extend the features more easily
in the future and avoids breaking existing code.
This change is particularly useful for the FDF and BRS flags required
for CAN-FD support.
See also previous similar change for the CAN driver in
f8a88cdb27
Signed-off-by: Martin Jäger <martin@libre.solar>
CAP requires setting the streaming context in the metadata,
which requires 4 octets of metadata, so the metadata for
CAP must be greater than or equal to 4.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In default_get_timestamp(), sys_clock_tick_get() is returned when
CONFIG_LOG_TIMESTAMP_64BIT=y. The timestamp frequency should reflect this.
Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
According to the mesh 1.1 spec, section 4.4.14.1: “. The access layer
security on the On-Demand Private Proxy Client model shall use the
device key of the node supporting the On-Demand Private Proxy
Server model.“
This commit alters the API and implementation to reflect this.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
The backend currently returns the pipe closed event immediately
after calling uart_rx_disable() which is not the correct behavior.
the pipe closed event should be called when the UART_RX_DISABLED
event is raised by the UART driver.
With this fix, back-to-back open/close/open... will work as
expected, where before the second open would often fail since
the UART was not actually disabled yet.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
Remove ifdef around `srcs` and let linker exclude it when Opcode
Aggregator Client model is not enabled.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If the bonding information has been cleared before pairing had a chance
to complete (probably by the application), indicate this by setting an
appropriate log message.
Also check that keys exist before calling `bt_keys_store`.
Fixes#59788 and #61465
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This fixes bt_audio_codec_cfg_get_chan_allocation_val return value that
shall be 0 in case of success.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes data pointer that was never set because wrong pointer
assignment.
It's regression introduced in:
b4af917ad0
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Use NRF_CCM HEADERMASK register to use correct Additional
Authentication Data (AAD) from ISO PDU header.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix an issue in the CCC configuration when the Peripheral device
maintains two or more distinct connections on different identities
with the same peer. The issue occurs when the local device performs
the pairing and the bonding procedure on a connection associated
with one of the Bluetooth identities. During the identity resolution,
the peer address field in the CCC descriptor is converted from the
RPA-type address to the Identity Address. However, the destination
address on the remaining connection objects associated with other
Bluetooth identities is not converted. Due to this, their CCC
configuration is reset and GATT indications and notification fail
to be sent even if the Central device subscribed to them.
Added necessary code to iterate over all connection objects during
the identity resolution phase and aligned their destination address
from the RPA-type to the Identity Address.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Fix timestamp calculation to use CIS reference anchor point
instead of incorrectly used CIG reference anchor point.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
NVS lookup cache currently uses CRC8/16 as a hash function
to determine the cache position, which is not ideal choice.
For example, when NVS lookup cache size is 512 and 256
subsequent NVS IDs are written (that is, 0, 1.., 255), this
results in 128 cache collisions.
It is better to use a dedicated integer hash function. This
PR uses one of the 16-bit integer hash functions discovered
with https://github.com/skeeto/hash-prospector project. The
hash function was additionally tested in the context of NVS
lookup cache using simple NVS ID allocation patterns as well
as using real device NVS dump.
Also, add a test case to verify that the hash function is
not extremely bad.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
Add TI VIM (Vectored Interrupt Manager) interrupt controller support.
VIM is a TI specific custom interrupt controller for ARM cores.
In J721E soc, VIM aggregates interrupts to Cortex R5 cores.
TRM for J721e https://www.ti.com/lit/zip/spruil1
File: spruil1c.pdf
VIM: section 6.3.3.6
Signed-off-by: Prashanth S <slpp95prashanth@yahoo.com>
Modify the signature of the k_mem_slab_free() function with a new one,
replacing the old void **mem with void *mem as a parameter.
The following function:
void k_mem_slab_free(struct k_mem_slab *slab, void **mem);
has the wrong signature. mem is only used as a regular pointer, so there
is no need to use a double-pointer. The correct signature should be:
void k_mem_slab_free(struct k_mem_slab *slab, void *mem);
The issue with the current signature, although functional, is that it is
extremely confusing. I myself, a veteran Zephyr developer, was confused
by this parameter when looking at it recently.
All in-tree uses of the function have been adapted.
Fixes#61888.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Modify when the BT_BAP_EP_STATE_ENABLING state is set during
bt_bap_broadcast_source_start.
The reason why the state is now set before the call to
bt_iso_big_create, is to handle the case where the BIG
created event actually happens and is handled (by another
thread) faster than the state change is done, which could
cause an invalid state check if the streaming state is
attempted to be set before the enabling state.
Since the events from the controller may be handled by a
different thread, we should not assume that this function returns
before the event is handled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The application gets notified about both valid and invalid data.
As data arrives every SDU interval, we would like to only print the
valid data to avoid the shell being flooded with logs.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
For flash device, littlefs should be located at the partition.
Current implementation of the fs shell is hardcoded for the flash device
and the compilation fails if STORAGE_PARTITION isn't defined in the
device tree.
Add options for block dev support. This allows to mount littlefs on the
block device from the shell, and also removes the compile time
dependency on STORAGE_PARTITION, if CONFIG_FS_LITTLEFS_BLK_DEV is set.
Fix mounting of littlefs blk device. lfs_mount stucks in case when the
read/prog buffer less than SDMMC block size, because it can cause memory
corrupt, for example, look into function 'card_read_blocks' how it writes
data to read buffer in case when buffer isn't aligned. With default
config we have 32 bytes in the read buffer but trying to write
'block_size' to it and get memory corrupt, the same issue will be in
case when the read buffer is aligned.
This is an incremental improvement, ideally, someone should implement
selection of the storage dev from the shell args.
Co-authored-by: Mykola Kvach <mykola_kvach@epam.com>
Signed-off-by: Dmytro Semenets <dmytro_semenets@epam.com>
This utility header was accessing directly the interrupt
controller HW models, but those are not an interface one
can expect to not change, or to be avaliable in different
targets.
Instead we change it to use the APIs we have a contract
about, that is, the ones all POSIX arch boards are
expected to provide.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Rename BT_AUDIO_CODEC_QOS_[UN]FRAMED to
BT_AUDIO_CODEC_QOS_FRAMING_[UN]FRAMED and give a name
to the enum, which is then used by the
struct bt_audio_codec_qos.
The rename was needed as we had a codec_qos initializer of the
same name, so the values were renamed to avoid duplicated
macro names.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If network interface name support is enabled, print the name
when showing network interface data.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure we use the network interface name (if configured)
instead of device name when binding to certain network
interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If CONFIG_NET_INTERFACE_NAME is enabled (default is y), then
system will automatically set a user friendly name to the network
interface like eth0, wlan0 etc.
Application can change the interface name if needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Fix few mismatched CONTAINER_OF, few missing pointers to the first
element, one explicit casting.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add option to prefix log message with thread ID or thread name.
Align tests and add test case to the log_output test.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Add Kconfig LOG_THREAD_ID_PREFIX option which allows storing
thread id in the log message and process it as message prefix
(as id or thread name).
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Fix incorrect use of Max_SDU_Size and SDU_Interval parameters in
ISO Transmit Test Mode code.
Fixes EBQ test LL/CIS/PER/BV-08-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
This changes bt_audio_codec_cfg_get_val function to return the data
length found. Otherwise, this function gives no information about the
returned data length.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Fix few mismatched CONTAINER_OF, one missing k_work_delayable_from_work
and few that should be pointing at the first elemnet.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The twt and ps helper functions were not namespaced (were missing
wifi_ prefix).
Also change wifi_get_twt_... to more logical wifi_twt_get...
like the other twt prefixed functions and wifi_get_ps... to
wifi_ps_get... like the other ps prefixed functions.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Clean up sizes of some SD data fields, as the max value of these fields
is limited by the SD specification
Specifically, the limits are as follows:
num_io: 0-7, 3 bits (SDIO only)
relative_addr: 16 bits (SDMMC/MMC)
block_size: 12 bits (Max of 2KB, uint16_t used)
sd_version: 8 bits (currently at version 3)
card_speed: 8 bits (could potentially be reduced in size)
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Makes img_mgmt_slot_to_image image number independent and moves
it to header file as static inline.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The erase logic has been switched to using img_mgmt_get_opposite_slot
and the img_mgmt_get_other_slot has been removed.
The commit adds CONFIG_MCUMGR_GRP_IMG_ALLOW_ERASE_PENDING Kconfig
options, default set to n, that allows to make pending slot
erasable. The option only allows erase on pending slot that
is not revert slot.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Make img_mgmt_active_slot independent from
CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER for MCUboot swap type
algorithms.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit modifies image list command operations to use
img_mgmt_get_next_boot_slot instead of directly relying of
MCUboot flags.
The function is now used, also, by img_mgmt_slot_in_use to
figure out whether queried slot is in use.
The commit introduces two new Kconfig options
MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_SECONDARY
MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_ANY
that allow users to enable confirming non-active images slots.
The MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_SECONDARY is y
by default to keep original behavior of logic that accidentally
allowed confirming secondary slot.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds functions:
img_mgmt_get_next_boot_slot
img_mgmt_get_opposite_slot
to simplify obtaining information on next boot slot.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Added optional support for read ISO link quality command.
Added link quality member in struct ll_iso_stream_hdr.
Signed-off-by: Mads Winther-Jensen <mdwt@demant.com>
If there are duplicate handles the Controller shall return the
error code Invalid HCI Command Parameters (0x12)
Fixes a failure in the EBQ test LE/AdvExt/Req-01 (part of the Ellisys
quality test suite)
Signed-off-by: Troels Nilsson <trnn@demant.com>
currently when no enough memory is found a (1 << (-1)) value is returned
instead of 0.
Fix this by returning 0 and simplify log2 computation
Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
Fixes some incorrect assertions in ull_adv.c on connection establishment
Note that the usual checks using adv->lll.conn doesn't work here,
since ull_periph_setup() NULLs the lll's conn structure pointer
before stopping the ticker
Signed-off-by: Troels Nilsson <trnn@demant.com>
This PR adds the following modem modules to the subsys/modem
folder:
- chat: Light implementation of the Linux chat program, used to
send and receive text based commands statically created
scripts.
- cmux: Implementation of the CMUX protocol
- pipe: Thread-safe async data-in/data-out binding layer between
modem modules.
- ppp: Implementation of the PPP protocol, binding the Zephyr PPP
L2 stack with the data-in/data-out pipe.
These modules use the abstract pipes to communicate between each
other. To bind them with the hardware, the following backends
are provided:
- TTY: modem pipe <-> POSIX TTY file
- UART: modem pipe <-> UART, async and ISR APIs supported
The backends are used to abstract away the physical layer, UART,
TTY, IPC, I2C, SPI etc, to a modem modules friendly pipe.
Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
Ensure card CSD and CID variables are initialized in sd_ops functions
for reading card CSD and CID data.
Fixes#59562
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add TLS_DTLS_CID socket option, which enables to use the Connection ID
extension for the DTLS session.
The option provides control of the use of CID with the `setsockopt()`
function. The value provided can disable, enable, and control whether to
provide a CID to the peer. It uses a random self CID (if told to provide
one to the peer) unless TLS_DTLS_CID_VALUE set previously.
Add TLS_DTLS_CID_VALUE to get or set the CID sent to the peer, if any.
Add TLS_DTLS_PEER_CID_VALUE to get the CID value provided by the peer,
if any.
Add TLS_DTLS_CID_STATUS to determine if CID used, and whether
bidirectional or one way.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
bt_l2cap_chan_send_sdu previously returned the number of bytes sent
in the last sent sdu buf fragment or 0 if the buf has only
one fragment. bt_l2cap_chan_send_sdu now returns the total data
bytes sent from the buf.
Signed-off-by: Tom Finet <tom.codeninja@gmail.com>
Fix a bunch of mismatched CONTAINER_OF, few missing
k_work_delayable_from_work conversions but also many
bt_l2cap_le_chan/bt_l2cap_chan and few others.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
rp_enc_state_wait_ltk_reply() is executed in thread context, so
it is not allowed to move the encryption state machine forward.
Defer LTK reply handling to next prepare event by introducing a continue
state.
Update the unit test to reflect this, and remove the TODO that actually
said there was an issue in the first place.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
Fix few mismatched CONTAINER_OF, few missing k_work_delayable_from_work
and a missing reference to the array first element.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Prevent compiler optimizations from changing the order of assignments in
the ticker API transactions. This could cause lost operation requests
and unexpected behavior under certain race conditions.
Signed-off-by: Morten Priess <mtpr@oticon.com>
There were a few issues in the way that PACS handled notifying:
1) A couple of dangling pointers (fixed by declaring some
`static const struct bt_uuid`
2) Some wrong Kconfig guards were used
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The use of private APIs z_add_timeout() and friends is not recommended.
With this commit, usual kernel timer APIs are used.
Fixes#61738
Signed-off-by: Martin Jäger <martin@libre.solar>
The connectivity monitoring subfeature of conn_mgr is currently also
named conn_mgr, which is confusing.
This commit renames it to conn_mgr_monitor, or conn_mgr_mon for short,
for clarity.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Add a helper allowing connectivity implementations to more easily access
connectivity flags on connectivity bindings.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Adds conn_mgr_binding_lock/conn_mgr_binding_unlock, which connectivity
implementations can call to lock or unlock the passed in connectivity
binding.
This allows connectivity implementations to safely make direct accesses
to binding data from outside conn_mgr_conn_api callbacks, and should
allow cleaner, more robust connectivity implementations to be written.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Splits many definitions from conn_mgr_connectivity.h off into their own
header, conn_mgr_connectivity_impl.h
conn_mgr_connectivity.h now focuses solely on user/application-facing
APIs, and conn_mgr_connectivity_impl now contains all functions, utils,
definitions intended for use by connectivity implementations, including
conn_mgr_if_get_binding, which is now available for use by connectivity
implementations.
This lays the foundation for allowing connectivity implementations
easier and safer access to their internal state through internal APIs.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Adds a target RPA known unknown cache; it fulfills a similar function
to the existing peer RPA cache, used for scanning of directed
advertisements
Signed-off-by: Troels Nilsson <trnn@demant.com>
According to mesh 1.1 spec (4.4.1.2.2 Composition Data state):
“If the complete list of models does not fit in the Data field, the
element shall not be reported.“
The implementation of bt_mesh_comp_data_get_page_1 does
not consider this, and further it will assert the device if the passed
buffer is to small.
This commit adds a check that prevents populating passed buffer
if the full element entry wont fit in the buffer.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Remove the qos field from
bt_cap_unicast_audio_start_stream_param as it was not used.
The QOS values are set when creating the unicast group,
and not when starting the streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
ZBus stores observers in two ways: statically using a list and dynamically
using a memory slab. Both present limitations. Static observers work only
for channel definition. The dynamic observers rely on a memory slab that
forces the user to manage its size to avoid issues with adding
observers. This commit fixes the static allocation problem by using the
iterable sections for allocating observation data and replacing the VDED
execution sequence since now it is possible to prioritize static observer
execution. All the runtime observers are dynamically allocated on the heap
instead of a specific memory pool.
BREAK changes (only internal, not APIs):
* ZBus channel metadata changed. Remove the observers' static array
pointer. Rename the `runtime_observers` pointer to `observers`. Add
`observer_start_idx` and `observer_end_idx`;
* Change the VDED execution sequence. The position (on definition time),
the priority in conjunction with the lexical order, is considered for
static post-definition time observers. At last, the runtime observer
follows the adding sequence;
* Replace the `CONFIG_ZBUS_RUNTIME_OBSERVERS_POOL_SIZE` with
`CONFIG_ZBUS_RUNTIME_OBSERVERS`.
New APIs:
* New iterable section iterators (for channels and observers) can now
receive a user_data pointer to keep context between the function calls;
* New `ZBUS_LISTENER_DEFINE_WITH_ENABLE(_name, _cb, _enable)` and
`ZBUS_SUBSCRIBER_DEFINE_WITH_ENABLE(_name, _queue_size, enable)` that
enable developers define disabled observers. They need to be enabled
during runtime to receive notifications from the bus;
* `ZBUS_CHAN_ADD_OBS` macro for adding post-definition static observers of
a channel.
Important changes:
* Move the ZBus LD file content to the `common-ram.ld` LD file. That was
necessary to make ZBus compatible with some Xtensa and RISCV boards.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Drop few redeclared variables, fixes some:
settings_mgmt.c:454:30: error: declaration of ok shadows a previous
local [-Werror=shadow]
454 | bool ok;
| ^~
settings_mgmt.c:436:14: note: shadowed declaration is here
436 | bool ok = true;
| ^~
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Refactor the bt_audio_codec_cfg to use flat arrays to store
metadata and codec specific configurations.
The purpose of this is to make it easier to copy the data
between layers, but also to support non-LTV data for non-LC3
codec configurations.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added a BSIM tests for PACS notification functionality. This test
tests that all optional notifies are working, as well as verifying
that a disconnected subscribed client will be notified on reconnect.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
This fix allows PACS to notify bonded clients, that were disconnected
when a characteristic with notify property was changed, are being
reconnected.
This fix also implements a defer work so to not block the bt rx
thread during auth callbacks. All other notify calls are for
consistency and style also moved to use the defer work.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Added Kconfig options to make the various PACS characteristics that are
optionally notifiable selectable as notifiable. Selecting a
characteristic as notifiable will make it so for all pacs instance on
the device.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Add a a new source coverage for native builds
and new kconfig choice of COVERAGE mode to select which:
* COVERAGE_NATIVE_GCOV: what we had until now with native builds
* COVERAGE_NATIVE_SOURCE: a new LLVM source coverage mode
* COVERAGE_GCOV: the old COVERAGE_GCOV (embedded gcov data generation).
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Fix few instances of delayable work handlers using the k_work pointer
directly in a CONTAINER_OF pointing to a k_work_delayable.
This is harmless since the k_work is the first element in
k_work_delayable, but using k_work_delayable_from_work is the right way
of handling it.
Change a couple of explicit CONTAINER_OF doing the same work as the
macro in the process.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This change allows to register additional handlers for ICMPv6 so the
user can handle some of the messages between they are handled by the
ICMPv6 module in Zephyr by returning NET_CONTINUE.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
There was a corner case which was not handled well in a scenario, when
listening socket was closed during an active handshake with a new
client.
When a listening socket is closed, the accept callback is cleared on the
TCP context. If this happened during a handshake with a new client, i.
e. before final ACK from the client was processed, this lead to a
context leak, as application did not take ownership of the connection
(i. e. had no means to close it).
Fix this, by proactively closing the connection at the TCP level when no
accept_cb is available. Instead of ignoring the fact that no accept_cb
is available, the TCP stack will now enter TCP_FIN_WAIT_1 state and
proceed with a graceful teardown of the connection.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
getsockname() did not work properly on bound sockets, as it verified
whether the socket has an active connection before retuning result. This
is not correct, as socket after bound may not have a connection yet.
Fix this, by verifying that local_addr on an underlying net_context is
set, to determine whether socket has a local address assigned, before
returning result.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This adds SoC and board configs to support the dc233c core
that is available on QEMU. This core has more features than
sample_controller, such as MMU support.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
* Renamed 'coap_client_init_path_options' to
'coap_packet_set_path'
* Moved into 'coap.c'
* The function is public now
Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
Fix options initialization for path and query
when a final segment is one character long.
For example, "a/b" inits path as ["a"] instead
of expected ["a", "b"]. The same applies to
query option. The "a/abc?a&b" options won't
contain "b".
Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
Adds a settings management group to MCUmgr which allows for
manipulation of the zephyr settings from a remote device.
Includes callback hooks to secure access from an application.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
net_iface_status is larger than scan_result, causing
net_iface events to be dropped due to info exceeding
NET_EVENT_INFO_MAX_SIZE.
Signed-off-by: Noah Luskey <LuskeyNoah@gmail.com>
The previous patch to address race condition on STREAM sockets had a
side effect on DGRAM socket, where net_context_recv() is not only
installing recv callback, but also registering a connection at net_conn
level. Doing so before setting remote address first (which is done in
net_context_connect()) had an impact on the connected DGRAM socket
operation, which now accepted packets from any remote peer, and not only
the one socket was connected to.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
ICMPv6 messages with type < 128 are error messages, where we should not
send back another error. The meaning of the code depends on the type.
Signed-off-by: Andreas Müller <andreas.mueller@husqvarnagroup.com>
When resource data length is set to zero, we still need to
ensure that string reading will return an empty string.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Will exclude the code for prefix and checksum functionality if none
of the entries on a device make use of these features, saves ~816
bytes when both features are excluded.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
CONFIG_COVERAGE has been incorrectly used to
change other kconfig options (stack sizes, etc)
code defaults, as well as some samples behaviour,
which should not have dependend on it.
Instead those should have depended on COVERAGE_GCOV,
which, being the one which adds special code and
temporary RAM storage for embedded targets,
require changes to many features.
When building for the native targets, all this was
unnecessary.
=> Fix the dependency.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The CMSIS module glue code was part of arch/ directory. Move it to
modules/cmsis, and provide a single entry point for it: cmsis_core.h.
This entry header will include the right CMSIS header (M or A/R).
To make this change possible, CMSIS module Kconfig/CMake are declared as
external, allowing us to add a new Zephyr include directory.
All files including CMSIS have been updated.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
MCUmgr client upload max data payload length was missing
Transport layer CRC + 16bit lenght. Full net buf packet was
possible to send but receiver side it was blocked because there
was not space for calculate CRC and length.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
Retry sending notification was not sent due to e.g. lack of
buffers currently available.
Fixes: #57456
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Retry sending notification was not sent due to e.g.
lack of buffers currently available.
Fixes: #57452
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Changed Add to Enable in help text to convey the intended use of the
Kconfig NET_L2_WIFI_MGMT.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add a scan command option to print the help text for the scan command.
This is to facilitate ease of using the command (since now there are
many different options added to the scan command).
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add scan extension to allow limiting the scanning to specific channels.
Only 20 MHz channel specifications are allowed presently.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add scan extension to allow limiting the scan results to a user defined
maximum number. This parameter is intended to return results with the
best RSSI. It cannot be counted upon to limit the scan times since the
Wi-Fi chips might have to scan all the channels to find APs with the
best RSSI values across all channels.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add scan extension to control scanning time spent on channels where
passive scanning is used.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Added scan extension to support scanning individual Wi-Fi bands or
combinations thereof.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Modify the way the scan type option is passed to the wifi scan command.
This makes it flexible to add more scan options.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
This fixes missing Fix bt_tbs_client_cb.discover call that has been
observed when CONFIG_BT_TBS_CLIENT_CCID was disabled. In such case the
discovery proces was not finished from application point of view,
as the callback was not called.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes odd `subscribe` parameter from bt_tbs_client_discover
function parameters list. As the API user enables specific
CONFIG_BT_TBS_CLIENT_* option, the client implementation should
subscribe to the characteristic notifications so that the user receives
the value updates.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
- Fix masking for no coded phy
- Allow ISO_Interval < SDU_Interval for framed mode
- Change BT_HCI_ERR_INSUFFICIENT_RESOURCES to
BT_HCI_ERR_CONN_LIMIT_EXCEEDED.
- Prevent starting same CIS twice
- Cancel an initiated CIS creation procedure if terminated before
sending CIS_IND.
- Implement canceling of local CC procedure. Respond to CIS_RSP with
REJECT, if canceled after CIS_REQ was sent.
- Introduce state CIG_STATE_INITIATING for central, to keep track of
initiating CIS connection, in transition between CONFIGURABLE and
ACTIVE.
Fixes EBQ test /HCI/CIS/BC-03-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
This fixes the error below:
main.c: In function ‘bt_mesh_provision’:
main.c:173:17: error: ‘node’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
173 | bt_mesh_cdb_node_del(node, true);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
With gcc from the zephyr sdk and -Wold-style-declaration is giving this
output:
zephyr/arch/arm/core/aarch32/cortex_a_r/fault.c:101:1: warning:
'inline' is not at beginning of declaration [-Wold-style-declaration]
101 | static void ALWAYS_INLINE
z_arm_fpu_caller_save(struct __fpu_sf *fpu)
| ^~~~~~
I searched to all of the source code to find these further occurances
where inline is not at the beginning of a function declaration.
Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
The bt_cap_initiator_started may be called in cap_stream_started_cb,
even if there is no unicast support. Added a guard for
CONFIG_BT_BAP_UNICAST to avoid calling an unlinked function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rename shadow variables found by -Wshadow
After e38fc6de8a
was merged, this cause CI failures.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This enables -Wshadow to warn about shadow variables on
in tree code under arch/, boards/, drivers/, kernel/,
lib/, soc/, and subsys/.
Note that this does not enable it globally because
out-of-tree modules will probably take some time to fix
(or not at all depending on the project), and it would be
great to avoid introduction of any new shadow variables
in the meantime.
Also note that this tries to be done in a minimally
invasive way so it is easy to revert when we enable
-Wshadow globally. Source files under modules/, samples/
and tests/ are currently excluded because there does not
seem to be a trivial way to add -Wshadow there without
going through all CMakeLists.txt to add the option
(as there are 1000+ files to change).
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
There are a few structs, unions, and enums where -Wshadow would
complain. Since names being the same are intentional, we need
to tell compiler to ignore -Wshadow for those names.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
When the application closes the connection, it enters the FIN1 state.
Restructure this sequence to RST on data received after the application
has closed the socket.
Next to that deal with packets that contain both data and a FIN flag.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
As the metadata has to be validated anyway, let the initial vaidation of
metadata to be done in ASCS. The application can still reject the
metadata, but the length validation and supported type validation can be
performed by the stack.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The `ioctl()` interface is already supported by the network
subsystem but there was no `zsock_` interface available for it.
Add the `zsock_ioctl()` syscall.
Implement two somewhat commont ioctl requests for socket
file descriptors; namely
- `FIONBIO` set non-blocking I/O mode
- `FIONREAD` get the number of available bytes
In the process, added `net_pkt_ip_proto_hdr_len()`
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
In order to get a semi-accurate assessment of how many
bytes are available on a socket prior to performing a read,
BSD and POSIX systems have typically used
`ioctl(fd, FIONREAD, &avail)`
We can support this in Zephyr as well with little effort, so
add support for `socketpair()` sockets as an example.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Previously, if a net_context had multiple packets already in
the receive queue, and a call to zsock_recvfrom() was made with
a buffer large enough to receive content from multiple packets,
only the content from a single receive buffer would be received.
Since zsock_recvfrom() is a system call, which has a
non-negligible overhead, it makes sense to receive as many bytes
as possible per system call.
Add zsock_recv_stream_immediate() as a shorthand for
"fill this receive buffer with as many bytes as possible without
blocking". Allow nullable buffer parameters so that we can also
have a shorthand for "count how many bytes are immediately
available".
With minor refactoring, zsock_recv_stream_timed() is a simple
wrapper around zsock_recv_stream_immediate() that handles timing
and error conditions.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
When using the JIT scheduler (CONFIG_BT_CTLR_JIT_SCHEDULING), doing
ticker updates which only change the slot reservation, will fail.
For compatibility, the updates to ull.ticks_slot are preserved, as some
link layer implementations use this to predict collisions.
Signed-off-by: Morten Priess <mtpr@oticon.com>
When executing a local CIS_TERMINATE procedure, the reason sent to the
host must be changed to match the perspective of the initiator.
According to BT Core 5.4 Vol 4, Part E, section 7.1.6, the disconnect
reason must be BT_HCI_ERR_LOCALHOST_TERM_CONN for a local disconnect.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Do not assert in case of race conditions or asymmetric CIS
create/release. There are cases where ll_conn_iso_stream_get_by_group
legally returns NULL, and this should just cause for-loop continuing to
next iteration.
Signed-off-by: Morten Priess <mtpr@oticon.com>
To keep track of requested/pending CIS LLL flushing, change 'flushed'
binary state to 'flush' with states NONE, PENDING and COMPLETE.
This enables CIS teardown to know that a CIS already has a pending LLL
flush, and ULL does not need to initiate it.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Add support for SPI host command backend for STM32 chips family.
Unfortunately, the current SPI API can't be used to handle the host
commands communication. The main issues are unknown command size sent
by the host(the SPI transaction sends/receives specific number of bytes)
and need to constant sending status byte(the SPI module is enabled and
disabled per transaction). Thus the SPI backend includes basic SPI STM32
driver adjusted to host command specification.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
While the maximum sizes were already correctly checked by the code, the
minimum sizes of the PDUs were not. This meant that PDUs smaller than
the minimum required length (typically 6 bytes for AdvA) were
incorrectly forwarded up to the Host.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Set correct SHELL_BACKEND_SERIAL_INIT_PRIORITY if ACPI is enabled.
Otherwise when enabling SHELL using menuconfig, etc serial backend is
not working.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Adds separate extended protocol timeout of 120 sec in provisioning
implementation when OOB method Input or Output is used. This
complies with recommendation in the mesh 1.1 protocol spec (5.4.4).
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This is a stable API treewide change changing the newly introduced
"ret" response to "err" as it was overlooked that the shell_mgmt
group already used "ret" to return the exit code of the command
and this created a collision. Since SMP version 2 was only recently
introduced, there should not be any public implementations of it
as of yet, but the original function has been kept and marked as
deprecated.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes a stray ifdef which causes a build failure if the automatic
UDP start Kconfig is not enabled.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
When calling `bt_iso_chan_disconnect()` while the channel is
connecting, the host should simply use HCI Disconnect.
Note: For the peripheral it is not allowed to call HCI Disconnect
on a CIS after it has accepted the CIS request, but before it has
received the CIS established event. The implementation in this
commit does not fix this case. In that case the controller will
return an error code.
Also, this commit does not handle the events following the
HCI Disconnect correctly.
In this particular case, two events are raised by the controller.
See Core_v5.4, Vol 6, Part D, Figure 6.51.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
The default stack size is too small on 64bit.
Some standard shell commands cause stack overflow
Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
Both options are kind of mutually exclusive and can't be used together.
Also, USE_IDENTITY is used for debug purpose and could be useful when
debugging Private Proxy as well. Since CONFIG_BT_MESH_DEBUG_USE_ID_ADDR
is not allowed to be used in production, it is fine to use it for
Private Proxy advertisements as well.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Commit adds configuration for mesh with mbedtls PSA
to CI BabbleSim tests as well as emulation of
the Internal Trustable Storage(ITS) based on Zephyr's
settings to run in parallel environment.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Let's just let the user implementation to its things, like
checking, locking and stuff.
The tracing_user.c now just acts as a glue.
Moved previous implementation to its sample, and cleaned up
headers.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
When dealing with multiple connections in the shell as the central,
it is more often than not the newest connection you want
to interact with.
The behavior for the peripheral remains unchanged.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes ASE state transition to QoS Configured state that shall be
done autononously when CIS has been terminated due to link loss.
As per ASCS v1.0:
"If the server detects link loss of a CIS for an ASE in the Streaming
state or the Disabling state, the server shall immediately transition
that ASE to the QoS Configured state. Link loss of a CIS for an ASE in
any state other than Streaming or Disabling shall not cause a
transition of the ASE state machine."
Fixes: #60669
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The added function allows to check if a descriptive block
option was already added to a message.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
In some cases the options of a CoAP message are reused for
block transfer. Then the block header needs to be updated.
The current approach is to remove the old block option and
add an updated one.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
The provided function allows to remove a CoAP option in a
message. This is useful for reusing parts of a message.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
A recent refactor of bt_audio_codec_cap to flat arrays missed setting
data_len and meta_len fields.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
The reply callback doesn't need to handle the case when the
code of the reply is 'continue' (2.31). In that case the callback
is not executed until the last block is transmitted.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
When using block-wise transfer, call the reply callback only when
the last block arrived.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
Fix possible race conditions when state and results are written
by locking the registry, so a first write does not cause Notify
message to be send too early.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
When the protocol layer like TCP is blocking transmission, the socket
layer will attempt and wait for a maximum amount of time before returning
with an ENOBUFS error.
This change allows to set the maximum waiting time from the configuration
file instead of using a fixed 10 second value.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Qualification test CSIS/SR/SP/BV-03-C [Lock Timeout]
Specification: Coordinated Set Identification Service Revision v1.0.1
Section 5.3.1.1.
When the server and the client are not bonded and they disconnect when
the value of the Set Member Lock characteristic is set to Locked, the
server shall set the value of the Set Member Lock characteristic to
Unlocked immediately after the disconnection.
Signed-off-by: Henrik Eriksen <heri@demant.com>
Qualification test MICS/SR/SPE/BI-01-C [Invalid Mute Value]
Specification: Microphone Control Service Revision v1.0 Section 3.1.1
If the client writes a value of Disabled or RFU to the Mute
characteristic, the server shall return an ATT Error Response with the
ATT error code Value Not Allowed (0x13) as defined in Assigned Numbers.
Signed-off-by: Henrik Eriksen <heri@demant.com>
Bootstrap executable cause socket to be closed, so
it requires some delay for Ack to be send out as well.
Similarly, add small delay for Update trigger, so the
possible Ack goes out before the actual update message.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When BOOTSTRAP FINNISH message was received, it caused
engine to immediately switch to BOOTSTRAP_TRANS_DONE state
which then closed the connection.
Ack packet was still on the send-queue so it never got send before close().
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Some state changes were do by directly writing into
client.engine_state variable, followed by call next_event_at(0);
This causes hard-to-find side effects.
Refactor all state transitions to use set_sm_state() to have better
control for it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The command did no longer set the user specified data if the user
specified more than 1 AD field.
We were using the return value of ad_init() to set the number
of AD fields. This did not take into account the number of
existing data fields. By chance this usually returned 1.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
In case a TCP connection should be established with a specific source
IP address (e.g., by calling bind() prior to connect() on the socket),
we have to actually place the address in the outgoing packet.
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
To prevent failure stopping a ticker node after starting it within the
same ticker_job execution (queued operations), defer the stopping until
after start. This will sequence the operations correctly and prevent
failures.
Signed-off-by: Morten Priess <mtpr@oticon.com>
For config CONFIG_BT_CTLR_CONN_ISO_RELIABILITY_POLICY, set
CIG_Sync_Delay fixed as high as possible, and calculate FT by iteration.
This favors utilizing as much as possible of the Max_Transport_latency,
and spreads out payloads over multiple CIS events (if necessary).
Add exit with cleanup as ll_cig_parameters_commit may fail after
creating new CIG/CIS instances.
Fixes issue #59605.
Fixes EBQ test HCI/CIS/BI-12-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Convert the ISO-TP SF length check in send_sf() from __ASSERT() to a
runtime check.
Fixes: #61501
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
There is no reason why the capabilities
should be modified by the stack after registration,
nor any reason why a the unicast client application
needs to modify the reported remote capabilities, so
all have been marked as const.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Refactor the bt_audio_codec_cap to use flat arrays to store
metadata and codec specific capabilities.
The purpose of this is to make it easier to copy the data
between layers, but also to support non-LTV data for non-LC3
codec capabilities.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This adds refactor of bt_vocs object that is common interface for client
and server commands. As the bt_vocs_client is significantly larger than
bt_vocs_server the memory usage is not optimized when bt_vocs has an
union of those. Thus RAM consumption has been minimized by using
CONTAINER_OF macro to reference either to bt_vocs_client or
bt_vocs_server instance that bt_vocs is a member of.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The VOCS API uses `bt_vocs` object to reference both client and server
instance. This adds missing instance type checks to avoid invalid API
usage.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
When settings_load() is not called from system workqueue, but still
called from a cooperative thread, rescheduling during the settings
loading can wake up system workqueue and try to register the Mesh
Proxy Service, which can not be allowed yet. This is the case for bsim
tests.
Postpone registering the service with some small timeout.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This fixes possible buffer overflow that may happen when `buf->len`
equals `buf->size` while adding null terminator.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The font existence is checked at the time of linking,
The check at initialization is no longer necessary.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
According to section 4.2.2.4, Compositiion Data page 128 shall be
present if the node supports Remote Provisioning Server (section
4.2.2.4).
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
According to sections 7.2.2.2.4 and 7.2.2.2.5 of MshPRTd1.1v20,
when starting Private Node Identity or Private Network Identity, the
node shall use either RPA or NRPA and the advertising address. The
address shall be regenerated when Random field is regenerated.
Use BT_LE_ADV_OPT_USE_NRPA options to make advertiser generate and use
NRPA on every start of advertising Private Node Identity or Private
Network Identity.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This removes the scanning and PA sync capabilities from the
broadcast sink implementation, moving the responsibility of this
to the application layer.
The reason for this is to add more flexibility and choice to the
upper layers, while simplifying the Broadcast Sink implementation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The broadcast sink scan API is no longer used by the BAP
shell, which handles everything related to PA sync and scan
itself now.
It has also been made easier to sync to a broadcast
source by simply using create_broadcast_sink.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for selecting a periodic advertising
sync object for use. This will also be available outside
the scope of bt.c via the extern declaration.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fixes a race condition that could occur if the TX queue was read out
before iso_has_ts was set. In that case, the provided buffer is of
wrong length.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
This fixes return error from notify_cb function that was never set up.
As the result, the functions like bt_gatt_notify_cb and bt_gatt_indicate
returned invalid error when failed to send notification.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Looking back at the current INPUT_LISTENER_CB_DEFINE api naming, it
feels like it's a bit overloaded. Rename it to a simpler
INPUT_CALLBACK_DEFINE.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
There are some calls to ull_adv_aux_pdu_set_clear that are set to 0
but the argument is actually unsigned. This PR replaces the '0'
with '0U'
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Remove the shadowing ret variable and fix a bug that was related to
its existence - the shadowing ret variable was assigned with -ETIMEDOUT
which was supposed to be retuned by the function, but was not because
the ret variable at the function scope was left intact.
Also remove the unneded goto unlock; jump (assigning the error code is
the last operation before unlocking the mutex anyway).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This fixes 3 issues that came within PR #59124 for ppp uart usage.
Earlier start/stop of ppp was done at enable() but that
was removed in PR #59124. Now putting enable/disable() back and
putting start/stop there.
Additionally, there was a double ppp carrier ON when NET_EVENT_IF_DOWN.
For that net_if_carrier_on/off is set in uart ppp.c driver.
Also, maybe worth to be mentioned that after PR #59124 there is no
ppp carrier off when lcp is disconnected, for workaround that change,
application should use ppp dead/running events.
Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
When a thread is preempted on ARC, caller-saved registers
are saved on the stack automatically (RIRQ) or manually
by the kernel ISR (FIRQ).
Exposing the thread's relinquish cause hints the debugger
that it can read more or less register values.
Signed-off-by: Bruno Mendes <bd_mendes@outlook.com>
The OP_AGG_SRV is dependent that the OP_AGG_CLI is add
for the OP_AGG_SRV to work. Moved the define of OP_AGG_CLI
so it will call op_agg_send without the OP_AGG_CLI.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
The call to metadata-encode call in code and documentation
does does not match. Because the shell call in the documentation
looks correct the shell call in the code has been changed by
removeing the double metadata request.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
Flaky tests give innacurate test summary indicating a misleading
passing test suite. Add new status for flaky tests.
Signed-off-by: Al Semjonovs <asemjonovs@google.com>
First implementation had a math error where the offset would be the
remainder from division (modulo). It should have been an ISO interval
minus the remainder. Refactored to not use modulo.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Fixes a coverity-reported issue by explicitly ignoring the return value
of the cas-operation. The return value is the old value, but we are not
interested in it in the situation when we just want to initialize a
value if it is in the uninitialized state.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/60474
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
In certain scenarios, the semaphore sem_ticker_api_cb may be taken
during attempt to complete a synchronous ticker operation such as start
or stop, but is never released via ull_ticker_status_give. This could
happen if ticker temporarily runs out of ticker operation slots for any
ticker client.
The consequence of ULL stuck waiting in semaphore is anything from
allocation assertions to watchdog timeouts.
This commit also sets a timeout on ull_disable calls, which relies on
the disable callback being invoked from 'done'. Invocation of 'done' is
mandatory, and code shall not allow that not to happen, but to avoid
hiding the real cause, the semaphore now has a timeout which causes
assertion in the location the issue occurred.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Check mayfly_is_running() to determine use of blocking- or non-blocking
version of lll_csrand, instead of k_is_in_isr().
As mayflies run in ISR context for Nordic platform, change will have no
impact on Nordic configuration.
For vendors using META_IRQ mayflies, implementation will now prevent
blocking and reduce latencies and jitter in soft-realtime code.
Signed-off-by: Morten Priess <mtpr@oticon.com>
dev_id is used as a pointer at the end of the call chain, so passing it
as an int makes no sense and can cause crashes if the pointer and int
types have different sizes. For example, if we have 64-bit pointers on
a board, the higher part of dev_id will be removed due to an type cast.
Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
Updates NET_SOCKETS_TLS_MAX_APP_PROTOCOLS Kconfig option description to use
DTLS instead of DTL.
Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
* Create submenu for protocol versions.
Like LwM2M 1.0 vs 1.1. Object versions.
* Create submenu for engine features.
Containing all engine tweaks that are not directly from
protocol specification.
* Create submenu for all memory tuning options.
For example maximum number of certain objects, buffer
sizes, etc.
* Order all objects by object ID and show the ID in
title.
* When multiple options depend on same feature, group
them under if <option> ... endif. Preferably directly
after the selection itself.
* Move IPSO and uCIFI menuentries one sublevel up.
* Drop deprecated entries to bottom.
No functional changes, just clean up of Kconfig menu.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
At the moment, NET_EVENT_IPV6_PREFIX_ADD and NET_EVENT_IPV6_PREFIX_DEL
events provide provide information about an address without its length
and lifetime.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Fixes several minor display errors in the Segger SystemView output:
* Off-by-one error in some trace ids.
* Add missing syscall trace id.
* Displays easier to read syscall function names.
* Fixes syntax error in k_timer_start output.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Log transfer status and release transfer semaphore regardless if user
provided transfer completion callback or not. This fixes transfer slot
leak when transfer without callback completes.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Using a different channel for responding to a request is forbidden by spec.
The allocator was especially flawed as it iterated over all the EATT
channels to find one w/ a big enough MTU, but the sending was still done
over the same channel as the REQ.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This to ensure we don't fail to send a response and never get an ATT
TIMEOUT due to ACL TX buffer starvation caused by other users of the stack.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The ATT module has provisions to queue a packet/buffer for sending later if
it can't send it right away. For example if the conn.c tx context
allocation fails.
This unfortunately doesn't work if the buffer can't get allocated in the
first place, or if the ATT metadata can't also be allocated.
The metadata is allocated from a global pool set to the same number as
conn.c TX contexts. That can lead to a situation where other users of ATT
manage to queue a bunch of buffers (e.g. the app spamming GATT
notifications), depleting the number of ATT metadata slots so that none are
available.
When none are available, and we receive an ATT REQ, we try to allocate one,
fail, and drop the buffer (!). That pretty much guarantees an ATT timeout.
As a workaround for this, use a per-channel metadata slot, that is only
used for completing transactions.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This is useful in multilink scenarios, especially since there is not user
callback when the ATT channel times out.
Adding a user-facing callback should ideally also be done, but just logging
the address already provides useful insight.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Easier to debug that way.
Ideally we'd have more error codes/logging instead of just returning
UNLIKELY for most errors.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
To allow insighed into the correct functioning of the collision avoidance,
log the internal values and function calls.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
To avoid a TCP connection from collapsing a link, implement a collision
avoidance algorithm. Initially TCP new Reno is implemented for its
simplicity.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Adds the force parameter to the reset command which is now
provided to the callback hook (if enabled).
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Uses the zcbor decode bulk function instead of manually parsing the
array in the function to reduce duplicated code.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Uses the zcbor decode bulk function instead of manually parsing the
array in the function to reduce duplicated code.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commits changes how data on the disk is accessed. There are disk
structures which are packed and their fields are stored in little endian
byte order. To use data in the program structures it has to be translated
from little endian to cpu endianness.
Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
- `ext2_file` and `ext2_dir` merged into one struct and allocated from
dedicated slab
- `ext2_inode` allocated from dedicated slab
- `ext2_disk_dentry` allocated from heap (because their size is not
constant)
- `ext2_bgroup` and `ext2_disk_superblock` statically allocated
Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
Fix the behavior when data should be written to storage device. Now all
writes are done directly to disk_access layer (where it might possibly
be cached).
Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
Added funtion that takes specified action when file system corruption is
detected. Possible actions are: do nothing, make mount point read-only,
panic.
Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
Changes:
- Added few assertions to check if some assumptions are correct
- Fix removing blocks during trucate and inode removal
- Clear entry in inode table after inode has been removed
Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
Changes:
- Add fs::sync function
- Make correct file system in mkfs
- Add few assertions to ensure that all assumptions are correct
Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
Flaky tests give innacurate test summary indicating a misleading
passing test suite. Add new status for flaky tests.
Signed-off-by: Al Semjonovs <asemjonovs@google.com>
When a PAwR sync connects to a PAwR advertiser and CONFIG_BT_PRIVACY
is enabled a Resolvable Private Address will be used. Use that
as responder address instead of the identity address to match what
the central sees.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
The separate done memq was introduced to handle the old LLCP
stalling processing of the rx queue; This is no longer an issue with
the new LLCP, so we can remove it
Signed-off-by: Troels Nilsson <trnn@demant.com>
Upon receiving a L2CAP PDU, only send credits back if the L2CAP channel
hasn't been disconnected. The recv() callback called from
l2cap_chan_le_recv() can trigger a disconnect, which would cause an
assert failure when attempting to send credits back.
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
The PPP TX thread handles the transmission of packets at PPP layer.
Make it's priority configurable, so it's priority can be configured higher
then higher protocol layers.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
The TCP work queue is handles all TCP transmission and maintenance tasks.
Make it's priority configurable, so it can be configured to a lower
priority than the lower level network layers to avoid it consuming all
net_bufs before handing over execution to the lower layer network layers.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Use 64bit timestamps from k_uptime_get() so they don't
roll over during the expected device lifetime.
Fixes#60826
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Engine now allows registering service callbacks that are
called only once on a given timestamp.
This allows tickless services to be developed.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Allow socket-loop to wake up immediately, if there are changes,
instead of waiting for zsock_poll() to timeout.
This change makes engine more reactive and removes
hard coded timeout from zsock_poll().
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This fixes setting invalid List_Item_Length in Current Calls List.
The fix complements 9c7ef8e.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This was recently refactored (in #58440). But it introduced a bug in which
some channels were connected but not the whole list asked for by the peer.
In that case, `result` will not be `SUCCESS` but we still want to call the
`connected` callback as the peer will consider those channels to be
connected when we send the response.
The symptom is that EATT channels are being instantiated, but not
considered connected (ie. usable by the stack).
Also introduce a test that has asymmetric channel resources (5 on central
vs 2 on peripheral) to reproduce the bug.
Fixes#60212
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Make `bt_eatt_count()` return what it says on the tin, ie. the number of
channels that are actually connected.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
When the target board does not have heap by default, allows
statically reserving the space for required socketpairs.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Likely this trigger of the send_data_timer was an alternative for the
function that has been filled in by the ZWP transmission.
At the moment this timer has the potential to cause spurious
retransmissions that can degrade the throughput of the network stack.
Second to that it can accelerate the retransmission process, quickly
running to the number of retransmissions, causing a connection failure.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Add support for setting advanced broadcast ISO parameters
using the ISO test commands. This allows the host to set
ISO parameters that the controller normally would handle.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for setting advanced unicast ISO parameters
using the ISO test commands. This allows the host to
set ISO parameters that the controller normally would
handle.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fixes an issue whereby the data packets were not checked to ensure
that the client has not attempted to write more data than the size
that was provided in the original upload packet.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes an issue whereby upload image size would not be checked in
the first packet of an upload, which would allow an image to be
uploaded until it reached the point of it being too large to
fit anymore.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
At any ack, the retransmission timer was cancelled. This means when an ACK
is only partially acknowledging pending data, followed by a packet loss,
the connection ended in a deadlock eventually timing out.
By checking if there is any pending data for transmission before canceling
the retransmission timer, there is no risk of this lock-up any more.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Nordic Semiconductor has been testing the feature extensively on its CI.
The tests includes the sample data and the PTS tests.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
It would be strange to enforce padding for other bus participants but not
use it yourself. This default suggests the likely proper usage, although
it is not a hard dependency
Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
ISOTP_ENABLE_TX_PADDING makes the device transmit frames with TX padding.
ISOTP_REQUIRE_RX_PADDING ensures other devices on the bus use TX padding,
by rejecting non-padded RX frames
Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
The IEEE 802.15.4 API and networking subsystem were using several
inconsistent timestamp resolutions and types. This change defines all
timestamps with nanosecond resolution and reduces the number of
available types to represent timestamps to two:
* `struct net_ptp_time` for PTP timestamps
* `net_time_t` for all other high resolution timestamps
All timestamps (including PTP timestamps) are now referred to a
"virtual" local network subsystem clock source based on the well-defined
types above. It is the responsibility of network subsystem L2/driver
implementations (notably Ethernet and IEEE 802.15.4 L2 stacks) to ensure
consistency of all timestamps and radio timer values exposed by the
driver API to such a network subsystem uptime reference clock
independent of internal implementation details.
The "virtual" network clock source may be implemented based on arbitrary
hardware peripherals (e.g. a coarse low power RTC counter during sleep
time plus a high resolution/high precision radio timer while receiving
or sending). Such implementation details must be hidden from API
clients, as if the driver used a single high resolution clock source
instead.
For IEEE 802.15.4, whenever timestamps refer to packet send or receive
times, they are measured when the end of the IEEE 802.15.4 SFD (message
timestamp point) is present at the local antenna (reference plane).
Due to its limited range of ~290 years, net_time_t timestamps (and
therefore net_pkt timestamps and times) must not be used to represent
absolute points in time referred to an external epoch independent of
system uptime (e.g. UTC, TAI, PTP, NTP, ...).
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The usb_msc.h header does not provide any API. The content is only
used by the MSC implementation for the current USB device stack and
is not required for any use of MSC by the application.
The content has no proper namespace and must not be reused for
anything else in (new) USB support.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
MCUmgr client basic implementation for support Image and OS grpup
commands.
Image Group:
* Image state read/write
* Image Upload secondary slot
* Image Erase secondary slot
OS group:
* Reset
* Echo service, disabled by default
Opeartion's are blocked call and cant't call inside worker queue.
IMG and OS need to be SMP client object for transport.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
SMP client support for generate request and handling
response message.
Updated SMP transport for send request.
Added API for register SMP transport.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
These configs are very tied to the BT_LL_SW_SPLIT implementation,
so it makes sense that these are only visible when that link layer is
used.
For the ones that may be used by other controllers in the future,
a dependency has been added.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Truncation of advertising data has to be done at a PDU
boundary; Including only part of a PDUs advertising data is
not allowed
Signed-off-by: Troels Nilsson <trnn@demant.com>
If the aux scanner already has CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX
advertising data, there is no point in following an aux ptr -
instead flush the data and produce an incomplete report
Signed-off-by: Troels Nilsson <trnn@demant.com>
In some platforms it may be desirable to disable certain CPU power
states, for example, because they have extra requirements not available
on all boards/applications. Because `cpu-power-states` are defined at
SoC dts file levels, the only way to achieve that now was by re-defining
`cpu-power-states` property in e.g. a board file. With this patch, one
can now selectively set `status = "disabled";` to any power state and it
will be skipped by the PM subsystem.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
pm_device_runtime_get() uses a semaphore to protect resources.
pm_device_runtime_get() blocked forever until obtaining the lock, making
it unusable from contexts where blocking is not allowed, e.g. ISRs. With
this patch, we give the chance to use the function from an ISR by not
waiting on the lock and returning -EWOULDBLOCK instead. If device is
suspending (from a previous put_async() operation) the same value is
returned as we can't wait either.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Effectively, this option changes code triple in device descriptor.
Although the name is misleading, renaming it would again lead
to negative user experiences. Instead, clarify what the option does
and always select it where it is required.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Uses the MCUboot bootutil image.h file directly instead of an
outdated copy which resides in the zephyr tree.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a helper function for initializing devices into the expected power
state, through the devices `pm_device_action_cb_t`. This eliminates code
duplication between the init functions and the PM callback.
The expected device states in order of priority are:
* No power applied to device, `OFF`
* `zephyr,pm-device-runtime-auto` enabled, `SUSPEND`
* Otherwise, `ACTIVE`
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add new net_if API functions which allow to loop over all valid
IPv4/IPv6 addresses assigned to the interface and execute a callback
function on them.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When parsing user input for "wifi connect" and "wifi ap enable"
commands, the SSID and PSK lengths were not verified. It's better to
detect invalid connect/AP enable parameters early, so that help text can
be printed, instead of letting wifi_mgmt command to fail.
For WIFI_SECURITY_TYPE_SAE, follow the Linux convention of limiting the
size to 128 bytes.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Some DHCPv4 servers do not respect BROADCAST flag set on DHCP Discover,
replying with unicast packet, making it impossible to obtain DHCP
address by Zephyr in such cases.
RFC1542 chapter 3.1.1 makes the following statement about the BROADCAST
flag:
This addition to the protocol is a workaround for old host
implementations. Such implementations SHOULD be modified so
that they may receive unicast BOOTREPLY messages, thus making
use of this workaround unnecessary. In general, the use of
this mechanism is discouraged.
Making it clear that being able to process unicast replies from the DHCP
server is not only an optional behavior, but a recommended solution.
Therefore, introduce a support for unicast DHCPv4 in Zephyr. To achieve
this, add additional filtering rule at the IPv4 level - in case DHCPv4
is enabled, there is an active query and the packet is destined for the
DHCPv4 module, let it through for the DHCPv4 module to process,
regardless of the destination IP address.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Allows the application to force the use of an NRPA.
This is applied regardless of any other roles running (ie scanner) or
advertising type.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Increaing mesh scan window in order to reduce the number
of messages colliding into scan window end which happens
every 30ms currently. Increasing the window to 3000ms in
order to improve performance.
Keeping 30ms window only for legacy advertiser support.
Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
When copying parameters into payload buffer, it is possible
that after copying a string over, the pointer to buffer is
no longer aligned on 4 or 8 bytes. And some toolchains may
decide to treat the copy as aligned since the values being
copied are 4 or 8 bytes. This results in unaligned memory
access and hardware exception. So change the copy to memcpy
to avoid potential unaligned access.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The `attr_get` method is added to the ieee802154_radio to allow
reading of driver specific attributes of given device.
The enum `ieee802154_attr` provides common extension pattern
allowing to extend the attribute set.
Accessor function `ieee802154_radio_attr_get` is provided.
Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Adds a helper function for initializing devices into the expected power
state, through the devices `pm_device_action_cb_t`. This eliminates code
duplication between the init functions and the PM callback.
The expected device states in order of priority are:
* No power applied to device, `OFF`
* `zephyr,pm-device-runtime-auto` enabled, `SUSPEND`
* Otherwise, `ACTIVE`
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
The initial goal was to remove sys_clock_timeout_end_calc(). However,
several related issues have been fixed as well.
First this:
int64_t print_interval = sys_clock_timeout_end_calc(K_SECONDS(1));
/* Print log every seconds */
int64_t print_info = print_interval - k_uptime_ticks();
if (print_info <= 0) {
[...]
}
The above condition will simply never be true.
Then there is lots of back-and-forth time conversions using expensive
base-10 divisions for each loop iterations which is likely to impact
performance.
Let's do the time conversion only once outside the loop and track
everything in terms of ticks within the loop. Also the various timeouts
are open-coded based on the absolute uptime tick so to sample it only
once per round. Using sys_timepoint_calc() and sys_timepoint_timeout()
would have introduced additional uptime tick sampling which implies the
overhead of a downstream lock each time for no gain. For those reasons,
open coding those timeouts bears more benefits in this particular case
compared to using the timepoint API.
Then this:
secs = k_ticks_to_ms_ceil32(loop_time) / 1000U;
usecs = k_ticks_to_us_ceil32(loop_time) - secs * USEC_PER_SEC;
The above should round down not up to work accurately. And the usecs
value will become garbage past 1.2 hour of runtime due to overflows.
And no need to clamp the wait period which is on the microsec scale
using the total duration argument being on the millisec scale. That's
yet more loop overhead that can be omitted. The actual duration is
recorded at the end anyway.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This is meant as a substitute for sys_clock_timeout_end_calc()
Current sys_clock_timeout_end_calc() usage opens up many bug
possibilities due to the actual timeout evaluation's open-coded nature.
Issue ##50611 is one example.
- Some users store the returned value in a signed variable, others in
an unsigned one, making the comparison with UINT64_MAX (corresponding
to K_FOREVER) wrong in the signed case.
- Some users compute the difference and store that in a signed variable
to compare against 0 which still doesn't work with K_FOREVER. And when
this difference is used as a timeout argument then the K_FOREVER
nature of the timeout is lost.
- Some users complexify their code by special-casing K_NO_WAIT and
K_FOREVER inline which is bad for both code readability and binary
size.
Let's introduce a better abstraction to deal with absolute timepoints
with an opaque type to be used with a well-defined API.
The word "timeout" was avoided in the naming on purpose as the timeout
namespace is quite crowded already and it is preferable to make a
distinction between relative time periods (timeouts) and absolute time
values (timepoints).
A few stacks are also adjusted as they were too tight on X86.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This fixes missing `static` function specifier.
The bt_att_chan_create_pdu is not called outside of att.c.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Updates the handling of incoming seg ack messages to comply with
the mesh protocol specification, section 3.5.3.3.2 and section
3.5.3.3.3.
Previous implementation did not restart the retransmission timer unless
the incoming ack contained at least one segment newly marked as
acknowledged. According to the spec, the timer should be restated
regardless. The implementation depends on the retransmission
timer to end the transmission early if there was no more retransmission
attempts. Checks have been added to ensure that this now happens
immediately.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
In discover_next_instance coverity did not consider the
ASSERT and warns about possibly dereferecing current_inst
which could be NULL. Modifed the code slightly to make
Coverity happy.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds an optional callback upon image data being written, can be
used for syncing or timeout purposes.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Associate command handler did not validate the provided address length.
In result, if provided address string was longer than the expected
extended address size, strncpy() would not NULL terminate the buffer,
which could lead to unexpected behavior in parse_extended_address(), as
it expects NULL terminated string.
Fix this by validating the length of the provided address string before
parsing.
Additionally, make parse_extended_address() return the parsing result,
so that it can be detected when provided extended address has incorrect
format.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The Codec Specific Configuration Parameters provided by server was
not copied at bt_ascs_config_ase. Detected by PTS in BAP/USR/SCC PTS
test cases, because no LTV values appeared in ASE Codec Configured
notification.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Replaces the manual lookup function with a lookup function which
is provided when registering MCUmgr handlers which can be used to
find the function to translate error codes, allowing out of tree
MCUmgr handlers to provide error translation handlers.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Any system supporting PM must now implement
pm_state_set/pm_exit_post_ops. Before this change any platform could
enable CONFIG_PM=y, even though it did nothing, ie, no power savings at
all.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Add a new Kconfig option that has to be selected by SoCs providing PM
hooks. This option will be now required to enable CONFIG_PM. Before this
change, CONFIG_PM could always be enabled, regardless of SoC providing
any kind of low-power support.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Linuxptp report UTC offset is 9472 seconds, is a byte order issue,
The right value is 37. Also fixed offset_scaled_log_var byte order.
Signed-off-by: Chen Caidy <chen@caidy.cc>
According to IEEE802.1AS Table 11-6 and 10.6.2.2.9,
802.1AS using peer-to-peer delay mechanism, two-step clock,
Grand master clock should keep this correction_field as zero.
Signed-off-by: Chen Caidy <chen@caidy.cc>
According to IEEE802.1AS 11.4.4.2.1, we need fill
preciseOriginTimestamp as syncEventEgressTimestamp.
In this follow_up message, prec_orig_ts need to filled
from net_pkt_timestamp(sync) for best accuracy. state machine
is software trigger with insufficient precision.
After this change, a grand master endpoint sync accuracy
increase from 3.5ms to 580ns with mimxrt1050_evk board.
Signed-off-by: Chen Caidy <chen@caidy.cc>
Updated SAR default values to align with the latest mesh 1.1 drafts,
and relevant Bsim tests.
Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
When enabling thread analyzer, use printk by default. Otherwise logging
subsystem is enabled which might not be desired.
Fixes#59919
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Every USB device must buffer isochronous data for at least 1 frame in
order to remove packet jitter within a frame. USB Specification Revision
2.0 describes necessary buffering in 5.12.5 Data Prebuffering. USB Audio
1.0 specification mentions buffering in 3.4 Inter Channel Synchronization.
Set bDelay to 1 instead of 0, because bDelay 1 is both the minimum
allowed value and matches the actual device behavior.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Modified bt_cap_stream_ops_register to always register BAP callbacks
to ensure that the callbacks are always forwarded (unless later
overwritten by the application...)
The CAP Initiator Unicast will still register the callbacks itself,
to ensure that the unicast procedures still work even if
bt_cap_stream_ops_register was never called.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When a CIS is established for the peripheral, then not all
QOS values are completely valid as they are simply missing
from the CIS established event. This commit updates the
missing fields based on the QOS settings provided by the
BAP Unicast Client during QoS Configuration of the endpoint.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When initializing emulators for devices registered on an emulated bus,
Zephyr will assert if a matching emulator for the device cannot be
found. This feels overly restrictive --there may be cases where we still
want to build a driver for testing even without an emulator and drivers
should be able to handle situations where there is no device emulator
present (the I2C/SPI transactions will simply fail and the driver never
becomes ready).
This commit removes the assert and replaces it with an warning message if
no matching emulator is found.
Signed-off-by: Tristan Honscheid <honscheid@google.com>
This intoduces dedicated Kconfig option to enable TBS client,
that makes the configuration more intuitive.
While configuring GTBS only, the user does not have to explicitly set
the BT_TBS_CLIENT_MAX_TBS_INSTANCES to 0 to disable the TBS client
functionality.
This adds also `tbs_only_client` test case to test the TBS only build
option.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This improves the code readability and reduces flash usage a bit by
spliting up GTBS from other TBS instances in bt_tbs_server_inst
structure, so that some of the code could be conditionally compiled
out.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This adds handling of ASE control point operations in separate thread
so that the notifications of ASE state changes are sent from non-BT
thread. This ensures bt_gatt_notify_cb to be blocking waiting for
available buffers to send the notifications.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This patchset is doing three things:
1. It is fixing the bogus algorithm to find the optimal number of
descriptors for a given memory size.
2. It is changing values for VDEV_STATUS_SIZE and
IPC_SERVICE_STATIC_VRINGS_ALIGNMENT to better align to a usual cache
line size.
3. RX/TX VRINGs are now correctly aligned to MEM_ALIGNMENT (and cache
line alignment).
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add CAP shell commands for starting specific audio configurations
based on the BAP specification.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit adds missing tx power config options for nRF53x SoCs, as
well as the missing Radio defines for nRF53x SoCs.
Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
Use the macro to print to handle for cases where shell context is NULL,
this is possible because in this net management event handler shell
context is not passed.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Adds callback API for the following config client status messages:
- Composition data status
- Model publication status
- SIG model subscription list
- Vendor model subscription list
- Netkey list
- Appkey list
- SIG model app list
- Vendor model app list
- Key refresh status
- Heartbeat publication status
- Heartbeat subscription status
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
The BAP stream object should not have a dir field. The
dir field should be stored in the EP only (to avoid having two
fields storing the same value, causing possible issues).
The field was removed, and the places that use it has been updated.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for transmitting on multiple streams, e.g.
with the simple `send` command or with the sine generator.
This extends the start and stop sine to take a "all"
paramter to start sending on all streams.
This also fixes an issue with the seq_num when multiple
streams are transmitting, since the timing may get delayed
which then delays the seq_num which are then scheduled too late.
The fix here is to only use the timer for the inital sequence
number when starting to send the sine way, and then increment it
per TX.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The commit fixes build issue when building for two application
images in board that does not have slot0_ns_partition.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fix conditional compilation within img_mgmt_get_other_slot,
where CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER has been
incorrectly checked and #endif incorrectly placed.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Some controllers support additional connection parameter ranges
beyond what is described in the specification. Enabling this new option
allows the application to set any value to all connection parameters.
Tbe Host will perform no limits nor consistency checks on any of the
connection parameters (conn interval min and max, latency and timeou).
However, the Host will still use numerical comparisons between the
min and max connection intervals in order to verify whether the
desired parameters have been established in the connection.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add a feature to suppress commands. The suppressed commands are not
logged on the command reception.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Statically created threads with K_THREAD_DEFINE() are launched only
after the SYS_INIT phase. This does not play well with NET_CONFIG
library, which may block during SYS_INIT until network interface
is UP and RUNNING.
In order to be able to connect to L2 network and thus mark the
network interface as running and unblock NET_CONFIG, we need to be
able to run conn_mgr thread during SYS_INIT. This can be achieved,
by starting the thread dynamically during SYS_INIT phase, instead
of relying on static thread creation.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
net_if_lock() should be called only after iface pointer is verified not
to be NULL, otherwise we can end up dereferencing NULL pointer in
certain corner cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When building with the native simulator instead of attempting to
call directly to the host libC, use the trampolines provided
by the runner.
In this way we can build this code even if we are building
Zephyr with an embedded C library.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Split this tracing backend in a top and bottom to enable
building it with embedded libCs with the native simulator.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This fixes invalid memset of QoS parameters that may happen if Config
Qos operation is requested on ASE in QoS Configured state. In such case
if the requested parameters have been rejected, the ASE QoS parameters
shall remain unchanged (were memset instead). Otherwise, the stack shall
send QoS Configured state notification with cleaned up parameters (all
zero's) which was not done.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The TLS credentials libraries are purely software constructs with no
external dependencies, run them immediately after the kernel setup to
allow other initialisation functions to add credentials without the
requirement to run in the back half of the `APPLICATION` priority.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Fixes erroneous packing/unpacking of model app list messages
in the configuration client and server. According to the mesh 1.1
protcol spec (4.3.1.1) two app indexes shall be packed in a 3 octet
interleaved format. The current implementation packs them in 4 octets.
This commit also provide a helper function for unpacking key indexes
as public API to facilitate future config model callback API.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Adds a comment stating the state of the peripheral SDU size
and why it is being assigned the PDU size on CIS established.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add two input subsystem options: one for dumping input events, one for
triggering input reports from the shell.
The two are independent from each other, so dumping can be enabled on
any application that has no shell, but if the shell command is present
logging can be toggled on and off with a shell command.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Changes the Kconfig option to allow disabling mutex support, this
is to allow other Kconfig options to disable the feature.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add a user possibility to set a callback for receiving a new function.
It allows instant performing some actions, that need to be done before
context switch.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Verify validity of a received command before passing it to the general
handler.
It allows performing some actions, right after receiving the command.
The context switch is not needed. Such feature may be needed for
overloaded system, where instant reboot is required.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Add a function to signal a new host command by a backend.
Use a function instead of giving semaphore, because it allows more
actions on rx event, common for all backends.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Add a config to save the final result of a last host command that has
sent EC_HOST_CMD_IN_PROGRESS response. To get the final result use the
ec_host_cmd_send_in_progress_status function.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
According spec, for the same iv index, iv update flag
should trans to false, when iv update procedure complete.
When local environment has attack-node
to store old network beacon(1,1), and re-send same
network beacon(1,1) after 192hours, will cause whole
bluetooth mesh network broke.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
OOB information should be in little endian in scan report messages.
URI hash should be retrieved as it is from unprovisioned device beacon
and encoded likewise into scan report messages like we do for UUID.
Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
This fixes possible ASE leak in bt_ascs_config_ase in case
ascs_ep_set_codec function returns an error.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes code duplicates.
ASE Disable operation handler has been refactored by providing the
`rsp` pointer as one of the function parameters. ascs_cp_rsp_add is
not called from ase_disable explicitly, so the contents of the
response buffer are not changed in case the ase_disable is called
from non control point context.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes code duplicates.
The ASE Release operation handler has been refactored by moving the state
validation check to the ase_release function body and providing the
`rsp` pointer that is later filled. ascs_cp_rsp_add is not called from
ase_release explicitly, so the contents of the respons buffer are not
changed in case the ase_release is called from non control point context
e.g. `disconnected` callback.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Check if a network interface is managed by a network manager before
falling back to offload API.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This introduces support for Wi-Fi network managers in Zephyr. The
motivation is for the Wi-Fi management layer to work with both
Network managers and offloaded Wi-Fi drivers. The device driver
decides which one to use.
network manager : Apps -> Wi-Fi Mgmt -> Network Manager -> Wi-Fi
interface
offloaded : Apps -> Wi-Fi Mgmt -> Wi-Fi offloaded interface
Support for multiple network managers has been added, each device can
choose its own network manager and there can be mix and match:
wlan0 - Offloaded
wlan1 - Network manager 1
wlan2 - Network manager 2
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Decouple interface and Wi-Fi APIs, Wi-Fi APIs are common independent of
Wi-Fi offload or implemented natively (This is preparation for
introducing Native Wi-Fi).
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
The management thread *barely* fits in 768 bytes of stack; when thread
local storage is in use and TLS variables are also allocated from the same
region, this stack can overflow.
Increase to 800 bytes to leave plenty of room for TLS variables.
Signed-off-by: Keith Packard <keithp@keithp.com>
Removes redundant ACK state from `struct ieee802154_context` and
simplifies the ACK procedure.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This change introduces test coverage for association request and
response. Based on this coverage, several closely related issues were
found in the association process which cannot be split into separate
changes without breaking the build.
Most notably did the associate and disassociate net_mgmt commands send
already encoded IEEE 802.15.4 MPDUs to L3 rather than L2. L3 treated
them as payload and made L2 wrap them with another LL header/footer
which produced invalid packets.
The tests also enforce better aligment of the association process with
the IEEE 802.15.4-2020 standard:
* Association requests now ask for ACK as required by the standard. The
fake driver was enhanced to produce ACK packages when requested.
* macPanId and macCoordinator* MAC PIB attributes are set in the right
order for improved filtering of association responses.
* The coordinator may decide not to assign a short address to the end
device even when associated. This is now supported.
* The coordinator may or may not use a short address. Coordinators
choosing not to support short addresses are now supported.
* Updating the association will now remove any previously added short
address from the hardware filter.
* The short address may no longer be changed by the user while
associated to a PAN. Only the coordinator is allowed to allocate short
addresses.
* Validation of outgoing and incoming association request/response
packets is improved.
All changes are documented by pointers into the spec.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Fixes an off-by-one bug in the parsing routine of the coordinator
address when associating via shell command.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Input validation of some of the IEEE 802.15.4 net_mgmt commands was
incomplete and/or inconsistent. This change introduces a consistent
approach to input validation that is easier to follow.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Calculates macResponseWaitTime and applies it to the association
process.
As the timing calculation re-uses symbol period calculations and other
PHY timing constants previously introduced, these are now shared as
utility functions.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The IEEE 802.15.4 stack defines radio API helpers that provide
simplified and encapsulated access to radio API features.
These helpers were missing the `_radio_` infix. This infix is introduced
to clearly distinguish between MAC and PHY concerns. While PHY features
may be shared between L2 implementations (including the functions
concerned here), this is not true for MAC features.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The IEEE 802.15.4-2020 standard introduces an association type field to
support fast association, see sections 6.4.3 and 7.5.2. We do not yet
implement fast association but we introduce the flag to make this
obvious.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Minor simplification in the definition of IEEE 802.15.4 Kconfig packet
fragmentation configuration.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The additional hooks provide infrastructure to construct
rules on another network stack levels. Main benefit of this
approach is packets are pre-parsed and e.g. IP filter is
easier to implement. These hooks are equivalent of prerouting
and local_in in linux's netfilter.
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
Fixes an issue where a variable was used without being correctly
set by other parts of the code.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This moves copying of parameters after application return value
validation so that the metadata is not stored if rejected.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Merging the two structs cleans up significant amount of code
and makes it easier to expand later.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Previously the calculation of the PSN was done using
just a timer. This would not work correctly when
attempting to send multiple packets in a single SDU
interval (e.g. to enqueue 2 or more).
Previously we only ever attempted to send 1 packet in
the `sent` callback but scheduling the work item. However
in the case that the `sent` callback was called twice
before the work item had been triggered (possible due
to the priority of the RX thread being higher than the
system workqueue thread). This has been modified so that
if we can enqueue more packets in the lc3_audio_send_data
function, we re-enqueue the work item. We re-enqueue rather
than sending multiple in a single call to avoid blocking
other items on the system workqueue from being scheduled.
This could cause possible missed intervals (if other workqueue
items are processed), but it should be OK from a ISO perspective,
and the new PSN calculator handles this much better.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify lc3_audio_send_data to be triggered on a delayable
k_work so that we can retry it with a delay if it fails for whatever
reason.
This also moves the calculation of the seq_num closer
to when it is used, which makes sense as it is based on
a timed calculation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The current API for changing the bondable mode uses the global flag.
With Zephyr support for multiple Bluetooth identities, the API for
changing the bondable mode should be more fine-grained.
The bondable requirements of one identity should not have an impact on
another identity which can have a different set of requirements.
This change introduces function to overlay bondable flag per
connection.
Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
Current structure of Bluetooth Mesh Kconfig options is quite messy.
This makes impossible to understand which configuration belongs to
which feature. Especially when using interactive Kconfig interface, like
menuconfig or guiconfig.
This commit restructures the options grouping them by protocol layer
they belong to (Network, Transport, Access, etc.), or specific feature
(LPN, Friend, Proxy, Relay, etc.), or implementation (Advertiser, Shell,
Persistent storage). Amount of supported keys, subnets, group addresses
and labels are grouped under Capabilities menu. Generic options that
don't fall to any category are kept at the root menu. For better
visibility, if a specific feature or layer has more than 1 option, they
are hidden under menu.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The sizeof is used in a wrong way which causes incorrect checking a
version of a command. Use NUM_BITS instead.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
The response buffer has to be cleared every command not to pass
unintended content e.g. response from a previous command, or stack
content.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Update the response buffer size, passed to a command handler, every
command, since a backend could change it in runtime.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
PR adds the statistic module to estimate frame handling.
The module helps to understand the ratio of
the received\relayed\dropped\transmited frames.
That shows the efficiency of the current configuration\implementation.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The broadcast_id and the pa_sync fields should be set before calling
broadcast_sink_add_src as broadcast_sink_add_src will those values to
compare against other receive states.
The function was also missing a call to broadcast_sink_cleanup
for the newly allocated sink in case there was an error.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The CIG state variable is set to CIG_STATE_CONFIGURABLE, but then
cleared by memcpy from configuration cache. Set state after memcpy.
Fixes EBQ test /HCI/CIS/BI-10-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
In the case where memq_deinit in LLL flushing ends up with the free
link being the link provided by the CIS instance, and pointed to by
lll.link_tx_free, the free counter data in the link element is
overwritten during central CIS creation.
This has the effect that when starting the next CIG, there will suddenly
be 0 links available, and controller fails assertion.
By saving- and restoring the lll.link_tx before and after CIS
configuration cache copying, the free counter is intact.
Signed-off-by: Morten Priess <mtpr@oticon.com>
An advertising report must not be generated unless the AUX_ADV_IND
has been received (for ADV_EXT_IND with an auxptr)
Signed-off-by: Troels Nilsson <trnn@demant.com>
Use CONFIG_BT_CTLR_PHY_CODED to flag out coded phy code
Don't schedule a scan for coded phy when it is not supported
Signed-off-by: Troels Nilsson <trnn@demant.com>
When a stream leaves the streaming state the `stopped` callback
will now be called, similar to how the `started` callback works.
This ensures that `stopped` is always called and not just when
the CIS disconnects.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
So they depend or select on the right NATIVE_BUILD
instead of NATIVE_APPLICATION.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
parse_number() helper function accepts long * pointer or the output,
however in several places, an address of a variable of incompatible
type was passed to the function (for example an address of a bool
variable was cast to (long *) and provided to the function). This
could cause memory overwrites or other unexpected behaviour.
Fix this, by defining a helper variable of type long, and use it with
the parse_number() function. Only after successful parsing, the value is
then assigned to the proper destination.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When PMAX value is changed, it should update all events.
I believe there is a bug that caused the code only to update
events that are ongoing (to be send).
Now if PMAX changes, next event timestamp is recalculated.
Fixes#59397
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The enum used for connection types gets named bt_conn_type to guard
against accidental usage of generic integers with relation to it.
The added default case in several switch statements avoids warnings
against unhandled enum values.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Fail gracefully if an HCI event of one type arrives for a handle of a
different connection type. The requested types are currently based on
what fields are used, not on the usage context, in order to keep every
correct use so far still working.
A warning is logged if the connection identified by the handle does not
match the requested connection type.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
The "virtio_" prefix is used by the open-amp library API.
Rename local functions using "ipc_virtio_" prefix to avoid
function redefinition.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Instead of waiting for ase_buf to be available, the read of an
ASE in IDLE state can be handled without using ase_buf.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing control point status and ASE status change, when
failed to disconnect the CIS. As the server may, but does not have to
disconnect the CIS, the operation should not be considered as failed
when it happens.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
PR instantiates cdb and core keys to prevent scenario
when key is changed over cdb API and gets new ID but
core still operates with old ID(potentially invalid).
Known issue the keys will be desynchronized
during\after key refresh procedure.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
This commits eliminates the old way of
pacs notifications, replacing k_work with
simple bt_gatt_notify.
Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
When doing the bt_ots_dir_list_reset_anchor we now explicitly ignore
the return value of bt_gatt_ots_obj_manager_first_obj_get
to fix a coverity issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Cast ticker_stop() calls to void where return value is not checked.
This is to satisfy coverity and indicate that return value is not
important.
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
This change replaces one letter variable names with considerable
variable spans by much more readable alternatives that ease code
maintenance and help human reviewers to catch semantic errors.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The f_ctx variable renamed in this change has a considerable variable
span. This makes the code hard to read as the variable name is neither
defined in the IEEE 802.15.4 standard nor can it be deduced from the
variable name.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The 'ar' abbreviation has a well defined meaning in IEEE 802.15.4 which
is NOT the meaning of the local "ar" variable being renamed in this
change (see the comparison to the actual MHR ar field in this change
set).
To avoid confusion, a non-abbreviated variable name is introduced
instead.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The 'af' abbreviation is nowhere standardized in IEEE 802.15.4 and makes
the source code unnecessarily hard to read. It is replaced by a readable
long name.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Several distinct naming conventions existed within the IEEE 802.15.4
stack wrt header length. This change converges to a single naming
convention, the one that is less ambiguous and already most used.
The change also makes the distinction between L2 (link layer/LL) header
length and 6LoWPAN fragmentation header length to avoid confusion.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This change is in preparation for the newer frame version's more
complex compression algorithm that may compress both, the source
and the destination PAN independently.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This change renames buf to pkt_buf in one very specific instance to
distinguish the packet buffer from the frame buffer which is kept in the
same local scope. In all other instances the meaning of "buf" should be
obvious from context, not so here, though
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The bt_csip_set_coordinator_csis_inst_by_handle did not check the input
parameters and could call lookup_instance_by_handle with handle == 0
which triggers an ASSERT.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If we are use the shell as a CAP initiator, then we need to
register the stream callbacks for the CAP streams as well, as
CAP will use the BAP callbacks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When populating the conns array in
bt_cap_initiator_codec_configured, coverity did not like just
having the __ASSERT, so modified the checks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When syncing via the broadcast sink or the scan delegator
it makes more sense to filter on duplicates, as the expected
data rarely changes.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The internval of how often we report
receive stats can now be configured via the cmd_recv_stats
command.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add more information when we print the recv every 100th
packet, and remove all per-recv printing.
This also resets all information on stream start. This does,
however, no properly support multiple streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The callback should not be modified by the stack,
and should thus be const.
Also fixes a missing include of conn.h.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
To further reduce the need for networking boilerplate in applications,
provide bulk versions of net_if_up, net_if_down, conn_mgr_if_connect,
and conn_mgr_if_disconnect that affect all available / eligible ifaces
at once.
Since it is not intuitive whether these functions should affect ifaces
which conn_mgr is ignoring, these functions take an argument that allows
this to be specified by the application.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
To reduce the amount of boiler-plate needed in applications, this commit
grants conn_mgr the ability to automatically take ifaces that have given
up on connecting into the admin-down state.
Tests adjusted as appropriate.
This behavior can be disabled globally by disabling
NET_CONNECTION_MANAGER_AUTO_IF_DOWN, or disabled per-iface using the
CONN_MGR_IF_NO_AUTO_DOWN flag.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
To reduce the need for boilerplate in application code, conn_mgr now
supports an auto-connect feature on all ifaces with connectivity
bindings.
conn_mgr will automatically call conn_mgr_if_connect on any iface with a
connectivity binding that enters the admin-up state, unless the newly
added CONN_MGR_IF_NO_AUTO_CONNECT flag has been set for that iface.
Also adjust automated tests to account for and take advantage of this
behavior.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
- Add missing event sleep after taking all ifaces up in
test_connect_disconnect.
- Add missing event sleep after resetting ifaces in conn_mgr_conn_before
- Fix typo in comment for internal state flags.
- Add missing NET_MGMT_EVENT_BIT to conn_mgr_connectivity event
definitions.
- Missing net_mgmt.h include in conn_mgr_connectivity.h
- Split conn_mgr_conn iface reset into network and state resets, before
and after event sleep, so that triggered events do not corrupt the
state reset.
- Reduce SIMULATED_EVENT_DELAY to 100ms to avoid timeouts on real-time
targets.
- Use macro for simulated event wait times.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
This restores a line of code that was accidentally deleted in
5580cb4391. This fixes an uninitialized
`le_addr` getting printed and producing garbage output in the scan
results.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Patch to rename struct bt_ots_init to struct bt_ots_init_param
to avoid duplicating the name bt_ots_init.
Fix for issue#45968
Signed-off-by: Jai Arora <infolinesoni@gmail.com>
Rename the bt_codec struct to bt_audio_codec_conf or
to the new struct bt_audio_codec_cap.
Rename the bt_codec_data to bt_audio_codec_data.
The purpose of this is to split the codec specific configuration
and codec capabilities into seperate structs, as they do not
reflect the same values, or used for the same purpose.
This commit depends on the preset macros workings on either
type of struct (for now), but will be modified in future updates.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Set default offloaded interface during net_context_get() call, so that
net_context_recv() can be called before net_context_connect(). There is
already an assumption about using default network interface, so this should
not be harmful.
Fixes: 2c75070360 ("net: sockets: tcp: Fix possible race between
connect/recv")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This fixes metadata length checks for BT_AUDIO_METADATA_TYPE_EXTENDED
and BT_AUDIO_METADATA_TYPE_VENDOR that should be at least 2 bytes long.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The CCID list can be empty, as the Assigned Numbers is not strict
regarding it's minimum length.
Fixes: #59666
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing drop of ISO Data PDUs received in non-streaming state.
The client shall indicate first it's readiness to receive the ISO Data.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing drop of ISO Data PDUs received in non-streaming state.
The server shall indicate first it's readiness to receive the ISO Data
by calling bt_bap_stream_start that triggers state transition from
Enabling to Streaming state.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Add check for CONFIG_BT_TBS_CLIENT_MAX_TBS_INSTANCES > 1 before
comparing inst_cnt, as otherwise it was always false which
caused a coverity issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Default scan mode is Active. User can force the scan mode to passive
through Kconfig option or using 'passive' option from shell.
Using either of this option will override regulatory settings and
forces all scan channels to be passive only.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
The cmd_csip_set_coordinator_discover_members did not properly
handle the members_found and addr_found values.
It has been modified to run through all known values
before scanning, and set the value appropriately.
This also fixes a minor bug where err = 0 was missing.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add LL_ASSERT_OVERHEAD define to reuse the assertion check
related to increase in actual EVENT_OVERHEAD_START_US value.
Introduce Kconfig option to permit radio event be skipped
when increased prepare callback latencies are measured,
instead of assertion.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Connected ISO implementation to correctly handle SN,
NESN and payload_count when prepare callback is aborted due
to CPU overhead related latencies.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Move the EVENT_OVERHEAD_START_US verbose assertion to each
state/role LLL implementation so that correct state/role
that is delayed is conveyed in the assertion message.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add -ECANCELED on return from lll_preempt_calc so that
assert check can be placed in the prepare callbacks of the
state/role implementations.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix to not use pre-programmed PPI when NRF_TIMER0 is not
used as the radio event timer.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS create implementation to consider CIG events with
laziness before the new CIS in an already active CIG is
made active.
Previous laziness value of the CIG events is determined and
at the CIG event where the new CIS event_count is calculated
the lazy_active value determined is decremented from the
total lazy value.
Without this fix, event_count of the new active CIS events
where incorrect, causing CIS create resulting in fail to be
established.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Since the acl mtu for mesh is reduced to 37 in PR #59004, there is no
need in BT_L2CAP_TX_MTU to be longer than 33 bytes for mesh.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If disconnection has been triggered in between the security update and
the call to `smp_pairing_complete` we need to abort the pairing.
The disconnection may have been triggered by `bt_unpair`, in that case
the keys will have been erased and it will lead to an assertion to
continue as if nothing happened.
To resolve this issue, at the beginning of `smp_pairing_complete` the
`status` is set to `BT_SMP_ERR_UNSPECIFIED` if there is no connection.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The signal strength for the connectivity monitor was
defined as int8_t, however this was too small for
LTE RSRP values, which has range [-140,-44].
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Use only single thread for handling polling of the sockets.
Each client will have only 1 active socket which to poll.
Each client can have multiple simultaneous requests ongoing.
The client only has one buffer for receiving and one buffer for sending.
Therefore the messages are reformed when resending.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Two different IPv6 addresses can have the same solicited node multicast
address, for example when they are derived from the same EUI-64
interface identifier during the auto-configuration process. For example,
an interface with a physical address 70:07:12:34:56:78 can have the
following:
- link-local address FE80::7207:12FF:FE34:5678
- global unicast address 2001🔢::7207:12FF:FE34:5678
Both addresses will have the same solicited-node multicast address
FF02::1:FF34:5678. Currently, if one removes the global unicast address,
the solicited-node multicast address is also removed, leaving the
link-local address out of the solicited-node multicast group. This
breaks some protocols like Neighbour Discovery.
Count how many times the solicited-node multicast address is used and
remove it only if it is not shared by any other unicast address.
Fixes#59683
Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
First search for a match, then perform the removal outside the loop.
There is no functional change but this prepares for some future changes.
Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
Move the creation of the multicast solicited node address outside the
loop. There is no functional change but it prepares for some future
changes.
Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
Instead of setting the default_stream when we initiate
the configure operatio, we set it when it has succeded.
In case that the codec configure fails, the stream should
not really be considered configured as the default.
This also ensures that the default_stream is set when
using the CAP shell commands.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Currently, it is not possible to use hawkbit with code that requires
POSIX_API to be set due to the dependency on NET_SOCKETS_POSIX_NAMES.
Since a lot of other code has already been moved to `zsock_`, this
commit does the same for hawkbit.
Co-authored-by: rojedag <r.ojeda@vogl-electronic.com>
Signed-off-by: Matthias Breithaupt <m.breithaupt@vogl-electronic.com>
Lwm2m firmware object have defined a write of zero length
string as a cancel operation.
So allow lwm2m_set_opaque(path, NULL, 0);
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
It may happen that CIS is scheduled in the future and did not started
yet once accepted. When ASE goes to Releasing state in such case
the ISO has to be disconnected, because otherwise ASE will stuck in
releasing state.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Since clear_lc3_sine_data references audio_send_work, it must
be declared before the clear_lc3_sine_data function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_bap_scan_delegator_find_state did not properly return the
correct receive state due to confusing return value of the
iterator function.
Modify it to use a simple bool.
This fixes all issues with "Failed to find receive state for sink"
when using the Broadcast Sink.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the CSIP Set Coordinator verify_members we verify that
all members have unique ranks.
This was done as part of the initial loop, but it is
more efficient to do this as a separate loop as we can reduce
the number of items to compare, as well as guarding this properly
by !zero_rank.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fixes 2 issues:
1) The broadcast code would only ever get the first value, even if
the command specified up to 16 values.
2) The broadcast code is not just hex values, so hex2bin does not make
sense, and strlen + memcpy is much simpler.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When the broadcast assistant have found the expected broadcast
source it should stop scanning.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The shell_print was meant to print the address of the broadcast
source along with the broadcast_id.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bad code field should only be printed when there is an actual
bad code, otherwise it just prints all-0s.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Move BT_CTLR_SCAN_SYNC_ISO_SET to Kconfig from Kconfig.ll_sw_split
This means it can be used by other controllers and alligns with location
of other iso configs - e.g. BT_CTLR_SYNC_ISO_STREAM_COUNT
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
Add a native way to log Host Command communication.
Use Zephyr logging system to do it. Use debug and normal levels.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Use one common function to send Host Command response. It allows
handling all response types within one function.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Add a configuration option to set Wi-Fi as default interface and also
add an API to get first available Wi-Fi interface.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Identify the Wi-Fi capability to the networking stack and also the type
of Wi-Fi (Native vs Offloaded), this helps identifying Wi-Fi interfaces
that can be used by applications.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Wi-Fi is based on L2 Ethernet, so, all drivers are registered as
Ethernet L2, but in order to distinguish true Ethernet and Wi-Fi
devices, add a L2 type within Ethernet.
Also, handle offloaded net devices that also offload Wi-Fi.
This approach is better than adding a new Wi-Fi L2 as that would mean
invasive changes which are unnecessary.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
As per table 4.2 in BAP v1.0.1, the BAP unicast client shall
support at least 2 (> 1) endpoints in either direction if it
supports that direction.
Since Kconfig does not support such requirements (0 || > 1),
this is done using a BUILD_ASSERT.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Pause and resume functionality was written into assumption
that sockets are closed before resuming.
With use new options CONFIG_LWM2M_RD_CLIENT_STOP_POLLING_AT_IDLE
or CONFIG_LWM2M_RD_CLIENT_LISTEN_AT_IDLE this is not always true.
Fix the state machine, so that on those cases, sockets are not
closed and resume is always similar like from the QUEUE mode.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Add support for using X509 certificates.
Default settings use ECDSA certificates with SHA256 hash.
When different settings are required clients should overwrite
struct lwm2m_ctx->load_credentials() and
struct lwm2m_ctx->set_socketoptions()
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Most AP's are not sending proper HE triggers or stopping triggers after
sometime, so, change the default to non-triggered based TWT.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
If the remote responds with and security related error the stack tries
to increase the security level to satisfy the remote permissions.
This fixes missing ATT timer reset on security related ATT Error
Response as the ATT operation is considered as complete.
< ACL Data TX: Handle 0 flags 0x00 dlen 7
ATT: Read Request (0x0a) len 2
Handle: 0x0084
TMAS: Role
> ACL Data RX: Handle 0 flags 0x02 dlen 9
ATT: Error Response (0x01) len 4
Read Request (0x0a)
Handle: 0x0084
Error: Insufficient Authentication (0x05)
TMAS: Role
Error code: 0x05
< ACL Data TX: Handle 0 flags 0x00 dlen 6
SMP: Security Request (0x0b) len 1
Authentication requirement: Bonding, No MITM, SC, No Keypresses
= bt: bt_att: ATT Timeout
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
If connection reference is acquired from `bt_conn_lookup_addr_le` but
`bt_gatt_ccc_cfg_is_matching_conn` return false the connection was not
unreferenced properly. This commit fix the issue by unreferencing the
connection if the condition is false.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This fixes notification callback that can be called with NULL conn
parameter when peer is being unpaired.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
When writing a test suite, it's more common to want the 'before'
hook to run in privilaged mode, even when the test is run in userspace.
Reconfigure ztest to first run the test thread callback in privilaged
mode and only enter userspace after the test rule and suite's 'before'
functions ran.
Signed-off-by: Yuval Peress <peress@google.com>
The RTT backend of the shell does not support several of the more
advanced terminal features. This commit proposes to inactivate these
features by default when RTT is selected as shell backend.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
unpair may be called from bt_unpair where addr is NULL.
One such case is the `bt clear all` shell command which
calls bt_unpair with addr = NULL, and the addr is just forwarded
to unpair which does not check for NULL.
bt_unpair allows for the addr to be NULL to clear all, but only
if SMP is enabled.
Modified the checks in bt_unpair to increase readability
and ensure that unpair is not called with NULL.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Switch the driver to the soft CSMA/CA algorithm as an intermediate
compromise for improved standard compliance (namely expontential
backoff) until true hardware support can be implemented by chaining
radio commands.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The extra ztest functionality for the posix arch
requires the host libC. Disable it if we are
building with an embedded libC.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This fixes TMAS characteristic permissions.
The characteristic shall have no security related
permissions as per TMAP_v1.0.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
bt_mesh_elem_find can return NULL.
This also gets rid of VLA in bt_mesh_shell_mdl_print_all.
Coverity-CID: 321075
Fixes#59522
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If the stream is stopped or released, we did not clear the
txing_stream which is what would stop the sine from being
attempted to being sent.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The seq_num in lc3_audio_send_data was updated twice:
Once when calling get_next_seq_num and once at the end
of the function.
This increased the sequence numbers too fast, and made
TX not worker properly.
Modified to only use get_next_seq_num.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In `gatt.c`, the function `bt_gatt_ccc_cfg_conn_lookup()` was not
checking that `conn` was not NULL. That leaded to a NULL pointer
dereferences later in `bt_conn_is_peer_addr_le`.
Fix by checking that `conn` is not NULL.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
When CONFIG_PM_DEVICE is enabled IPC Device may be during power transition
during a call to intel_adsp_ipc_send_message function.
Changed signatures of intel_adsp_ipc_send_message and its sync version
to return int and negative error codes on error.
On attempt to send IPC message during Device power transition
-ESHUTDOWN error code is returned, on busy state -EBUSY.
Updated all function references.
Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
If the procedure was called, we print a more specific string
to let the user know that there was not an actual issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the case that the advertising data has both a device name
and a broadcast name, whichever one comes first will be used.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This code is meant to run in the context of a exception.
Most architectures will fail the asertion made in z_impl_k_sem_take()
when timeout is not K_NO_WAIT.
This commit ensures K_NO_WAIT is used when arch_is_in_isr() is true.
Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
Provisionee shall fail if provisioner sent public key
identicall to OOB public key back.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
If the address was removed immediately after being added (e.g. because the
interface MAC address is changed on boot), it would remain in the DAD timer
list.
In one scenario, the DAD timeout would eventually fire, causing the
now-removed address to be modified, potentially causing issues that way.
In another scenario, if the interface was immediately brought back up
again with a different link-local address, this new address would reuse the
first address slot on the interface. Starting the DAD process for this new
address would lead to the same address slot being added to the DAD timer
list a second time, causing an infinite list and associated lockup during
iteration.
Always remove the address from the DAD timer list when it is removed from
the interface, not just when DAD fails.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
This remanes send_buffer to tx_buffer to be
consistent with Rx buffer naming and with
mbox naming.
Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
This improves packet reception and fix an issue
where packets bigger than internal Rx buffer
were silently dropped. In current solution
local data coping for reception is not needed.
User gets direct pointer to shared memory which
allow to efficient receive as much data as was sent.
Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
Adds status checking to the command status hook which allows an
application to inspect a request and, optionally, reject it.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds an optional Kconfig that adds mutex locks to image management
group functions, this prevents collision between multiple threads
and/or transports.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The `net_if` layer should not be forcing `NET_IF_LOWER_UP` to be set on
all interfaces at runtime. Because `net_init` runs relatively late by
default, this is overriding any control the driver itself may have
performed using `net_if_carrier_on/off`.
Initialise this bit at compile-time instead. As the structure is already
being initialised, this doesn't increase any footprints.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
When writing string data to resources which are string types,
we should count in the terminating character into the data length.
Corner cases exist where LwM2M resource type is opaque but
lwm2m_get_string() or lwm2m_set_string() are used to read/write
the data. We must ensure string termination on those case, but
terminating character must not be stored in the engine buffer
or counted in the data length as this might be considered
as part of the binary data.
Fixes#59196
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The loop was supposed to set the alert level to the highest
value by any device. The loop, however, only made sense if
CONFIG_BT_MAX_CONN > 1.
It has been modified to start from [0] instead of [1] and
the initial condition was modified.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a new Kconfig parameter NET_CONFIG_MY_VLAN_ID as initial network
configuration to enable users to set VLAN identifier at startup.
Add a new setup_vlan(...) function to setup the VLAN identifier in
the device, the call have an effect only when NET_CONFIG_MY_VLAN_ID
is above zero.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Device dependencies are not always required, so make them optional via
CONFIG_DEVICE_DEPS. When enabled, the gen_device_deps script will run so
that dependencies are collected and part of the final image. Related
APIs will be also made available. Since device dependencies are used in
just a few places (power domains), disable the feature by default. When
not enabled, a second linking pass will not be required.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The option can now be set by projects. This change will also allow to
make it dependent on a future CONFIG_DEVICE_DEPS option.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Rename the Kconfig option to be in line with recent renamings in device
handles/dependencies.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Rename struct device `handles` member to `deps`, in line with previous
renamings in the device API.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Rename multiple internal device macros to use the DEVICE_DEPS naming, so
that it is clear they belong to the device dependencies APIs.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
These macros are used internally by the device dependencies functions.
There's no need to expose them publicly, so prefix them with Z_ and add
them under INTERNAL_HIDDEN docs section.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Instead of trusting blindly that k_mem_slab_init()
will succeed, let's check it, and handle failures
appropriately.
Otherwise, a buffer of garbage will be passed
around, leading to misterious failures later on.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This PR adds ability to build mesh with tf-m psa
for platforms those support tf-m.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Fixing error: undefined reference to 'vs_set_min_used_chans'
when building with 'BT_HCI_VS_EXT' option disabled.
Signed-off-by: Michał Grochala <michal.grochala@nordicsemi.no>
BT_ID_DEFAULT is hardcoded in mesh. Added clarification about
the necessity of another local identity allocation for BLE
if it coexists with mesh.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
websocket_disconnect api does not closes mqtt's tcp socket, so
tcp socket must be closed after done.
Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The websocket_connect api expects connected tcp socket, do not close
the user supplied socket so that the caller can re-use it if needed.
Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The BLE backend has a bug that when the MTU size is less than
the buffer the notification always fails and does not allow
to flush the buffer.
This fix checks for the MTU size of the current connection
and adjusts it. In addition, the buffer size is no longer
settable by the user and depends on the transmission size
of MTU set with CONFIG_BT_L2CAP_TX_MTU.
Signed-off-by: Victor Chavez <chavez-bermudez@fh-aachen.de>
The PAN ID in IEEE 802.15.4 frames is little endian while in the
IEEE 802.15.4 context it is kept in CPU byte order.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The ACK procedure had the following issues:
- MAC commands were not acknowledged.
- When the package is a broadcast package the package must not be
acknowledged.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Acknowledgment is mandatory if legitimately requested by the package's
"ACK requested" flag. The L2 layer will have to ensure that compliant
ACK packages will always be sent out automatically as required by the
standard.
For IEEE 802.15.4 compliance, the NET_L2_IEEE802154_ACK_REPLY option is
therefore being deprecated.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The existing calls to ieee802154_radio_send() and soft MAC ACK handling
were inconsistent and/or not properly integrated with more recent
radio driver capabilities as CSMA/CA and ACK in hardware.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The method ieee802154_radio_handle_ack() does not belong to the
PHY/radio layer but to the L2 layer. It is a callback called from the
radio layer into the L2 layer and to be implemented by all L2 stacks.
This is the same pattern as is used for ieee802154_init(). The
'_radio_' infix in this function is therefore confusing and
conceptually wrong.
This change fixes the naming inconsistency and extensively documents
its rationale.
It is assumed that the change can be made without prior deprecation of the
existing method as in the rare cases where users have implemented custom
radio drivers these will break in obvious ways and can easily be fixed.
Nevertheless such a rename would not be justified on its own if it were
not for an important conceptual reason:
The renamed function represents a generic "inversion-of-control" pattern
which will become important in the TSCH context: It allows for clean
separation of concerns between the PHY/radio driver layer and the
MAC/L2 layer even in situations where the radio driver needs to be
involved for performance or deterministic timing reasons. This
"inversion-of-control" pattern can be applied to negotiate timing
sensitive reception and transmission windows, it let's the L2 layer
deterministically timestamp information elements just-in-time with
internal radio timer counter values, etc.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The IEEE 802.15.4 standard clearly separates clear channel assessment
from retransmission. This separation of concern was not represented in
the current channel access vs. retransmission implementation which
resulted in considerable duplication of code and logic.
This change removes the duplication of logic and encapsulates the
resulting functions in a private API that may only be used from within
Zephyr's native L2 layer.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The CSMA/CA algorithm had multiple issues:
- Timing of backoff periods depends on the PHY's symbol rate and other
PHY-specific settings. We introduce a preliminary solution that works
with current drivers. A fully standard-compliant long-term solution
has already been conceptualized but requires further pre-conditions,
see #50336 (issuecomment-1251122582).
- We enforce the condition defined in the standard that macMinBe must be
less than or equal macMaxBe.
- According to the standard a CSMA/CA failure should lead to immediate
abortion of the transmission attempt, no matter how many
retransmissions have been configured.
- The number of retransmissions was off by one. It is now used as
defined in the standard algorithm.
- Retransmissions are only allowed when acknowledgement is requested in
the packet.
- prepare_for_ack() has side effects and must be called before each
retransmission.
We also replace variables by constants where possible.
The function was renamed as it represents unslotted CSMA/CA and does not
support other CSMA/CA modes. These may be introduced in the future.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The ALOHA algorithm had two minor implementation errors:
- The number of retransmissions was off by one.
- Retransmissions are only allowed when acknowledgement is requested
otherwise it is to be assumed that the transmission was successful.
- prepare_for_ack() has side effects and must be called before each
retransmission.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The allowable ranges of several CSMA/CA-related settings were not
conforming to the standard, see IEEE 802.15.4-2020, section
8.4.3.1, table 8-94 (MAC PIB attributes). This change fixes the ranges.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Setting default value for BT_BUF_ACL_TX/RX_SIZE and
BT_CTLR_DATA_LENGTH_MAX to 37, as this will process the
incoming data the most efficient way.
When GATT is enable BT_BUF_ACL_RX_SIZE does not have to be 73,
as this will just give segmented messages for the public keys
exchange during provisioning.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
After adding support for virtual addresses with collision (where two
Label UUIDs have the same virtual address), the format of the data in
the persistent storage with the Label UUIDs which a model is subscribed
to or publishes to has been changed. The recovery code is added and the
Label UUIDs will be recovered by picking first Label UUID matching to
the virtual address in the subscription list or model publication. This
options can disable the recovery code and save some flash if the
recovery is not required (e.g. virtual address support wasn't enabled
before this option was added, or the devices were unprovisioned before
upgrading to the version with this option).
Making this option as deprecated to be able to drop support of this
option and remove the recovery code eventually.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit adds the following features related to virtual addresses
support:
- Allows to store Label UUIDs which virtual addresses collide;
- Allows to decrypt messages encrypted with a virtual address with
collision;
- Allows to publish a message to a specific Label UUID to avoid virtual
addresses collision by adding a pointer to Label UUID to
struct bt_mesh_msg_ctx and struct bt_mesh_model_pub;
- Allows to differentiate Label UUIDs in the model's Subscription List
by storing all subscribed UUIDs in struct bt_mesh_model.uuids field.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
When LPN sends a segmented message to itself, it unnecesseraly polls
Friend. Since Friend doesn't receive this message, the segmented message
transmission will eventually fail (send end callback will return error),
while the message will actually be passed to the access layer.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit wrap the `settings_set_one` and `settings_delete` functions
in `bt_settings_store_one` and `bt_settings_delete`. By doing that the
Bluetooth settings can be managed in a single place.
This commit also introduce a new API to manage Bluetooth storage with
`bt_settings_store_*` and `bt_settings_delete_*` functions. Each
Bluetooth settings key have their own store and delete functions. Doing
that so custom behavior for key can be done if necessary.
This change is motivated by a need of keeping track of different
persistently stored settings inside the Bluetooth subsystem. This will
allow a better management of the settings that the Bluetooth subsystem
is responsible of.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
If a user tries to enable TWT too early in the connection, then we might
enter TWT sleep even before DHCP is completed, this can result in packet
loss as when we wakeup we cannot receive traffic and completing DHCP
itself can take multiple intervals. Though static ip address can be
assigned too. Reject TWT till Wi-Fi interface has
a valid IP address.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
The debug pins were configured in a board specific file, however, the
subsys/bluetooth/controller/ll_sw/openisa/hal/RV32M1/debug.h file
already contains board-specific pins, meaning there's no need to split
the information in 2 places. Move the GPIO configuration calls to the
DEBUG_INIT() macro in the controller debug header.
Note that in the future, Devicetree should be used to provide a
hardware-agnostic debug module.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
When config BT_CTLR_PERIPHERAL_ISO_EARLY_CIG_START is enabled, the
minimum accepted offset value in the CIS_REQ is the minimum defined by
the spec.
Add define CIS_MIN_OFFSET_MIN with value 500 us, as defined in the Core
spec. The previously used value of 400 us was incorrect.
Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit replaces the workarounds spread around the
drivers and subsystems with the updated PPP L2
interface.
Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
Currently, the L2 PPP subsystem is not using the network
interface subsystem appropriately. Here are the issues:
1. net_if_up hidden away internally in net L2 PPP
2. net_if_down not used at all...
3. net_if_carrier_on / off is not used, a workaround is
used instead, which results in duplicated code
4. L2 PPP does not listen for network events, instead
it needs the workaround callbacks from drivers.
5. The carrier_on workaround is delegated to a complex
and broken sys work queue item.
This commit fixes all above issues. net_if_up/down and
net_if_carrier_on/off now work as expected. workaround
for carrier_on/off has been removed.
Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
A mesh key type has been added to be able to choose the different
key representation for different security libraries.
The type as well as some functionality related to Mesh key
management has been added as a public API.
If tynicrypt is chosen then keys have representation
as 16 bytes array. If mbedTLS with PSA is used then keys are
the PSA key id. Raw value is not kept within BLE Mesh stack
for mbedTLS. Keys are imported into the security library
and key ids are gotten back. This refactoring has been done
for the network(including all derivated keys), application,
device, and session keys.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The auto-connect by name did not verify that the found device
was connectable before attempting to connect.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Even if PRB state is disabled, PRB can still be sent over GATT if Proxy
Privacy parameter is enabled. In such case PRB won't be regenerated.
To keep the privacy of the network, PRB should be regenerated when sent
over GATT regardless of PRB state.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
According to section 6.7, upon connection Proxy Server shall determine
value of Proxy Privacy parameter (sections 6.5 and 7.2.2.2.6). Depending
on that, it will either send Secure Network Beacon or Private Beacon to
Proxy Client, but never both.
Proxy Privacy parameter is determined by GATT Proxy, Node Identity
states and their private counterparts (section 7.2.2.2.6). Since
non-private and private states are mutually exclusive, it is enough to
only check either Private GATT Proxy state or Private Node Identity
state of any known subnet for which the state is currenty enabled.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Fix binding between GATT Proxy, Node Identity and their private
counterpart states according to sections 4.2.45.1 and 4.2.46.1
accordingly. When non-private state is enabled, the private counterpart
is disabled. The reverse binding prohibits change of non-private state.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This fixes the failure to use a resolvable private address in this
scenario.
1. call `bt_le_oob_get_local`, will generate and mark RPA as valid
2. start connectable adv w/ IDENTITY bit
3. start connectable adv w/o IDENTITY
4. RPA is not set (in `bt_id_set_private_addr`) because RPA
is still marked as valid
When EXT_ADV is enabled and the controller supports it, a different code
path is taken that doesn't have this issue.
Unconditionally invalidating the RPA when starting advertising works around
this issue.
Fixes#56326
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Instead of assuming pointers are 32bits wide,
cast them to the appropriate pointer arithmetic type.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Currently, when an incoming dynamic LE L2CAP connection is requested by
a peer, the connected() callback provided by the user is raised
*before* a L2CAP_LE_CREDIT_BASED_CONNECTION_RSP is sent back to the
peer.
In some cases the user will start sending data in the connected()
callback which would be received too early by the peer.
This commit fixes this behavior by making sure the connected() callback
is raised only after the connection response has been sent to the peer.
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
The RSSI value in net_pkt (net_pkt_cb_ieee802154.rssi) was used
inconsistently across drivers. Some drivers did cast a signed dBm value
directly to net_pkt's unsigned byte value. Others were assigning the
negative value of the signed dBm value and again others were offsetting
and stretching the signed dBm value linearly onto the full unsigned byte
range.
This change standardizes net_pkt's rssi attribute to represent RSSI on
the RX path as an unsigned integer ranging from 0 (–174 dBm) to 254 (80
dBm) and lets 255 represent an "unknown RSSI" (IEEE 802.15.4-2020,
section 6.16.2.8). On the TX path the rssi attribute will always be
zero. Out-of-range values will be truncated to max/min values.
The change also introduces conversion functions to and from signed dBm
values and introduces these consistently to all existing call sites. The
"unknown RSSI" value is represented as INT16_MIN in this case.
In some cases drivers had to be changed to calculate dBm values from
internal hardware specific representations.
The conversion functions are fully covered by unit tests.
Fixes: #58494
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Fix an issue causing a wrong Bluetooth identity value to be stored. It
was happening because the `bt_dev.id_count` was incremented after the
settings being stored.
To fix this, `bt_dev.id_count` is now incremented right before the ID
creation and is decremented if the ID creation failed.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
call k_thread_foreach_unlocked to avoid assertions caused
by calling shell_print while holding a global lock
Signed-off-by: Maxim Adelman <imax@meta.com>
Fix for not getting expected event information at application.
net_mgmt_event_notify_with_info() expects the address
not the value as pointer.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Fixes wrongly declaring duplicate local variables that already
exist and hiding the previous variables definitions.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
shell_strtoull used a unsigned long instead of a unsigned
long long to store the result in stroull, so the return
value may have been truncated.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix corner case when client RX request with same token than
own request where it wait responses.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
bt_uuid_str expects UUID in little endian while UUID encoded into
unprovisioned mesh beacon is encoded in big endian. sys_memcpy_swap will
change endianess of uuid so that bt_uuid_str can be used.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL_INF may not be present while
CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL is always present.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Prevent potential buffer overflow when encapsulated response is more
than CONFIG_USB_REQUEST_BUFFER_SIZE. Log error and truncate response if
USB control transfer request buffer is not large enough.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When calling the `terminate_call` the `inst` would always be NULL
as we had just terminated the call that we attempted to look up.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
A bug was introduced in one of my earlier commits: The shell does no
longer print the full extended address. Fixes the issue.
Fixes: #59125
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Compiling an application with CONFIG_NET_ZPERF=y leaving
CONFIG_ZPERF_WORK_Q_THREAD_PRIORITY at its default value would
systematically cause a kernel panic during thread initialization.
The Kconfig variable is NUM_PREEMPT_PRIORITIES by default. Application
threads may not define a priority lower than NUM_PREEMPT_PRIORITIES - 1,
though.
This change limits zperf's thread priority to a valid range. It does not
change the default value as it makes sense to default the thread
priority to the lowest possible value (which is NUM_PREEMPT_PRIORITIES)
but Kconfig does not allow for arithmentic. So the combination of
CLAMP() plus the Kconfig default will ensure min priority plus limit the
range to valid values no matter what has been defined as priority in
Kconfig.
Fixes: #59141
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
In previous patch fixing this issue, I've missed the fact that offloaded
drivers would not set the context->local address, which resulted in a
regression, where the previously introduced assert would hit in
offloaded cases. Not setting laddr is not a problem in case of
offloading, as it's only used in net_tcp_connect() which would not be
reached in this case.
Therefore I propose to remove previous patch to get rid of regression.
As an alternative fix, verify the laddr just before use, so that it is
only checked when native net stack is in use.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
BlueZ stack in Linux distributions use disable all
advertising sets when advertising is turned off.
Add missing implementation to support disabling all
active advertising sets.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rework internal header files to not have includes, rather
have the required includes in the c source files.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:
- Split out the macros and structs from hci.h to a new hci_types.h
- Merge the existing hci_err.h into the new hci_types.h
Fixes#58214.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add function to cancel any current proecedure. This is useful
in cases where the connection to one or more acceptors is lost
or if some acceptor does not respond to our requests for whatever
reason.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
An ASCS endpoint may go into either the idle or codec configured
state when a stream is released. However since we have such a high
coupling between audio streams and endpoints, we need to consider
the endpoint as having been released (i.e. gone to the IDLE state).
This is handled by a boolean state variable for now, but we may
want to consider a more generic approach where streams and
endpoints may be less coupled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When an audio stream in a bidirectional CIS is released,
it should not disconnect the CIS if there is still a stream
for the opposite direction streaming. Only if both streams
are not in a streaming state, should ASCS attempt to disconnect
the CIS.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Log status values in events as hex instead of decimal
to make it easier to compare to the spec and hci_err.h
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Without this fix, for every call to shell_vfprintf,
a prompt string and vt100 codes are printed too,
resulting in mangled log output.
Signed-off-by: Lars Knudsen <lakd@demant.com>
When a device disconnects we previously just unref'ed it and
set default_conn = NULL. However, if we are connected to mulitple
devices, it makes sense to set the default_conn to one of the
other connections.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the implementation of parse_search to use a
net_buf_simple and bt_data_parse to parse the LTV
search structure.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Set the secondary advertising PHY to a valid value when using
legacy advertising through the LE Set Extended Advertising Parameters
command.
Fixes#57885.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Implement APP_NAME define in Kconfig for Segger SystemView module.
Use APP_NAME in Systemview initialization function
Signed-off-by: Nathan Olff <nathan@kickmaker.net>
As the coarse tick of ACL prepare and CIG prepare jitter by
+/- 1 tick, hence when initially scheduling the CIG place it
with enough margin so that cis_offset_min calculated when
there already exists a CIG can be larger than peer's
cis_offset_min being negotiated.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrectly stored Broadcast ISO interval in
microseconds instead of storing in 1.25 ms units.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce a Kconfig BT_CTLR_ISOAL_SN_STRICT to relax the Tx
ISO Data SDUs being dropped due to strict check of sequence
numbers in ISOAL, i.e. dropped when ISO Data SDUs are
delayed from upper layer with respect to the current
payload number in the ISO radio events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
block_size_log can be 0x20 which will shift 1 by 32 bits which will
cause undefined behavior. Adding ULL to 1 is an option but this will add
little bit more code when debug option is enabled. So simply print the
logarithmic value.
Coverity-ID: 316387
Fixes#58951
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
GATT server was not doing enough check before udpating the CCC.
For example, a non-bonded client could update the CCC of a bonded client
by spoofing his address.
This fix the issue by dissociating the CCC configuration of a bonded and
a non-bonded peer. To do that, a new field is added to the CCC config:
`link_encrypted`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
In PR (#58723) has introduce another bug, that,
the flag ADV_FLAG_PROXY set before actually enabled.
When ctx:: BT RX call schedule_send will atomic_test_and_clear
ADV_FLAG_PROXY, but at this time, the proxy advertising will
not at advertising state, maybe in update params or set adverting
data phase,
so that, call bt_le_ext_adv_stop will nothing, and then call
k_work_reschedule --> send_pending_adv(at this time, the proxy
advertising actually enabled, but the upper layer clear proxy flags),
cause latest advertising unable start, because unable in advertising
state to update params(-EINVAL).
Fixes: #58721
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Coverity reported, that laddr pointer used in net_context_connect()
could be passed as NULL to net_tcp_connect() where it could be
dereferenced. This is because the actual setting of laddr to a valid
address structure was only done after
net_sin/sin6_ptr(&context->local)->sin/sin6_addr verification.
In practice though, the aforementioned pointer verification would always
pass, as the bind_default() guarantee that the context->local address is
set to an unspecified address (if it hasn't been set earlier).
Therefore refactor the code a bit: replace the pointer verification
with NET_ASSERT - only to assure that we can catch regression in case
for any reason the behavior of bind_default() changes. This should also
ensure that Coverity no longer reports that laddr is NULL when reaching
net_tcp_connect().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As since commit bff6a5c, params.dst.ext_addr is no longer assigned with
the ctx->coord_ext_addr pointer, but a endianness swap is included, it
should be assigned with a proper buffer before the memcpy.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Coverity reported potential issues with implicit signed/unsigned type
conversions and potential problems with this. Fix this, by casing the
byte-shifted data variable to uint64_t type explicitly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Coverity reported that assigning ret = 0 is pointless, as in any
scenario (loop continues or ends) the ret variable is overwritten
anyway, w/o using the assigned value. Therefore remove the needless
assignment.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
obj_inst_id should not be used directly to index the instance array, as
the instance ID is not tightly bound to the maximum instance count and
can exceed this value, causing out-of-bound access.
Therefore, perform some extra validation when choosing the array index
for the object instance to make sure we stay in the array bounds, or
return an error if there's no more room for more object instances, in a
similar way it's done for Security object.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case TCP connection is being closed from the TCP stack, due to for
instance retransmission timeout, the stack should also switch the TCP
state to CLOSED. Otherwise, there was a risk of dereferencing the TCP
context twice, for example if the application was in active socket
send(), and tried to reschedule data transmission.
Additionally, make sure that the TCP_CLOSED state handling is a no-op
state - otherwise, there is a risk that if packets keep incoming before
the application dereferences the TCP context on its side, TCP stack
will incorrectly dereference the context for the second time from
within due to current TCP_CLOSED state logic.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As long as we do not have NVS support in TBS, the subscriptions shall be
removed once ACL is disconnected to avoid potential crash on
reconnection, as the subscription parameters might be not valid anymore.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes repeated attempt to bt_tbs_client_discover that failed
because srv_inst->current_inst was not cleared during previous discovery
process. The issue seen in case the GATT Read CCID returned an error.
The code has been factored out to separate helper function.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing guard access to GATT read parameters.
The code checks `busy` flag and returns an error in case there's ongoing
GATT Read operation already.
Fixes: #58425
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The port we are connecting to is stored in network byte order,
thus, we need to convert it to the CPU's byte order before logging
Signed-off-by: Mark Oude Elberink <mark@oude-elberink.de>
`local_addr` would only be initialized if `context->local->sin*_addr` was
non-null. However, since `context` is a fresh context object, `local_addr`
always remains at its initial value of `INADDR_ANY`, which is propagated to
the context by `net_context_bind()`.
By populating `local_addr` using the TCP endpoint, `getsockname()` now
returns the correct local address.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
In order to support external IP stacks that might have Connection
ID support, the LwM2M engine should allow client to bypass default
behaviour.
New set_socketoptions() callback added into client context
that allows overriding all socket opetions. This is called
after a socket is opened, but before the connect() is
called. This cannot be combined with load_credentials() callback
on all platforms as for example nRF91 requires modem offline
when credentials are written. This would cause socket to be closed
as well.
Second change is that we allow fine tuning of what we do with
socket handle when QUEUE mode is enabled and engine enters idle
state.
First option would be to close the socket. That would cause
TLS Alert(Close Notify) to be send. This is a band choice if
LTE modem was already in PSM or eDRX power saving mode.
Second option would be to delay socket closing until we
are going to send LwM2M update. There TLS Alert is also send,
but most probably lost due to NAT mapping timed out. This
is a best choice for LTE modem with DTL session cache enabled.
Two new options are to keep socket open, and either stop listening
or just keep listening. Both of these options work fine when
we have DTLS Connection ID support.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
-- Implemented reporting of lost / missing SDUs for framed PDUs. This
should result in SDUs being released when only framed padding PDUs or
error PDUs are received.
-- Removed unused configuration params structure, storage and linked
APIs.
-- Reduced default logging level to INF instead of DBG.
-- Included debug logging messaged for framed consumption.
-- Removed separate latency_unframed and latency_framed and replaced
with a common sdu_sync_const as they are mutually exclusive for each
sink.
-- Restricted framed time stamp calculation only to situations where all
dependent information is available.
-- Corrected SDU sequence numbering to release starting at zero.
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Based on interpretation of Clarification Errata ES-22876 Request for
Clarification - Recombination actions when only padding unframed PDUs
are received, it was decided that an SDU should be released as "Missing"
when only padding PDUs are received for any SDU.
- https://bluetooth.atlassian.net/browse/ES-22876
This change will also assist streaming in the Common Central design
where the central was found to send only padding PDUs before streaming
starts.
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
In case lwm2m_socket_start() internal error, it should only do cleanup
on the socket, i. e. call lwm2m_socket_close(), not lwm2m_engine_stop().
The latter resets the entire lwm2m_context, which results in removal of
active observations.
This should not be done, as it collides with the RD client logic, where
connection resumption may skip the full registration phase, in result
not notifying the server that it should restart the observations.
At the same time, the RD client should clean the lwm2m_context when it's
done trying to update the registration and proceeds with regular
registration/bootstrap in the network error handler. In that case, only
the socket was closed, so the lwm2m_context needs to be reset
separately.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If the num_ase == 0xff then it is a special case that needs to be
handled like if num_ase == 0x01.
If there is an error with ase_id = 0x00 then the error cannot
be translated to a specific stream, so the callbacks may now get
NULL for the stream object.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When CCC or CF store on write is disabled and the other one is enabled,
leading to the delayed store being enabled. This cause the value of the
corresponding `n` selected option to not be stored at all.
To fix this, the checks to know if we need to store the CCC or the CF,
happening at the disconnection, are now ensuring that the CCC or the CF
are stored even if the one of them does not enable store on write.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Remove the lower check (BT_BAP_BASS_OP_SCAN_STOP) in
BT_BAP_BASS_VALID_OPCODE as it is always used on unsigned
variables, so no point in check if it is lower than 0.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add check for the index in the function itself, as well as where
we call it internally, to ensure that we do not attempt to access
invalid indexes of broadcast_assistant.recv_state_handles.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes missing `CONFIG_*` prefix.
The `BT_HAS_PRESET_CONTROL_POINT_NOTIFIABLE` option is already guarded
with `BT_HAS_PRESET_SUPPORT`, so it has been removed from `depends on`
condition.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes regression causing compilation errors seen when the
code is built without preset support (BT_HAS_PRESET_COUNT = 0).
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
nvs_sector_close has not been initializing nvs_ate.part, before
writing it to flash.
Fixes#58699
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Added assert when looking up the next instance, as the caller of this
function should ensure that the index is correct before calling
discover_next_instance.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the minimal value of an IN_RANGE is 0, then it is
a useless check, and the cases have been modified to
not use IN_RANGE. This also fixes some coverity issues.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The check was a && but should have been an ||. Fixed by moving
the check to a new if statement.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When notify_app is called for BT_TBS_CALL_OPCODE_TERMINATE
we did a lookup on the call index, but never did a NULL check
before dereferecing it.
This does not fix the issue that the instance will always
be NULL in this case, as we have terminated the call so
we cannot possibly look up the call afterwards.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The friendly copy always assumed that the friendly name could
fit in memory, which could cause overflows. Fixed by using
utf8_lcpy as that not only ensures that the copy is truncated
to fit in memory, but also ensures that it is null terminated
and truncated in a way that supports multi-byte UTF8 characters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The previous implementation would read from `addr->val[0]` before it was
initialized if the input string started with a colon ':'.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
If offset is only 32-bit, then it can never be > UINT32_MAX,
so added another conditional that only if the type (off_t) is
larger than 32-bit, we perform the maximum value check.
off_t is not a standard type and thus the size of it is poorly
defined, and are just defined as a signed integer type.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The check compared the levels against < BT_IAS_ALERT_LVL_NO_ALERT
which of course does not make sense given than the lvl_u8 is an
unsigned value that can never be < BT_IAS_ALERT_LVL_NO_ALERT.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use unsigned long long and shell_strtoull to get the ID of
OTS objects, as unsigned long may not be able to store all 48
bits.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a shell_strtoull function that works similar to
shell_strtoul except that it calls strtoull instead
of strtoul.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Ensure that scan_filter.addr is NULL terminated by only copying
the sizeof the buffer -1 and then always setting the last byte to
\0.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The number of buffer provided was verified in the final else block of a
long validation sequence. It would never be executed though, as one of
the conditions before would always evaluate to true.
As the number of buffers provided verification appears to be significant
in this case, as the buffers are referenced during other validations,
move this check at the beginning of the sequence instead. This also
eliminates the dead-code problem.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Use if-else-endif construction to avoid dead code.
Coverity-CID: 316484, GitHub issue #58539
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Just drop PENDING_RESET flag without checking it.
Coverity-CID: 316394, GitHub issue #58530
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Use ULL suffix to promote the type of the shift operand to uint64_t to
avoid undefined behavior when block_size_log is 32.
Coverity-CID: 316387, GitHub issue #58528
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Coverity is complaining:
CID 316017: Control flow issues (NO_EFFECT)
>>> This less-than-zero comparison of an unsigned value is never true.
148 for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) {
This is a false positive but we can still optimize the code and making
coverity happy by simply avoiding compiling the offending code when no
power states are defined into the DT.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
In places where we verify that the value of the long
variable does not exceed the limits of int32_t, we do
actually not need to compare the values if the two
types are the same size, which is often the case for
32-bit systems.
This fixes a variety of coverity reported issues.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When copying the address in cmd_scan_filter_set_addr we now
use strncpy to not copy more bytes than what fits. This
should already have been fixed with a check earlier in the
function, but coverity still complains.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For IEEE 802.15.4 compliance, the NET_L2_IEEE802154_ACK_REPLY option must
automatically be active if the radio driver does not AUTOACK and inactive
otherwise. No user interaction is required.
Future changes will deprecate this option and replace it by a standard
compliant automatic mechanism.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The IEEE 802.15.4 standard does not specify a "Sub-GHz" option.
Therefore this option will be deprecated in the foreseeable future.
Rationale: Selecting PHYs and frequency bands is abstracted by the
concept of channel pages (see IEEE 802.15.4-2020, 10.1.3).
Radio drivers may expose additional configuration options that
specify the low level frequency band, operating mode and other
PHY-specific parameters. Such parameters should be exposed on a driver
instance level, e.g. via devicetree or as runtime options of the driver.
PHY-specific attributes derived from driver settings (e.g. available
channels) can then be announced to L2 w/o the user having to be aware of
any implementation details of the specific PHY.
Future changes will introduce the necessary infrastructure to define
channel pages and other PHY-specific configuration options to
replace this option. New drivers should therefore not rely on this
option.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
In theory, coap_header_get_token() should only be used on already parsed
packets, and coap_packet_parse() would detect an invalid token length in
a packet. Coverity however complains about possible out-of-bound access,
as in theory the function can return token length up to 15. Therefore
add an extra validation of the token length within the function, to
avoid out-of-bound access due to programming errors and to make Coverity
happy.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Log level is stored on 3 bits thus in theory it can be set to 7
and yet accepted levels are up to 4 thus Coverity complains.
Adding assert that prevents use of levels above 4.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Now that `lorawan_init` only initialises data structures and does not
start the stack or communicate with a physical device, run the init as
soon as possible. This allows `lorawan_register_downlink_callback` to
be called much earlier by other init functions.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
When `CONFIG_BT_SETTINGS_DELAYED_STORE` is enabled (by default it is),
the local GATT server will delay the write to flash of the CCC and CF
values. The delay is defined by `CONFIG_BT_SETTINGS_DELAYED_STORE_MS`.
If a disconnection happen before that delay, the `bt_gatt_disconnected`
will reschedule the delayed store operation. But that operation will not
happen before `bt_gatt_disconnected` is complete, at this moment, the
CCC and CF values will have already been cleared.
To fix this issue, the delayed store operation is now done during the
`bt_gatt_disconnected` function.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
When proxy advertising enabled, but at same time, the
connection event report, will cause `ADV_FLAG_PROXY` not
set, so cb `connected` will not be process, cause mesh message
unable to sent.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/58721
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Only set a cpu as active (on pm subsystem) when the cpu is effectively
initialized. We cannot assume on pm subsystem that all cpus were
initialized since when the option CONFIG_SMP_BOOT_DELAY is used cpus are
initialized on demand by the application.
Note that once cpus are properly initialized the subystem is able to track
their status.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Some Bluetooth controllers (Nordic Softdevice) now use
`BT_HCI_ERR_INSUFFICIENT_RESOURCES` to signify when advertising sets
cannot be created, instead of the old `BT_HCI_ERR_CONN_LIMIT_EXCEEDED`.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
On CIS disconnect, the central will clear all data paths.
However hci_le_remove_iso_data_path will fail if attempting to remove a
data path that has not been setup, so if only the CTLR_TO_HOST
direction was set, and the HOST_TO_CTLR bit was set, the
function returned an error and never attempted to clear the other
direction.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
On CIS disconnect, the peripheral will clear all data paths.
However ll_remove_iso_path will fail if attempting to remove a
data path that has not been setup, so if only the CTLR_TO_HOST
direction was set, and the HOST_TO_CTLR bit was set, the
function returned an error and never attempted to clear the other
direction.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Before this change we had 2 top-level Doxygen entries for Testing APIs:
- Zephyr tests
- Zephyr testing suite
This patch creates a single top-level group to contain ZTest and FFF
extensions.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The buffer_output interface is called a few times during one core dump,
so we need to maintain a memory write pointer to prevent data overwriting.
Signed-off-by: Rander Wang <rander.wang@intel.com>
This patch fixes commit b70f92e570
("net: buf: keep memory alignment provided by k_heap_alloc and k_malloc").
One-line was overlooked in the above patch and may result in a
cloned net_buf using a data block that has already been freed.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Although websocket_recv_msg function accepts timeout parameter, the
functionality was rather limited, allowing only to either work in
non-blocking manner, or to block indefinitely. Any timeout value
other than -1 (forever) ended up in non-blocking operation.
This PR fixes this by implementing a basic timeout mechanism, built on
top of poll(). For now on, only timeout of 0 will result in non-blocking
operation, any other timeout will make the function block for the
specified amount of time.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Up until now, it has not been possible to reconfigure a CIG and its
CISes after initial configuration, without first removing the CIG.
With this commit, le_set_cig_parameters allows the following
reconfiguration operations in configuration state:
- Set new CIG configuration parameters on existing CIG
- Iteratively configure single CIS (of more CISes)
- Increment number of CISes via multiple configuration calls
- Keep handle- and CIS_ID relation
Changes:
- Pass handles in le_set_cig_parameters from ll_cig_parameters_commit
via output variable.
- Implement CIG state variable instead of 'started', with states
IDLE/CONFIGURABLE, ACTIVE and INACTIVE.
- Implement ll_conn_iso_stream_get_by_id for easier access to specific
CIS.
This fixes the following CIS Central EBQ tests:
- HCI/CIS/BI-10-C
- HCI/CIS/BI-11-C
- HCI/CIS/BI-13-C
- HCI/CIS/BV-05-C
Signed-off-by: Morten Priess <mtpr@oticon.com>
The path_dir variable of BT_HCI_OP_LE_REMOVE_ISO_PATH must be bitflags,
with the following meaning:
- BIT(0) : DIR_HOST_TO_CTLR
- BIT(1) : DIR_CTLR_TO_HOST
Signed-off-by: Morten Priess <mtpr@oticon.com>
According to the Core spec, the direction parameter passed to this function
should be bitfields, i.e.:
- BIT(0) : DIR_HOST_TO_CTLR
- BIT(1) : DIR_CTLR_TO_HOST
Signed-off-by: Morten Priess <mtpr@oticon.com>
In `private_random_update`, when first beacon is advertised, there could
be a case when uptime is less then interval * 10s
(`priv_random.timestamp` is equal to 0 for first beacon). Then, Private
Random value will not be generated and will be set to all zeros.
New Private Random must also be generated before Random Interval
expires, when KR or IVU flags are changed. Reset timestamp to 0 on
`bt_mesh_beacon_update` to generate new Random value.
Do not generate new private random if it won't be used (Private Beacon
state is not enabled).
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
In order to allow the TLS accept() call to be interrupted, it should
release the top-level TLS socket mutex before blocking. As the
underlying TCP accept() makes no use of TLS resources, and has its own
mutex protection, it should be safe to do so.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The accept() so far would block with mutex held, making it impossible to
interrupt it from another thread when the socket was closed.
Fix this, by reusing the condvar mechanism used for receiving. It's OK
to use the same routine, as underneath accept() is monitoring the same
FIFO as recv().
Additionally, simplify k_fifo_get() handling in accept() - as the
waiting now takes place on condvar, it can be used in a non-blocking
manner. Blocking accept() call should not reach this place if there's no
new incoming connection waiting on the FIFO.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The MPU stack guard can move the start address of a thread stack.
Don't allow both options to be enabled at the same time.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Removed few VIF properties which are being hardcoded
Updated the script to parse source VIF XML and add information to
the output
Added optional Kconfig option to configure custom source VIF XML path
Cleaned up the code
Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
The IN_PROGRESS status is a specital status that can be sent during
handling a host command. Synchronous backends don't support it, so
an additional check is required.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
A function to send Host Command response is needed for commands that
that sends IN_PROGRESS status or doesn't return e.g. perform reboot.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Installing recv callback with net_context_recv() after
net_context_connect() left an opening for a possible race - in case the
server send some data immediately after establishing TCP connection, and
Zephyr did not manage to install the callback on time, the data would be
lost, corrupting the stream.
This can be avoided, by installing the recv callback before the
connection is triggered. As net_context_recv() called w/o timeout only
registers the callback function, it should have no negative impact. The
only change on the TCP side is when the connection is closed - in case
TCP is in connect stage, do not call the recv callback (before this
change it'd be NULL at that point).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This ensures that when running a combined host + controller build, the
ISO features in the controller are enabled automatically.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Fix the wrong calculation for inverting implemented by
commit 7068587505
("fb: cfb: support inverting with coordinates that do not align
with the tile")
Remove the cfb_invert_area() calling.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Fix the wrong calculation for inverting implemented by
commit 7068587505
("fb: cfb: support inverting with coordinates that do not align
with the tile")
Fixed not enough consideration when the drawing area height
is eight lines or less.
Simplify to XOR calculation.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Add the `draw rect` command to execute the `cfb_draw_rect()` API.
This command render rectangle.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Add the `draw point` command to execute the `cfb_draw_point()` API.
This command render single dot.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Support for multiple instances of a class implementation,
and the ability to register an instance to a configuration
at runtime, requires a mechanism to add a string descriptor
and update its index based on the total number of descriptors.
We also need to handle some special string descriptors like
Product or Serial Number provided by the application.
Marked as such by using specific macros, these descriptors
can be sorted out by the stack and the device descriptor
indexes are updated automatically.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add and use specific macros for manufacturer, product, and
serial number string descriptors.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
While this does not provide much of an advantage yet,
it will allow us to add descriptors and assign an index
more easily in the next commit.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
When we enable USBD shell support with samples like cdc_acm or mass,
there would be another USB device context besides the one provided
by the shell. This patch introduces a new command to select an
alternate context to be used by USBD shell commands.
Also fix the type where "add" command should be "remove".
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
If we try to reuse a string descriptor node, the content will
be corrupted because the device stack assumes it is still ASCII7
encoded. Add a flag to indicate that a descriptor node contains
UTF16LE encoded content.
And while we are at it, add a flag to indicate that the SN string
should not be obtained from the hwinfo API.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
There may be more than one context using the same device, for example,
if the shell module is enabled. Check if another context that uses
the same device is initialized.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
At the shutdown of USB device stack we have to cleanup and
remove all registered class instances and string descriptors
from a configuration.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Foobaz interface will be renamed and added as a standalone part
to serve as an API example in a subsequent commit.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The coap client takes requests and provides responses
asynchronously to callback given in a request.
Currently supports only 1 request at a time.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Added Kconfig options to make HAS characteristics that has notify as
optional property selectable and thus optional. These settings are
global, meaning that a chosen notify property will be used for all
registered has instances.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
OS management's reset is optional, therefore only imply reset
instead of selecting it, so it can optionally disabled if not
needed.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Expands a bitfield name from nh_ver to nh_version so it is more
obvious what it is. Also changes the version that goes into the
response to indicate what the maximum supported version of the
protocol is for a device
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
In case recv() call was waiting for data, and the socket was closed from
another thread, the recv() call would not be interrupted, causing the
receiving thread to be blocked indefinitely.
Fix this, by signalling the condvar the recv() call is waiting on
close(). Additionally, close will now set the socket into error mode,
with EINTR as the error condition, allowing the blocked calls to
recognise that the call was interrupted, and return a proper error code
on the event.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
All posix arch boards are required to provide the same
tracing/print API.
So, instead of having a different driver for native_posix and the
bsim boards, let's have a common one which uses this API.
This in turn results in the printk strings being printed in
the same underlaying backend as before with individual drivers.
A part from this, the native_posix console driver was a full
backend for the now long gone Zephyr console shell
(named legacy_shell from 527256501f
until it was retired in fd0b7f7767).
The whole input handling in this driver was dead code
(since 140a8d0c8a)
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Optimize the read procedure when receiving long notifications
by storing the already notified data in the buffer if the
client instance is not already busy. If it is busy we have
no way to store it, and will just need to read the entire thing
later.
This also modifies when we reset the ATT buffer. Instead of reseting
when we want to use it, we reset it when we are done using it.
The reason for this is to avoid making state checks before calling
long_ase_read to determine whether it should reset the buffer
or not.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for long notifications ASE notifications
by doing a long read if the notification has length of
the maximum MTU.
This behavior is currently not defined by the BAP spec,
so may not work with all devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for long writes for the unicast client and server.
This reuses the ATT buffer for long reads.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The function is optionally used by the module, and should be
guarded to avoid compiler warnings about unused functions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
After removing the high default for MCS, it was discovered that
the TBS client requires a significant amount of buffers to work
properly as well. Added the requirement as a build assert that
depends on which optional TBS client features are enabled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
A recent change in MCS significantly reduced the requirement
of L2CAP_TX_BUF_COUNT and should now work with any value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This reworks the UDP transport to resolve some issues with object
interactions and streamlines the code.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
No reason to continue zcbor encoding of slot information for image
list when already failed at encoding version.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Image list should also flag pending slot as permanent.
This follows the image list for swap configuration where slot
confirmed for next boot is marked as permanent.
The difference is that in DirectXIP mode it is still possible
to erase slot marked as pending and permanent, before restart
happens.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Adds callback checks to other fs_mgmt group file access functions
which allows for file access control, and moves where the callback
is triggered for uploads and downloads to prevent getting the
callback multiple times for the same file. The callback struct has
been modified so applications using the previous signature will
need to be updated.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Use the bt_bap_stream_ops sent callback and not a timeout
while streaming the sine tone in the bap shell to avoid
jitter when the shell is busy.
Signed-off-by: Lars Knudsen <lakd@demant.com>
Events in the power-management policy context are defined as any source
that will wake up the system at a known time in the future. By
registering such event, the policy manager will be able to decide wether
certain power states are worth entering or not.
Events will bypass the ticks argument received by the policy manager if
they occur earlier.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Latency is always specified in microseconds, so apend `us` to the
relevant variables. Also, make it clear that latency request structures
are private (they are just exposed publicly to allow static allocation).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Added a guard before attempting to access
svc_insts[cur_inst->idx + 1], as that code can only ever be value
if CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES > 1.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Guarding code that uses __ASSERT with IS_ENABLED seemingly
does not work, and still gives unused variables (rank_1 and
rank_2). Modified the guard.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Split the CAP initiator broadcast start API into a create
and a start. This will allow users to create the broadcast source
without starting it immediately, making it possible to get the
BASE etc. without an active advertising set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This is an alternative API for the L2CAP receive functionality. It
allows an application the receive L2CAP segments directly and manage
credits explictly. The API is guarded by an experimental kconfig option.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/57485
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Variable declarations are moved to the beginning of the block in
which they are visible to ensure consistency with the remainder
of the code base.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The encryption-only security level has been removed from the
spec, see IEEE 802.15.4-2020, 9.4.2.2 Security Level field.
The standard provides the following explanation (ibid):
"This security level is deprecated and shall not be used in
implementation compliant with this standard. Devices that
receive frames with security level 4 shall discard them, as
described in 9.2.4. The counter mode encryption and cipher
block chaining message authentication code (CCM) used allows
trivial changes to the underlaying encrypted data unless
data authenticity is provided, thus using data confidentiality
only is not useful. In the case of TSCH mode, security level 4
allows higher security level frames to be downgraded to
security level 4 frames."
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
See IEEE 802.15.4-2020, 7.2.2.11 Source Addressing Mode field and
7.2.2.9 Destination Addressing Mode field, table 7-3: The
previously deprecated "Simple addressing mode" was removed
from the spec.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Currently the insertion of an authentication tag requires a memcpy() call
and breaks encapsulation.
This change removes the need for memcpy() and improves the encapsulation
by calculating and reserving the required headspace early on while
keeping insertion where it belongs in the outgoing security procedure.
This is also a preparation for improved standard compliance of the
outgoing security procedure which is scheduled for a later commit.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The naming of variables and arguments containing the authentication
tag length was inconsistent:
* Naming inconsistency between header "length" vs. authtag "size"
in the same API calls
* "Tag" rather than "Auth[orization ]Tag" in external API calls
which is too generic from a compliance and readability viewpoint.
This is in preparation to zero-copy authentication support.
Almost all call sites will be subject to required structural changes
later on so no relevant git blame noise/history loss will be introduced
by this naming change in the long run.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Over time, some non-standard concepts and extensions were introduced
into the stack (in KConfig, in drivers, in the internal API and into the
implementation) which makes introduction of additional standard-
compliant extensions like TSCH (and others) unnecessarily difficult.
To introduce extensions like TSCH it is required for the IEEE 802.15.4
stack to become more structurally aligned with the standard again which
will be the focus of some of the upcoming preparatory changes.
One way to check and prove standard compliance is to reference the
standard from within the source code. This change therefore introduces
inline references to the IEEE 802.15.4-2020 standard wherever possible.
Deviations from the standard are documented with TODO or deprecation
labels to be addressed in future changes.
In the future, new code introduced to the IEEE 802.15.4 stack should
be documented and reviewed for standard-compliance to avoid further
divergence. Most importantly:
* MAC/PHY configuration (via net mgmt, radio API, devicetree or
KConfig) should always be directly linked to well-defined MAC/PHY
PIB attributes if visible to the MAC API or the end user.
* Net management/shell/radio API commands should have a documented
reference to the corresponding MLME action from the standard.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The unicast client did not properly clear the receiver_ready flag
when going out of the streaming or enabling state. This caused
incorrect behavior when attempting to restart streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The BT_CTLR_DF_SUPPORTED KConfig was a wrapper for DF related features
set that are supported by Zephyr's BLE Controller. At the same time the
KConfig is used by Host in compound build to enable BT_DF. That makes
the whole thing a bit coupled with Zephyr's controller.
External implementations of controller must provide same feature set
as Zephyr's Controller or there will be an error during build.
The PR moves the Zephyr's Controller DF supported features set to
Kconfig.ll_sw_split, where it is included only when BT_LL_SW_SPLIT
is selected. BT_CTLR_DF_SUPPORTED is now a top DF_SUPPORTED KConfig
option that enables possibility to select actual DF features.
That allows to select individual set of DF features by any controller
implementation and makes possible to enable BT_DF and build selected
DF Host features.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Add implementation of the Telephony and Media Audio Service, as well as
two sample applications.
tmap_central reflects a smartphone implementing the Unicast Media Sender
and Call Gateway TMAP roles.
tmap_peripheral reflects an earbud implementing the Unicast Media
Receiver and Call Terminal TMAP roles.
Upon connection, tmap_central starts an audio stream using CAP Initiator
APIs.
CCP, MCP and VCP are discovered and used to send example commands.
Future improvements: 2-earbud support, add TMAP Broadcast roles,
update with new CAP Acceptor/Commander APIs as they become available
Signed-off-by: Silviu Petria <silviu.petria@nxp.com>
atomic_inc(&buffered_cnt) return previous count of log messages,
should use current count to compare with threshold config value.
Signed-off-by: Dong Wang <dong.d.wang@intel.com>
Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
According to RFC768 UDP packets with zero checksum are allowed with IPv4.
Enable this by default.
For example, some routers use zero checksum in DHCP packets.
Signed-off-by: Nils Ruf <nils.ruf@endress.com>
The current approach of failing the build on ztest with no optimization
broke coverage builds, and generally raised some concerns about being
too aggressive.
Downgrade the error to a warning and rework the option to inhibit the
warning, while also dropping it automatically for POSIX (that are not
really affected by stack size) and coverage run (that always runs with
no optimization).
Will reconsider this down the road if we still see issues filed for the
tests broken with no optimization and no further tuning.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Changes the warning from being text in Kconfig for filesystem
management as a whole to being a cmake warning which is displayed
if the user has not enabled file access hooks with a link to the
documentation on how to set them up.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add a config to decide if a new dedicated thread for Host Command is
created during initialization.
If not, the ec_host_cmd_task has to be called by another thread to
handle host commands.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
The command at most takes 11 args. argc = num of args + 1 (command
name) => 12. We substruct 3 from argc (cmd name, mod id, addr). This
gives argc = 9 when all args are provided for vendor model.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The scope for the burst number for tx and rx is currently at module
level in both lll_central_iso.c and lll_peripheral_iso.c
This PR puts the scope to the lll level
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Many tests are known to fail when built and no compiler optimizations.
Add a CMake check to error out when building a ztest based test with no
optimization, ask not file issues about it but also adds an opt-out
option to bypass the error for tests are actually designed to work in
this setup.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The current implicit MAC payload length algorithm (based on
an otherwise irrelevant footer pointer) produces invalid
(non-standard) values for beacon and command frames.
This change produces standard-conforming MAC payload length
values and simplifies access to payload length.
It would have been possible to fix the current footer pointer
based approach but there are arguments in favor of the new
approach:
- The footer pointer is used nowhere in the current code
base and makes length calculations rather non-obvious.
- The new approach does not use more memory and is easier
to understand and use.
- This change is a first step to support of IEEE 802.15.4
information element (IE) support. At a later stage the
distinction between MAC payload length and frame payload
length will be introduced and become relevant to
distinguish between header and payload IEs. At that point
the current implicit length calculation algorithm will
break down anyways.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The current IEEE 802.15.4 stack would not accept beacons
unless hardware filtering was active.
This change fixes the bug.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The shell command calling the IEEE 802.15.4 scanning procedure
did not properly release its net management event callback.
This change fixes the memory leak.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Active and passive scanning requires the channel and PAN to
be set temporarily.
This change ensures that the temporary configuration will
be reverted even when the scan is aborted due to an error.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Beacon and command frames are consumed by the IEEE 802.15.4
stack internally and should therefore be released before
returning control to the generic net stack.
This change fixes the resource leak.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This makes it explicit that enabling `BT_PRIVACY` will make the device
_use_ private addresses.
The device can still resolve RPAs when `BT_PRIVACY=n`.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
`bt_mesh_settings_store_schedule` should be called only when
CONFIG_BT_SETTINGS is enabled.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
The minimal value of BT_CODEC_MAX_DATA_LEN is 1, so it
is always > 0.
Includes to audio.h in shell bt.c was removed as audio.h
should only be included if BT_AUDIO=y.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The Kconfig option was not used anywhere besides some checks
that should have checked against CONFIG_BT_CODEC_MAX_DATA_LEN
instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In certain scenarios, it may be necessary to get values of additional
options from the application layer. With this patch, this can be
accomplished by registering a callback with the DHCP client.
This change has been tested using the posix build in qemu.
Signed-off-by: Matthias Breithaupt <m.breithaupt@vogl-electronic.com>
Add a new endpoint callback that is used to report the found
ASEs during BAP discovery, rather than calling
the discovery callback with optional values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a new pac_record callback that is used to report the found
PAC records during BAP discovery, rather than calling
the discovery callback with optional values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove the BAP unicast client specific discover parameter struct.
This make the BAP discover work more similar to the other
profiles.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The direction has been moved to a function parameter instead,
and we keep a local copy of the value in the stack instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix BT_CTLR_SW_SWITCH_SINGLE_TIMER to correctly disable the
PPI group used to switch radio Tx/Rx. The issue was
uncovered when adding coverage in BabbleSim test.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Prepare to replace HAL_RADIO_ENABLE_ON_TICK_PPI with
independent use of HAL_RADIO_ENABLE_TX_ON_TICK_PPI and
HAL_RADIO_ENABLE_RX_ON_TICK_PPI.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Allow to periodically initializes/disables the modbus interface.
Switch from modbus line discipline to serial and switch back to modbus.
This can be required when the serial is shared by two sensors
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This fixes invalid conn unref that happens in ACL disconnected callback
context. When the ACL disconnects, the implementation waits for CIS to
be disconnected if connected. If the client won't disconnect the
CIS, the implementation initiates the disconnection by itself, from
delayed work context. Thus the ACL conn object has to be remained at
that time because it indicates whether the ASE object is in use or not.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Once the ACL disconnects, the implementation releases the related
endpoints. The ops->released callback is called once ASE enters IDLE
state, thus there is no need to call it explicitly.
This fixes repeated ops->released callback call.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This change splits the IEEE 802.15.4 test into two separate
test profiles, one with and one without sockets enabled to ensure
that both configurations work correctly.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The current IEEE 802.15.4 stack assumes that drivers will
not provide more than one fragment in incoming packages.
This change exposes and enforces the pre-existing assumption
made by the implementation.
So far this is not a limiting restriction as MPDUs with more
than 127 bytes are not supported yet. It will probably have to
be changed as soon as larger payloads (as allowed by PHYs
introduced more recently into the spec) might want to allocate
smaller fragments.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
When changing IEEE 802.15.4 security settings or setting security
to 'none' then the previous session must be cleaned up to avoid
resource leaks.
This change introduces proper clean-up of the security session.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
LittleFS may be used not only for Flash devices, we can use it for
block devices too.
Add possibility of building LittleFS for case when
CONFIG_FLASH_MAP and CONFIG_FLASH_PAGE_LAYOUT are disabled.
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
LittleFS may be used not only for Flash devices, we can use it for block
devices too. So, I have changed dependency rules and remove dependency
on flash map from FILE_SYSTEM_LITTLEFS.
Signed-off-by: Laczen JMS <laczenjms@gmail.com>
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
There is a check in bt_conn_auth_cb_overlay function which validates
if content of the callback structure is correct, but there is no
NULL-check on the structure pointer itself, which could result in
NULL pointer dereference.
It should be possible to set the callback structure pointer to `NULL`
using bt_conn_auth_cb_overlay function if the application requires
ex. Just Works pairing for one Bluetooth identity and global
callbacks are configured for advanced pairing scheme (like Passkey
Display) for other Bluetooth identity.
Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
This implements the deferring of characteristic value notifications to
be sent from system work queue thread context. Notifications issued from
Bluetooth Rx thread might not be sent if there are no L2CAP Tx buffers
available, as the operation is non-blocking to prevent deadlock while
waiting for free buffers.
The same operation issued from other thread context is blocking,
meaning that the thread waits until L2CAP Tx buffers become available.
Thus it's guaranteed the notifications will be sent.
With this patch, the control point operations become blocking until the
control point response is sent. Meaning there might be only one
pending operation waiting for completition. This might be further
improved by queuing the operations if needed.
Fixes: #57444
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Uses the new error system to report an error if the user provides
an invalid format for the OS info command.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The general handler may provide buffers for a backend. Use ranges to
check if the provided buffer is used, because the backend may shift the
beginning of the buffer to make space for preamble.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Add a separate config to enable autoinitialization of the host command
subsystem, called by the chosen backend.
It allows setting the chosen backend without autoinit.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
The application code may need inside information about the host command
e.g. the thread id. Add a function that returns the main host command
structure which contains such data.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
For debug usage is added backend for memory window.
Coredump is being dumped in raw data. It needs to be converted to
ACSII for later analysis. Data is written to telemetry slot
in memory window which is a space where is located all debbug
information.
Signed-off-by: PawelX Dobrowolski <pawelx.dobrowolski@intel.com>
This change makes VCS Volume Flag characteristic Notify property
optional and selectable through Kconfig.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Shifting "timeout <<= conn->zwp_retries" by more then 63 bits results in
undefined behaviour.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Universal Serial Bus Mass Storage Specification For Bootability requires
that device shall accept Bulk-Only-Transport bCBWCBLength of 12 for all
commands documented in the specification. Allow padding for commands
documented in Bootability specification, but leave others intact.
This fixes Request Sense on Windows 11 which previously failed due to
bCBWCBLength being 12 instead of 6.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Image list will only report active flag for active image and pending
flag for other slot, but only if image in that slot has higher
version than currently running image.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
If a socket has DSCP set then the packets from the socket should also be
marked with appropriate priority in case traffic classes are used in
networking stack.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
This is needed for applications that rely on WPA supplicant being
in disconnected state before issue subsequent commands (e.g., issue scan
immediately after disconnect fails, until disconnect is completed).
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Fix Central CIS SN and NESN for skipped events during CIS
setup. It is possible that CIG event may overlap the ACL or
other events at the CIS create instant, and hence have non
zero lazy value during the CIS setup events until CIS is
established.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS offset_min calculation to consider that ACL interval
and ISO interval can be dissimilar and the offset value has
to be compensated for the latency until the instant at which
the offset is used.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix SN value on Peripheral CIS event abort. Adjust the SN
value based on the burst number such that the ISO data where
transmitted as normal.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
- Add a new API `rtio_sqe_cancel` to attempt canceling a queued SQE
- Add a new syscall `rtio_sqe_copy_in_get_handles` which allows getting
back the SQE handles generated by the copy_in operation so that they
can be canceled.
Signed-off-by: Yuval Peress <peress@google.com>
The idle state was never set, thus providing a poorly
implemented state machine. Updated the code so that unused
code was removed and so that the idle state is properly set.
Optimized the way that a state is set for all endpoints
for a broadcast source with a new function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the FIN_WAIT_1 any incoming data is dropped, but anknowledged. Add a
check to see if the data is already acknowleged to prevent double
acknowledging of the data and bringing the acknowlegde counter out of
sync. When the acknowledge counter gets out of sync, the connection will
never properly terminate any more.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Fix peer ISO feature support check, by using feature support
bit instead of whether locally supported bit value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use swapped role specific features bit to calculate features
usable by local device, on feature exchange procedure.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Central ISO assetion failure on being established due to
regression in commit a53d89450a ("Bluetooth: controller:
fixing CIS establish flow for refactored LLCP") that
required changes due to Create CIS LLCP being refactored.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The phy was converted both when reading from the event
and when reading from the sync, leading to incorrect
value in the synced callback.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
The calculation in interval_to_sync_timeout did not take into
account that the periodic advertising sync interval was in units
of 1.25ms, and not ms.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
STRUCT_SECTION_ITERABLE cannot be used with arrays, because of
preprocessor tokenization issues.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Converts the list of functions for registering an MCUmgr SMP
transport from function arguments to a single list which contains
the function pointers.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a new map to responses that command handlers can use to
return result codes of functions themselves, unrelated to SMP
error codes. This is achieved by adding an optional "ret" map
which contains a 16-bit "group" and 16-bit "rc" error code,
this map will not be included if the "ret rc" is 0 (which
implies success).
In order to allow this, a new version of the protocol has been
which can be indicated for use by setting a bit in the header.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
After sending a CoAP block and receiving the CONTINUE response
code the next block is sent.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
Allow to use a buffer for the complete message body if block transfer is
enabled. This buffer is used when serializing the message. For sending
the message the body is split into blocks.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
The function gets the the BLOCK1 option from a received message
and extracts the block number, block size and has-more flag from
it.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
The function adds a block option to a CoAP message. If the message
is a request the BLOCK1 option is added. Otherwise (response) the
BLOCK2 option is added.
Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
Add support for long writes to the control point
to handle e.g. metadata that's larger than the MTU.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Increase the size of the ase_buf to support
the maximum size of the Codec Configuration
and Metadata.
The ase_buf is not also guarded by a semaphore, so no
more than one thread will use it at any time. This is
needed as ase_status_changed can be called from multiple
threads.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for long read by adding a read_buf and store
the data when long data is being read.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of using the read by UUID, we do a "proper"
discover by UUID. The reason for this is that read by
UUID is not mandatory in the BAP specs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of using the read by UUID, we do a "proper"
discover by UUID. The reason for this is that read by
UUID is not mandatory in the BAP specs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of using the read by UUID, we do a "proper"
discover by UUID. The reason for this is that read by
UUID is not mandatory in the BAP specs, and that we need
to do a long read on the PAC records anyhow, and that
cannot be done with the read by type/UUID.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a new struct unicast_client to hold all the conn-specific
data for the Unicast Client implementation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The maximum size of the characteristic is BT_ATT_MAX_ATTRIBUTE_LEN.
The previous size limited the size of the characteristic to
the maximum possible MTU, thus not utlizing support for the
Read Long procedure.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a semaphore to guard the read buf. The reason for this
is that the read buf is populated from either the BT RX
thread, or the workqueue thread. The semaphore ensures
that both threads will never have attempted to
add any data to the buffer at the same time.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
On connection clean-up release nodes held by LLCP. These are released
in two steps, first on LLCP terminate (in local/remote) by moving
to rx/tx_node_release chains, and then on conn_cleanup_finalize
nodes are released back to appropriate mem-pool/queue.
Rename abort functions to refer to terminate.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Instead of using the node ref used for TX ack for storing a TX node
pre-allocated in case of NTF RX node availability delay, introduce a
separate store to TX node. This to avoid misunderstanding on clean-up
in terminate flow.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Latest modification to LLCP removed 'monitoring' of cis->established
flag in LLCP, relying instead on signal through ULL.
For this to work properly the signal must also be generated, so this is
introduced. Note - checking of cis->established flag could be removed
if caller ensures only calling once (on establish condition)
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
When possible re-use the already allocated RX node for notifications.
Store (retain) RX node and Link element on RX if NTF could occur.
Pass link element to LLCP (ull_cp_rx()) together with RX node.
New RX node type RETAIN introduced to signal retention
When no RX node is available allocate one and hold off TX on procedures
until such time that a node is available for NTF.
In case waiting for NTF buffer avail is needed, allocate and store TX
node to use for TX once NTF becomes available.
CIS Established (incl. timeout handling) is now handled entirely as a
specific event driven by ull_conn_iso - ie removal of procedure check
of cis->established and cis->expire, as this is doubling mechanism
in the conn_iso context.
Unit test and helpers updated to handle new node type.
Function ull_cp_release_ntf() was used only in unit test, so moved to
helper context.
Updating release_ntf to handle the fact that with piggy-backing in test
context the node used for NTF can be from two different memory pools
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Use iterable sections to handle devices list. This simplifies devices
implementation by using standard APIs.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add a trailing _ to the section iterable name. This is useful, for
example, to implement numeric sorting like this:
SORT(.z_device_LEVEL_?_)
SORT(.z_device_LEVEL_??_)
Without the trailing _ it would not be possible to use the ?? wildcard
without triggering into trigraphs issues, because linker-defs.h header
is included in C files as well.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
While it may be useful in some contexts, this information can be
obtained at compile time. Removing this command allows to migrate the
device infrastructure code to standard iterable sections, done later.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
It is no longer possible to select image for test or confirm
when MCUboot has been configured for DirectXIP.
MCUboot flags, in image trailer, are now ignored in DirectXIP
mode allowing to use entire slot for image upload.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Image management is now disabled by default if MCUboot
is configured for single application mode.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds img_mgmt_set_next_boot_slot function which uses
boot_set_next, from MCUboot/bootutil, to set application slot
for next boot.
The img_mgmt_set_next_boot_slot is intended to replace
img_mgmt_state_confirm and img_mgmt_state_set_pending.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds img_mgmt_active_slot() which allows to get
active (running) slot for given application image.
Added img_mgmt_active_image() allows to get number of image running
on current MCU core.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
There is no need to store the RPA in bt_addr_le_t structure, as the
bt_addr_le_t.type is unused anyway. Both bt_rpa_create and
bt_id_set_adv_random_addr take bt_addr_t as parameter.
Saves 1 byte of address type.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes uninitialized RPA value for BT_ID_DEFAULT.
The regression has been introduced in
8d6b206064.
As the result, the private address was not created and the advertising
was started with 00:00:00:00:00:00 address.
In case of the other advertising ID's, those are initialized
from id_create context.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The bt_gatt_indicate() expects its parameters to remain valid while the
indicate procedure is active. But the `sc_range` variable was local to
the function. It is assigned to the `data` field and passed on to
bt_gatt_indicate(). The memory associated with `sc_range` goes out of
scope as soon as the function returns thereby breaking the contract of
the API. This dangling reference will lead to undefined behavior.
This is now fixed by making the `sc_range` array static and further
making it an array of arrays, as the sc_range may have different values
for each connection.
Found as violation of MISRA C:2012 and CERT DCL30-C by sonarcloud.
Signed-off-by: Balaji Srinivasan <balaji.srinivasan@nordicsemi.no>
BT Core Spec states that feature exchange should be initiated if
not already performed. So in this case initiate feature exchange
and 'abort' enqueued CIS create if peer doesn't support CIS peripheral
feature
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
A request to set alternate zero for a non-existent interface
would succeed because of the inappropriate order of checks.
Move the check if the desired alternate is the same as the
current one after the check if interface exists.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Correct the return type of the helper function to get/set
current interface alternate value.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Check that the length of the packet is at least the size of
the descriptor head. Otherwise there may be unpleasant side effects.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
I imagine that expression (req != 0 || req != 1) is always true. Fix
it changing '||' to '&&'.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Rather than raise error on connect if iface is down, just take the iface
up.
Rather than raise error on disconnect if iface is down, just ignore the
disconnection request.
Adjust tests and documentation accordingly.
This should make the API easier to use for applications and is more in
line with the original L2 agnostic connectivity RFC.
Also replace some instances of net_if_flag_is_set with
net_if_is_admin_up, which is cleaner and identical in function.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
The current method for handling DAD directly tracks a DAD state for each
iface.
This does not reflect the fact that each individual IP has a separate
DAD state.
This also does not align with the logic in conn_mgr_initial_state, which
instead uses net_if_ipv6_get_global_addr(NET_ADDR_PREFERRED, ...).
Thus, the current approach falsely reports IPv6 ready when DAD adds
the link_addr, and also fails to report IPv6 ready if DAD is disabled.
This commit removes DAD tracking completely, and relies solely on
net_if_ipv6_get_global_addr(NET_ADDR_PREFERRED, ...), fixing both
problems, and simplifying the event tracking.
For consistency, slight modifications to IPv4 handling as well.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Currently, conn_mgr fires L4_CONNECTED and L4_DISCONNECTED events for
every individual iface that gains or loses connectivity.
After this commit, these events are only fired when the first iface gains
connectivity, and the last iface loses connectivity, respectively.
This is so that applications can rely on conn_mgr as a simple way to
track whether connectivity is available.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Adds a flag to allow ifaces and L2s to be ignored.
This is so that applictions have better control over what ifaces they
want connectivity management for.
Enabling the flag forces conn_mgr to consider the iface
unready.
Also increase NET_CONNECTION_MANAGER_PRIORITY default value from 0 to 1
so that applications can register SYS_INIT callbacks that fire just
before conn_mgr initializes. This allows ignored ifaces to be configured
before conn_mgr starts, if needed.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
In preparation for altering the conditions under which conn_mgr
fires NET_EVENT_L4_CONNECTED and NET_EVENT_L4_DISCONNECTED,
refactor the event logic without changing its behavior.
These changes do not alter the behavior of conn_mgr. They merely change
how that behavior is expressed so that it is easier to understand, and so
that upcoming changes are easier to implement.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Current implementation does not prevent the net_mgmt thread from
preempting during state change handling and generating more
state changes. Add a mutex to protect internal state of conn_mgr
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Relocate conn_mgr_if_get_binding to conn_mgr_private.h so that it
can be used by test suites.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Since conn_mgr is a subsystem rather than a library, relocate it
directly into subsys/net rather than subsys/net/lib/
Rename header files to better match their function.
Remove net_ prefix from conn_mgr types, API, and files, since it is
unnecessary.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Fix peripheral CIS receive window to consider that the
peripheral ACL could drift at the instant the CIS is being
established.
Hence add additional EVENT_TICKER_RES_MARGIN_US as receive
window length.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add CDC Ethernet Control Model class implementation for the
new experimental USB device support based on the existing
implementation subsys/usb/device/class/netusb/function_ecm.c.
The implementation forms virtual ethernet connection between
USB host and USB device and requires two corresponding MAC
addresses, one for the virtual interface on the device side,
and other for the host which is described by a string descriptor.
With upcoming changes it should also possible to use a real
ethernet controller as media access on the device side.
CDC ECM implementation supports multiple instances which are
specified using DT. The number of instances is limited by the
number of endpoints on the controller, two to three should usually
be possible.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add check to see if RPA is already generated for adv sets
with same id. If generated use the same address for all adv sets
with same id else create new RPA.
Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
Add proper validation check for the number of subgroups
attempted to be added to the broadcast source.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Implement profile-agnostic broadcast source and broadcast
stream structs, similar to the unicast stream struct.
The purpose of these are to be able to use the same structs
for multiple profiles such as BAP, CAP and TMAP.
Since only the BAP shell implements broadcast support at this
moment, the changes are minimal, but makes it easier to implement
broadcast support for other profile shells.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Provide an extra struct net_if * iface parameter to
net_if_ipv*_maddr_join/leave functions, so that the corresponding
interface context, the mcast address belong to, can be locked for the
operation.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As `net_if_get_link_addr()` returns a pointer to the link layer
structure, some extra protection is needed to prevent its contents from
being changed while accessed. Using the mutex lock associated with an
interface should do the trick.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Instead of having a single global mutex, covering, in most cases
unrelated, access to all network interfaces, introduce a separate mutex
for each network interface.
Wherever interface function operates on an individual interface context
data, use local mutex protection instead. The global mutex remains only
to protect access to shared resources (IPv4/6 context pool, timer lists
etc.).
Finally, rework the timer expiry handlers, to prevent interface
functions from being called while the global lock is held (the global
mutex has to be held when iterating over the timer list, as lists are
not thread safe). The reason for this is to avoid possible deadlock
scenario. The global mutex is sometimes being locked, while inside
interface function (protected by a local mutex), so if it was allowed
the other way as well, a deadlock could occur.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fixed issue when performing the ordered access procedure on
a set of devices where none had the lock characteristics.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The set info returned by the Set Coordinator did not contain
information about the lockable state. Furthermore the
set info was not properly initiated, as it was missing the
rank, which was set somewhere else.
This commit adds the lockable state to the set info.
This commit removes the rank from internal structure,
and uses a reference to the set info instead, and only
store the rank there.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The set size and rank validation did not allow setting e.g.
rank = 2 and set_size = 0, which should be allowed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Whenever a CSIS instance is registered with
bt_csip_set_member_register we now properly check if the
set size, rank and lock characteristics should be present.
If not, then remove them from the service declaration.
It is done this way, as it is easier (read: possible) to
remove characteristics from the service declarations,
than it is to add the optional characteristics, as the
optional characteristics may be present in some CSIS
instances, but not in others.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_csip_set_member_register function would register
the connection, and connection auth info, callbacks for
each CSIS instance, which could give errors when/if the
callbacks are called too many times. In any case, they
should not be registered multiple times.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
LLDP start timer is executed when iface is up
at startup, then once more when iface up event
is received.
When iface is up before net_lldp_init call, then multiple
entries are added to the lldp_ifaces related to the
same iface.
That leads to continuous loop execution within
lldp_tx_timeout.
This commit checks if lldp tx_timer_start is set and
doesn't append new entry into the slist.
The tx_timer_start is set at startup and reset on
down event.
Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
Since the provided callback can be NULL which would
break things, add a check and a return value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The number of streams for a broadcast sink is maximum 31,
or the maixmum number of BIS we support.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Reworks the zephyr macros and pools to be objects in their own right. Each
pool can be statically defined with a Z_ private macro. The objects can
then be initialized with an rtio instance statically.
This cleans up a lot of code that was otherwise doing little bits of
management around allocation/freeing and reduces the scope those functions
has to the data it needs.
This should enable sharing the pools of sqe, cqe, and mem blocks among rtio
instances in a future improvement easily.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Rather than the rings, which weren't shared between userspace and kernel
space in Zephyr like they are in Linux with io_uring, use atomic mpsc
queues for submission and completion queues.
Most importantly this removes a potential head of line blocker in the
submission queue as the sqe would be held until a task is completed.
As additional bonuses this avoids some additional locks and restrictions
about what can be submitted and where. It also removes the need for
two executors as all chains/transactions are done concurrently.
Lastly this opens up the possibility for a common pool of sqe's to
allocate from potentially saving lots of memory.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Fix use of uninitialized ticks_slot value in calculation of
cis_offset_min when creating CIS. Calculate the ticks_slot
value earlier when committing the CIG parameters.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Do not enqueue node rx buffers for generating invalid ISO
data from Tx ISR while supplying the node rx buffer to
Radio. This causes node rx pool corruption and also MIC
failures in the central ISO LLL.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix peripheral ISO data ack mechanism to correctly update
the SN when PDUs fail to be received.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When there is an active CIG for a new CIS create, then use
strict cis_offset_min/cis_offset_max so that the new CIS
is scheduled inside the active CIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
'ps_wakeup_mode' is used to set the wake up interval
to either 'dtim or 'listen_interval'. By default the
sta wakes up every dtim interval.
With 'ps_wakeup_mode' set to 'listen_interval' sta
will wake up for every listen interval period configured.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
listen interval is the time periods the STAs may be in idle
without listening beacons.
By default STA wakes up for every DTIM period.
If listen interval based power save is used
STA uses configured listen interval period(default 10
beacon intervals) to wake up.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Fix ztress_execute() out-of-bounds in case it is called with timer
and for maximum number of threads allowed (CONFIG_ZTRESS_MAX_THREADS).
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Add shell based on sip_svc subsystem to access the SDM mailbox in
EL3 layer using ASYNC sip_svc request.
Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
Introduce a new SiP SVC subsystem to provide ARM Silicon Provider based
supervisory call services. SiP SVC service provides the capability to
send SMC/HVC call from kernel running at EL1 to hypervisor/
secure monitor firmware running at EL2/EL3 and also added SiP SVC shell
commands to exercise the service.
Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
Prevents verifying the image has been uploaded successfully using
the hash provided at the start of the upload if the hash is not
the correct length of an SHA256 hash.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Cast `dhkey` to `void*` to avoid a warning from the logging subsystem:
```
<wrn> cbprintf_package: (unsigned) char * used for %p argument.
It's recommended to cast it to void * because it may cause misbehavior
in certain configurations
```
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
This allows to move flash operations from the context that triggered
IVI update to the mesh settings work item that runs on the system
workqueue. After this change, the outdated RPL entries will be removed
in the setting work item triggered by store_pending function in
mesh/settings.c. This is required to for a case where the mesh settings
work item is running on a separate thread instead of the system
workqueue to unblock the system workqueue eventually.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Bitsets across byte boundaries does not work properly for big-endian;
Converted to use two uint8's instead
Signed-off-by: Troels Nilsson <trnn@demant.com>
As we are using a generic validation function for limits, due to data
type mismatch the check for TWT interval overflow and fails.
Fix the data type and accordingly the maximum value in the help.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Add command to add a source by the broadcast ID. This will
initiate scanning for the broadcast ID, making it unnecessary
for the user to keep track of both the broadcast ID, the SID
and the address, and just focus on the (properly) known
broadcast ID.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The cmd_bap_broadcast_assistant_broadcast_code used decimal, instead
of hex, for the broadcast code, making it a lot harder to use.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Always print/log the 24-bits (as hex) of the broadcast ID to better
use it with e.g. the shell.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If starting the discovery procedure multiple times, the
subscribe function returns -EALREADY which needs to be handled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Moved the implementation of the pa_decode_base to a public
function, and modified it to return better error codes.
The implementation was moved to be publically
accessible, rather than internal in the Broadcast Sink,
as e.g. a Broadcast Assistant need to be able to decode the
BASE too. This wil also allow an application to decode it
itself, if it so wanted to.
This also adds a log module for the audio.c file, as logging
would otherwise not be supported.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Verify that PAST would be possible before providing
BT_BAP_BASS_PA_REQ_SYNC_PAST as the PA sync value to the
Scan Delegator.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Make the `pa_sync` field of the
bt_bap_broadcast_assistant_add_src_param and
bt_bap_broadcast_assistant_mod_src_param to boolean
instead of uint8_t, as it represents a boolean value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix possible NULL dereference at net_pkt_cursor_operate() and
resolve 'Dereference after null check' warnings from the Coverity
static code analysis.
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Added paired_ep to bt_bap_ep_get_info, which would allow to check
whether an endpoint is paired with another endpoint, this would
indicate that its coupled to a bidirectional iso.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
TFM is not the only provider for PSA API, which means
the PSA config shouldn't depend only on it.
Signed-off-by: Piotr Jasiński <piotr.jasinski@nordicsemi.no>
The receiver_ready field can only be set while in the enabling
state, and is a requirement to go into the streaming state.
If for any reason we go into a state that is not enabling
or streaming, then the receiver_ready field should be
cleared, as the circumstances are changed.
This also fixes an issue where if the CIS disconnects,
then we go from the streaming state to the
qos configured state, without clearing it, causing
incorrect behavior if we attempt to connect the streams
again.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Change fixes check for upgrade-only to ensure that the the new image
version is greater than version of the currently running image.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Mesh models may have a data that needs to be stored persistently.
Currently, the models should call bt_mesh_model_data_store and the store
will happen in the calling context. Most likely that it will be called
in BT RX thread as this is the context from which model's opcodes
handlers are called. Thus, the thread will be blocked until the store is
finished.
Another issues is that some models may have states that changes
frequently. Triggering the store on every state change may wear out
flash. Therefore, the models need to implement some postpone mechanism
to reduce the flash wear out.
The mesh stack has already implemented the mechanism of deferred store
with its own settings. The models could use it instead of implementing
their own mechanism.
In combination with the mesh settings workqueue, the models can store
their data without blocking the stack work.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Currently mesh settings are stored in the system workqueue context.
Most of other stack functionality, such that advertisements (incl
relay), loopback, transport sar, beacons transmission, etc. is also
processed in the system workqueue context. When a massive amount of
data needs to be stored and in particularly when page erase needs to
be triggered by GC of NVS subsystem to allocate flash pages, the
execution of the stack (and other functionality that uses the system
workqueue) will be blocked until storing is finished. For example,
right after the provisioning of a erased device, a node may not be
responsive for up to 400ms before it can continue sending messages.
The waiting time may increase if there is a GATT connection in the
mean time.
When write or erase operation is triggered, the flash driver waits for
Bluetooth controller to allocate a time needed to perform the operation.
During the whole operation, the context from which the operation was
triggered is put to sleep. This allows other threads to run until
Bluetooth controller finds the time for the flash driver. In other words,
every settings_save_one or settings_delete should be considered as
rescheduling points.
Considering this, Bluetooth mesh can use another thread to store its
settings, thus releasing the system workqueue for other tasks including
the operation of the stack itself.
The consistency of the data to be stored is guaranteed by the current
implementation where the data is copied to another struct before calling
settings_save_one. The pending flag of a particular module is dropped in
settings.c before starting to store the corresponding data. Thus, if
during the sleep the node receives a message that triggers a change in a
module which data is currently being stored, the pending flag will be
restored and the new change will be stored eventually.
Having this option enabled including with the partial erase, will make
the node more responsive in the described situations.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The generic BT shell header, bt.h, contained quite a few things
related to audio, which should be put in the audio.h shell header
file.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Updated nRF5 Series LLL implementation to support multiple
peripheral CIS establishment from peer central devices.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Central multiple CIS create implementation using advanced
scheduling to find the active CIG events and calculate the
CIS offset to be used in the LL_CIS_REQ PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use accumulated connected ISO LLL prepare callback latencies
to check supervision timeout.
Also use the accumulated connected ISO LLL prepare callback
latencies to adjust SN and NESN values.
Connection establishment can cause short prepare callbacks
inserted before Connected ISO group prepare callbacks, that
cause the Connected ISO group prepare callbacks being
cancelled while being in prepare pipeline. Hence, it is
necessary to accumulate prepare callback latencies wherein
ticker callbacks are executed but prepare callbacks are
cancelled in the prepare pipeline.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Implementation of preliminary Central with multiple CIS
create support in Lower Link Layer. Uses a simple CIS
offset calculation that works when ACL are created with
connection interval that is multiple of CIG ISO interval.
Each ACLs are offset using BT_CTLR_CENTRAL_SPACING hence
having the same CIG sync delay values for all the ACLs.
Advanced Scheduling to setup CIS in any order of ACL and
CIS combination, ACL placed anywhere in timeline and CIS
creation will come therein will be implemented in later
Pull Requests.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Include ticker expire remainder value when calculating the
cis_offset to acheive fine timing in scheduling the CIG
radio events relative to its associated ACL radio events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use the ticker_start_us() interface for Central and Central
ISO setup to acheive fine timing for the first expire
timeout.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
To acheive microsecond or fine timing for first expire
timeout, pass remainder value of the coarse tick to a new
ticker_start_us() interface. The new interface is available
with BT_TICKER_EXT feature enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix implementation of CIS Null PDU Indicator use to meet the
BT Specification statement, that, if the source of the data
fails to provide a payload in time for a CIS subevent, then
the link layer shall transmit a CIS Null PDU instead.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This is re-introduction of Extended, Periodic Advertising
and Broadcast ISO using ticker expire info feature to get
the aux, sync and BIG offsets.
Relates to commit 714d74b77b ("Bluetooth: controller: Use
new ticker feature to get offsets").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Ticker remainder and lazy get depends on match get interface
provided by BT_TICKER_NEXT_SLOT_GET_MATCH.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove redundant range and default for BT_CTLR_ADV_AUX_SET
when supporting BT_CTLR_ADV_PERIODIC.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
BT_TICKER_EXT is not supported with BT_TICKER_LOW_LAT.
Remove redundant select of BT_TICKER_EXT for
BT_CTLR_ADV_EXT.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add the labels from the device tree fixed flash partitions
as a column to the flash_map list shell command.
Signed-off-by: Maurits Fassaert <maurits.fassaert@sensorfy.ai>
Start/pause encryption should not be initiated on ACL with CIS
established (BT Core Spec 5.4, Vol 6, Part B, Sect. 5.1.3)
Adding test for the added procedure peek function
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Clean up log_const to utilize macros for handling sections.
Update database_gen.py to match naming convention change.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Use BT_CONN_TX_USER_DATA_SIZE when defining pools of buffers that will go
through `bt_conn_send_cb()`.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
MTU doesn't count against the ISO and ISO data headers.
Then a config with CONFIG_BT_ISO_TX_MTU ==
CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE should not fragment SDUs over HCI.
Also set the TS_Flag bit if a timestamp is present.
Fixes#56749
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This change to the shell API enables the user to retrieve the
return code of the most recently run shell command. This is
useful both for users wanting specific information beyond the print
statements in a command, but especially for automated users
that prefer a simple return code to parsing human readable text.
This was tested using all default shell commands, as well as
eeprom, flash, and i2c, where specific errors could be forced.
In all cases, the correct return value was returned by the new
retval command.
Signed-off-by: Hunter Searle <hsearle@xes-inc.com>
If the broadcast sink is already stopped (i.e. the streams have
all been disconnected), then we can return a more useful
error code than EINVAL.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds a Kconfig symbol which contains the default controller TX power
directly in dBm. This allows code to directly display/use the configured
power, instead of having to manually iterate over all the
`BT_CTLR_TX_PWR` options.
```
LOG_INF("BT controller configured for %ddBm TX power",
CONFIG_BT_CTLR_TX_PWR_DBM);
```
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
It was previously assumed that the 'sys_mem_blocks' struct would maintain
information about contiguous blocks allocated so the release API only
took the starting address. This led to an issue where allocating 2+
blocks would end up with a memory leak because any block not being the
first would never be released.
Add the buffer length as an argument so the correct number of blocks can
be released. Also, ammend the tests to match and verify.
Signed-off-by: Yuval Peress <peress@google.com>
Print new NET_IF_IPV6_NO_ND and NET_IF_IPV6_NO_MLD flags when
the "net iface" command is used.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
OpenThread networks do not use ND or MLD as they have their own set of
protocols to cover this functionality. So far, the use of OpenThread
with Zephyr relied on disabling those protocols support statically with
Kconfig, which prevented OT interfaces from being used along with other
IPv6 interfaces.
With the new network interface flags, it's now possible to disable ND
and MLD on individual interfaces, therefore disable them for OT
specifically.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new network interface flag, which allows to disable Multicast
Listener Discovery protocol from being used on the interface. This
allows to interfaces that do not support ND (like OpenThread) to
coexist with other IPv6 interfaces.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new network interface flag, which allows to disable Neighbour
Discovery protocol from being used on the interface. This allows to
interfaces that do not support ND (like OpenThread) to coexist with
other IPv6 interfaces.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This allows to move flash operations from the context that triggered
storing device key candidate to the mesh settings work item that runs
on the system workqueue. This is required to for a case where the mesh
settings work item is running on a separate thread instead of the system
workqueue to unblock the system workqueue eventually.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This allows to move flash operations from the context that triggered
bt_mesh_provision or bt_mesh_reprovision to the mesh settings work item
that runs on the system workqueue. This is required to for a case where
the mesh settings work item is running on a separate thread instead of
the system workqueue to unblock the system workqueue eventually.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If the icmsg backend is sending the data from many
contexts, the send buffer must be accessed only by one
context at a time. Ensure that by adding mutex when
sending.
Signed-off-by: Emil Obalski <Emil.Obalski@nordicsemi.no>
Clearing of shared memory by one side of the communication
is no longer required after
commit 0620cb1fe1
("ipc: ipc_service: icmsg: Increase reliability of bonding")
was merged.
Signed-off-by: Emil Obalski <Emil.Obalski@nordicsemi.no>
The LOG_ERR was printing the wrong variable. `type` always has the value
`BT_BUF_H4` here, so there is no point in printing it.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Remove all enabling of CONFIG_EMUL_.* in favor of automatically enabling
peripheral emulators based on the compatible string presence in the device
tree and the one true CONFIG_EMUL.
Zephyr has long since moved to a model of enabling drivers based on the
presence of their associated IC's compatible string in the final devicetree
overlay. There is no reason that emulators can't align in just the same
way, and probably ought to to remove superfluous enabling of configs.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
This deduplicates a code a bit by reusing existing bt_bap_stream_reset
function to unbind and detach the stream object.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes redundant bt_ascs structure pool that held the list of
ases per connection. The memory usage can be reduced by moving the conn
reference to bt_ascs_ase structure. This change reduces flash and RAM
memory usage.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The PAwR sync can receive a connection request from the PAwR
advertiser and become peripheral.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
This is known as the Periodic Advertising Connection Procedure.
The PAwR advertiser can initiate a connection to a synced device and
become the central.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
Prevent referencing inactive CISes by clearing state variables
after teardown. This was seen as necessary when having CISes on
different ACLs, and disconnecting ACLs in random order.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Transmit errors must be treated differently than Protocol Errors.
This change sets a flag that informs the stack of a Message
Transmit error.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
In the broadcast sink when the streams disconnected (without
the PA disconnecting), the streams were not properly
removed from the sink's list of streams. This allowed
the same stream to be added to the list twice, which
would cause a infinite loop as the stream would
point to itself as the next.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The reassembly buffer for periodic sync was not initialized
if the sync was established via PAST.
Move the initialization of the reassembly buffer to a common place.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
Adds API for Periodic Advertising with Responses - Scanner:
- Synchronize to a PAwR train
- Choose which subevents to synchronize to
- Receive advertising reports from subevents
- Send responses
The support is enabled by CONFIG_BT_PER_ADV_SYNC_RSP, and requires
a controller that selects CONFIG_BT_CTLR_SYNC_PERIODIC_RSP_SUPPORT.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
Adds API for Periodic Advertising with Responses - Advertiser:
- Configure parameters
- Receive subevent data requests
- Set subevent data
- Receive response reports
The support is enabled by CONFIG_BT_PER_ADV_RSP, and requires
a controller that selects CONFIG_BT_CTLR_ADV_PERIODIC_RSP_SUPPORT.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
Fix dhcpv4_create_message() dereferenced NULL return value from
net_pkt_alloc_with_buffer() in case of no memory available.
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
In case when CONFIG_MCUMGR_SMP_LEGACY_RC_BEHAVIOUR=n then
the image erase command would incorrectly return MGMT_ERR_EMSGSIZE,
even though no such error occurred.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fix net_ipv4_send_fragmented_pkt() dereference of NULL return value
from net_pkt_get_data() possible with non contiguous packet data.
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
The ATT_PENDING_SENT flag was still not being cleared in all cases.
Also reset `data->att_chan` when not able to send on a given channel.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The API doesn't allow the stack to make any guarantees about the number of
available buffers that the app has.
Only send 1 credit at a time, as that is the only guarantee the stack can
give to the peer.
We can send MTU/MPS's worth of credits once we have acquired an SDU buffer
from the application (that is, on the first PDU of the SDU). Though we
still have to cap that to the buffer size we have just acquired.
------
The testcase added here shows a scenario where the relationship
between the number of credits and the number of available buffers does not
hold true any more:
In this test, the app only has one buffer in its pool.
The central will queue SDUs that are bigger than the stack's
buffers (so the user allocator is necessary) but lower than the
channel's MTU.
The device receiving the SDU keeps a reference to the buffer before
returning from the `recv` callback. It releases that reference after a
small delay.
The central will still have credits, so it will queue another SDU, but the
peripheral will not be able to receive the next SDU (as the allocator will
fail) and will close the channel.
To see the test fail, just revert the `l2cap.{c,h}` changes.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Turns out the [first bugfix] was too naive: there is a case where resuming
all channels will not work on all queued SDUs, and the work handler will
give up and wait for the next sent SDU instead of trying to resume again.
This happens when the number of credits and conn contexts is very low for
the amount of data to send.
Always reschedule with a delay to avoid that situation.
[first bugfix]: https://github.com/zephyrproject-rtos/zephyr/pull/50476
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The arm-clang compiler/linker does not optimize away unused function
symbols and thus will error if symbols that are referenced are not
defined. To fix this add needed ifdef'ry.
Build various network samples that utilize ethernet but don't have
CONFIG_NET_PROMISCUOUS_MODE will get a link error for:
Error: L6218E: Undefined symbol
net_mgmt_NET_REQUEST_ETHERNET_SET_PROMISC_MODE
(referred from ethernet.o).
Fix by adding ifdef protection around promisc code.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
TWT flow id is of 3 bit value(maximum mnumber of flows
supported is 8). Flow id range limited to 0 to 7.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
This fixes loop over arrayed metadata/cc parameters. The paramaters have to
be pulled from the buffer, because in case the ASE_ID is invalid or in
invalid state, the next loop iteration would read invalid data.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Add configurations where CONFIG_BT_AUDIO_TX and CONFIG_BT_AUDIO_RX
are disabled.
Fixes issues found in the BT shell implemented caused by these
configurations.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Move the BT_AUDIO_TX guard so that it does not cover the
verification functions for valid_codec and qos, as they
are also relevant for receivers to verify what remote
devices send.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix tcp_send_zwp() retransmission timeout calculation to avoid sign
extension on bit shift operation: the uint16_t value was implicitly
promoted to 32-bit signed type with sign extension to uint64_t.
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Fixes the compiler error that occurs when attempting to build
the SNTP library with CONFIG_NET_SOCKETS_POSIX_NAMES=n, while
using native_posix.
Closes#57133
Co-authored-by: Chris Friedt <cfriedt@meta.com>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
This adds callbacks for Secure and Private Network Beacons.
SNB callbacks are called after `secure_beacon_authenticate` ends
with success, and Private Beacon callback after Private Beacon
payload is decrypted succsessfully.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
This removes opcode from ascs_cp_rsp_add function parameters and moves
response buffer initialization to be done in Control Point write
function context.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Mounting the disk in a global function can lead to an issue
where fatFS cannot be mounted due to it not being registered beforehand.
To solve this problem, fatFS is now initialized in POST_KERNEL,
just like the littleFS initialization function.
fatfs_init must be called before attempting to mounte the disk.
Signed-off-by: Sihyun Noh <awake_noh@naver.com>
Refactoring. All occurences of `atomic_test_bit((.*)->flags,
ATT_ENHANCED)` are replaced with `bt_att_is_enhanced($1)`.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The EATT MTU in Zephyr is static. We know it at channel creation time,
so we should communicate the MTU as part of channel creation.
Side note: With this approach, it should no longer be neccessary or
useful to do a channel reconfigure.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The previous approach with `cap_eatt` was flawed. It would overwrite
`le_chan->tx.mtu`, losing its true value. (It is supposed to be the
L2CAP MTU as reported by the remote side.)
The previous approach worked out for UATT because the locally triggered
exchange always carries the remote MTU in the response, so we did not
need to keep track of the remote MTU.
But, unlike the UATT MTU exchange, the L2CAP reconfigure only exchanges
the MTU in one direction. If the remote does the first reconfigure, we
would correctly cap the ATT MTU to our local MTU. But, we would
incorrectly store this as the remote's MTU. When we then increase our
local MTU using `bt_eatt_reconfigure`, we correctly set and send our
MTU. But we have an incorrect notion that the remote MTU is the value
that we ourselves limited. And mistake would incorrectly limit the
negotiated ATT MTU locally.
The simplest solution is to not mess with `le_chan->tx.mtu` and just
calculate the ATT MTU like Spec intended.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This is a refactor. There is no behavioral change because
`BT_LOCAL_ATT_MTU_UATT` is `BT_LOCAL_ATT_MTU_EATT + 2` is
`BT_ATT_BUF_SIZE` is the old `BT_ATT_MTU`.
The old `BT_ATT_MTU` was wrong for EATT bearers. EATT MTU is two bytes
less because of ECRED overhead.
Instead of the old `BT_ATT_MTU`, we define one for each bearer type. We
also define the max of them to use as a convenience for allocating
buffers that fit either.
To avoid confusion, 'LOCAL' has been added to the name. This is to
differentiate it from what the spec calls 'ATT MTU', which is a
negotiated property. (It is the minimum of the two side's local ATT
MTU.)
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
There is an assert that `req_psm` is the same for all channels in the
same connection request because HCI requires this. The same is true for
`req_mtu`. This adds the obviously missing assert.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This is a refactoring, only visible inside `att.c`.
Give the expression `chan->chan.tx.mtu` the name `bt_att_mtu`. Use it
when the intention is to get the ATT MTU property of a channel.
This is done in preparation a more complex expression for `bt_att_mtu`,
since the expression currently incorrect. The fix will come in a later
commit in the same PR.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The function should be used to reset map decoding state
between calls to zcbor_map_decode_bulk, while using the same map
for different buffers.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Due to broken logic in img_mgmt_state_confirm failure to confirm
was not reported to caller.
If hooks were enabled confirmation event would be passed regardless
whether it has been successful.
Fixes#56617
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Adds a command which can be used to enter mcuboot's serial recovery
mode when the retention subsystem is enabled.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a boot mode system which allows for redirecting the boot
target of a device depending upon the state of a retained value.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a retention system which builds on top of retained_mem
drivers to allow partitioning of areas and data integrity with
magic header prefixes and checksum of stored data.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The dummy header was an opt-in feature to allow testing without a
real image but since we support testing on Qemu in CI which
supports flash partitions, there isn't a need for this option. Not
being deprecated as Kconfig would only have been used as part of
CI, not user applications.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Function allows to check whether given key has been found
during map decoding with zcbor_map_decode_bulk.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This moves ASE Control PDU length validation before request processing.
If the PDU length is not as expected, the operation shall be considered
as invalid. Thus shall be rejected.
ASCS_v1.0; 5 ASE Control operations
"A client-initiated ASE Control operation shall be defined as an invalid
length operation if the total length of all parameters written by the
client is not equal to the total length of all fixed parameters plus
the length of any variable length parameters for that operation"
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes sending proper Response_Code in ASE Control Point
notification in case the client initiates Receiver Start/Stop Ready
operation on Sink ASE.
The response that shall be sent according to the specification is
"Invalid ASE direction", while the implementation sent "Invalid ASE state"
instead.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The possible control endpoint MPS for USB 2.0 FS devices is
8, 16, 32, or 64 bytes. Typically, USB2.0 compliant devices support MPS
up to 64 bytes, and we have not had the need to support other MPS.
This patch implements a mechanism to fall back to the minimum allowed
MPS when a controller is likely a USB 1.1 compliant device and does
not support control endpoint MPS of 64 bytes.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Cleanup linker scripts for net_buf_pool section to use the linker
script related iterable section macros.
Also replace _net_buf_pool_list with macro's instead to complete
iterable section usage.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Add verbose output of scan data to output all received data types as
hex values. This is turned off by default and can be toggled using
the bt scan-verbose-output <on|off> command.
Signed-off-by: Martin Rieva <mrrv@demant.com>
This commit simplifies the arguments for sending dns responses
and fixes an issue where both the ipv4 and ipv6 member of a header
union were accessed.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Duplicate logging prints make it hard to find the origin.
This commit does a cleanup of the debug messages printed.
Also change the level of an invalid record to debug as this
is out of our control.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
For offloaded iface net_tcp_get is never called, so context->tcp
is always NULL. In that case net_tcp_tx_sem_get will return wrong pointer.
For pollout k_poll will be called with NULL semph,
which cause HardFault.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
Change the default value of past_preference to true, to prefer
PAST by default when using the scan delegator.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When copying the stream specific codec configuration data,
the value pointer in the bt_data struct was not properly
updated, causing possible invalid data access.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_cap_initiator_unicast_audio_update function was missing
NULL and 0 checks for input parameters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Use the minimum supported cis_offset_min considering that
ACL radio event does not overlap with CIG event. Use the
calculated maximum of local and remote cis_offset_min in the
Response PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Do patch file application before clang-format.
Add copyright to generated files using the --file-header option in zcbor.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
Convert handling of shell_root_cmds, shell_subcmds, and
shell_dynamic_subcmds to use iterable section macros.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Allows L2s to declare generic association/connection routines
that can be bound by name to ifaces.
Allows L2-agnostic control over connectivity/association for
iface that support it.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Commit adds experimental support mbedtls psa as crypto
backend for ble mesh. It were run only on bsim tests.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit gets rid of host dependency to generate DH key.
Mesh uses its own function for it that has synchronous
behavior and correct endianism. It simplifies the provisioning
state machine since it doesn't require waiting for the host HCI
handler.
Also, it removes hidden cross-dependency between BLE Mesh and
SMP in the aspect of competition for the same DH key
(https://github.com/zephyrproject-rtos/zephyr/issues/23292)
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit splits mesh crypto module on security library dependent
and independent parts.
Independent part includes security toolbox implementation.
Dependent part includes security algorithms usage based on
API third party security library.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Calls put instead of unref on net contexts
in the socket accept function.
Mere unref didn't subtract the reference
count of net context which leaves
it in used state. This situation happens
in case of accepting already
closed connection.
Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
Added a feature of socket connect
being asynchronous. If socket is set
to nonblock with O_NONBLOCK flag,
then connect() is non-blocking aswell.
App can normally poll the socket to
test when the connection is established.
Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
This reverts commit cd7461495f,
introduced to fix possible deadlock as result of changes in
commit f206170c65
("usb: device: Do not call callback when transfer is cancelled")
which is now reverted.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This reverts commit f206170c65
introduced as workaround for nRF USBD device controller in PR
https://github.com/zephyrproject-rtos/zephyr/pull/16193.
This commit may be reverted due to changes made in
commit e326c58399
("usb: device: Do not cancel transfers on suspend").
Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Fix Advertising PDU size calculation when direction finding
feature is enabled and PDU fragment count includes the
maximum CTE PDU chained. Fix removes redundant PDU count
included for Extended Advertising. Only Periodic advertising
PDUs chain CTE requires number of additional PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When ISO Central is enabled it is allowed to configure many CISes at
once. For this a large command buffer is needed. This is also tested
by HCI/CIS/BI-05-C.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Fixes#56657, incorrect TCP MSS calculation for IPv6.
Previously the supported MSS would incorrectly returned as the MTU if it
was less than the MTU, probably to account for the case where
the network interface MTU check returns 0.
New behaviour is to return the supported MSS as MTU minus header length,
using default MTU for this calculation if network interface MTU check
returns 0.
Signed-off-by: Kenny Johansson <wirehell@gmail.com>
If device running BLOB Server called `bt_mesh_blob_srv_recv`,
but rebooted before it received `XFER_START` message from BLOB Client,
it was wrongly "recovered" into Suspended phase, which would lead to
Server try to resume transfer on `XFER_START`. It would not be possible,
because `srv->state.xfer` was not set with acual values yet.
Set phase again to BT_MESH_BLOB_XFER_PHASE_WAITING_FOR_START, which will
allow to accept new transfer.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Corrected printed message on failing test with expected or received
NULL pointer in ztest_check_expected_data.
Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
A case of an invalid PDU was seen leading to a hit on this ASSERT, ie
this COULD happen. Refactoring of the state handling re. expectedness
in remote vs local request machines combined with ensuring the local
request machine ceases to expect PDUs when remote procedure 'takes over'
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Fix regression in refactored LLCP using uint16_t instead of
uint32_t in storing the win_offset_us value. This caused
connection update to fail with incorrect window offset being
used to schedule the connection radio events.
Regression since commit e1c2c36f56 ("Bluetooth: controller:
llcp: set refactored as default").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The arm-clang compiler/linker does not optimize away unused function
symbols and thus will error if symbols that are referenced are not
defined. To fix this add needed ifdef'ry.
Fixes#56630Fixes#56628
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.
Most of these changes were automated using coccinelle with the following
script:
@@
@@
- void
+ int
main(...) {
...
- return;
+ return 0;
...
}
Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.
Signed-off-by: Keith Packard <keithp@keithp.com>
The audio code utilizes BT_CONN so ensure its only built if
CONFIG_BT_CONN is set. This is to fix a build issue we see
with arm-clang for:
sample.bluetooth.broadcast_audio_source
which fails to link since bt_conn_get_info is missing.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Fix window offset calculation which is missing the radio
rx ready delay timing be subtracted because the connection
offset from the start of the radio for scan window to the
end of the ADV_IND PDU includes the radio rx ready delay
timing, where as the determined window offset by advanced
scheduling calculates the offset from the ticks_at_expire
of the scan window to an active central connection's
ticks_at_expire.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update Advanced Scheduling implementation to use remainder
value in precisely calculating the connection request window
offset in microseconds.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Move the use of rx chain delay value used to calculate the
window offset into lll_scan_prepare_connect_req() instead of
current two places, one for legacy and other for extended
connection setup.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Find and match only Central role ticker when applying the
BT_CTLR_CENTRAL_SPACING value.
Use the EVENT_TICKER_RES_MARGIN_US value as +/- jitter
margin when ticker advanced scheduling is used to group
radio events.
When using CONFIG_BT_CTLR_CENTRAL_SPACING, do not add the
+/- jitter to the ticks_slot.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Included consideration for the packet sequence number and time stamps
together with the SDU interval in matching the event for fragmentation
of SDUs to unframed PDUs.
Implemented:
-- Increase in kconfig limit of BT_CTLR_ISO_TX_BUFFERS to allow full 32
buffers to be available for LL/CIS/PER/BV-39C
-- ISO-AL microsecond time wrapping exposed to be used externally to
adjust incoming Group Reference Points and Time-stamps where required
-- Function that handles adjustment of payload number according to
incoming SDU exposed for external use to allow next payload number to
be accessed by ISO transmit tests
-- Changed internal fragmentation source identification parameter from
the source structure pointer to the source handle so that only the
source handle needs to be used for external calls
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
This new configuration option, SHELL_BACKEND_RTT_BUFFER, allows selecting
an alternative buffer for the Shell's RTT backend. By default buffer 0 is
used, which conflicts with the default logging subsystem RTT backend
buffer.
This option is the counterpart to the logger's LOG_BACKEND_RTT_BUFFER.
Signed-off-by: Maurits Fassaert <maurits.fassaert@sensorfy.ai>
Private Beacons are mesh-1.1 feature and without mesh-1.1 spec enabled,
the node shall not process such beacons.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Private Beacons and Secure Network Beacons are not mutually exclusive by
spec. This means both beacons can be sent simultaneously. For both
beacons spec defines their own observation intervals and related
parameters, which means we need to monitor both beacons types
separately.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Since we enable -fshort-enums for arm-clang we get the following
warning:
subsys/bluetooth/mesh/pb_adv.c:139:40: warning: cast to smaller
integer type 'enum prov_bearer_link_status' from
'void *' [-Wvoid-pointer-to-enum-cast]
Fix this by first casting to an int to grow the size of the type.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
it is too late to set ctx->state to ISOTP_TX_WAIT_FIN after send_sf
because send_state_machine could be called just between `send_sf` and
`ctx->state = ISOTP_TX_WAIT_FIN;` in extremely case. like below:
```c
ret = send_sf(ctx);
-> send_state_machine (irq handler)
ctx->state = ISOTP_TX_WAIT_FIN;
```
it will cause isotp_send never return.
Signed-off-by: Jiapeng Li <mail@jiapeng.me>
Some utility functions belong to lwm2m_util.c.
Block contexts belong to lwm2m_message_handling.c
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This changes so that generation of RSI now uses LE arrays instead of
uint32 words. Both input and output of rsi and sih genration now uses
LE. This also fixes the generation of RSI for BE systems, which
wasn't working.
Signed-off-by: Fredrik Danebjer <fredrik@danebjer.com>
Fix checkpatch issue: UNNECESSARY_INT: Prefer 'unsigned long' over
'unsigned long int' as the int is unnecessary
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The init infrastructure, found in `init.h`, is currently used by:
- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices
They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:
```c
struct init_entry {
int (*init)(const struct device *dev);
/* only set by DEVICE_*, otherwise NULL */
const struct device *dev;
}
```
As a result, we end up with such weird/ugly pattern:
```c
static int my_init(const struct device *dev)
{
/* always NULL! add ARG_UNUSED to avoid compiler warning */
ARG_UNUSED(dev);
...
}
```
This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:
```c
static int my_init(void)
{
...
}
```
This is achieved using a union:
```c
union init_function {
/* for SYS_INIT, used when init_entry.dev == NULL */
int (*sys)(void);
/* for DEVICE*, used when init_entry.dev != NULL */
int (*dev)(const struct device *dev);
};
struct init_entry {
/* stores init function (either for SYS_INIT or DEVICE*)
union init_function init_fn;
/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
* to know which union entry to call.
*/
const struct device *dev;
}
```
This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.
**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
init: convert SYS_INIT functions to the new signature
Conversion scripted using scripts/utils/migrate_sys_init.py.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
manifest: update projects for SYS_INIT changes
Update modules with updated SYS_INIT calls:
- hal_ti
- lvgl
- sof
- TraceRecorderSource
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: devicetree: devices: adjust test
Adjust test according to the recently introduced SYS_INIT
infrastructure.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: kernel: threads: adjust SYS_INIT call
Adjust to the new signature: int (*init_fn)(void);
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Fix the BIG handle in the HCI LE BIG Sync Established event
when BIG Create Sync operation is cancelled by Host.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This fixes missing ISO connection state check, as there might be no ISO
connection when Receiver Stop Ready has been received. This might happen
on ASE state transition from Enabling to Disabling.
Without this check the code asserts in ascs_disconnect_stream_work_handler.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Aligns Bluetooth mesh shell parameter documentation to use the
same syntax, abbrevations and formating.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Changes the implementation and documentation in config client shell
command for Config Model Publication Set and Config Model Publication
Virtual Address Set to accept period resolution and period steps as
separate arguments to make it more user friendly.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Currently, the handshake operation could only be fully blocking or
non-blocking. This did not play well if SO_RCVTIMEO was set for DTLS
server, as the recv() call where the blocking handshake was used, could
block indefinitely, ignoring the timeout parameter. Fix this, by
allowing for the handshake operation to timeout.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As the underlying socket operations for TLS/DTLS are now non-blocking,
it's no longer possible to rely on the underlying socket timeout
handling. Instead, implement SO_RCVTIMEO/SO_SNDTIMEO at the TLS socket
layer.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As for TLS, switch to use non-blocking operations on underlying socket.
This is a bit tricker for DTLS, as there were not truly blocking bio
(binary input/output) function for DTLS, as timeout had to been
implemented. It is possible though to implement non-blocking mbedTLS bio
function instead, and handle timeout outside of mbedTLS context, which
has been done in this commit.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Switch TLS sockets to use non-blocking socket operations underneath.
This allows to implement the socket blocking outside of the mbedTLS
context (using poll()), and therefore release the mutex for the time the
underlying socket is waiting for data. In result, it's now possible to
do blocking TLS RX/TX operations simultaneously from separate threads.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Implement ZFD_IOCTL_SET_LOCK so that TLS socket layer gets access to the
mutex protecting socket calls.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make `BT_LOG` and `BT_LOG_LEGACY` hidden Kconfig symbols.
They should not be used by the user to configure the Bluetooth logging
system. If the user want to completely disable Bluetooth logging, they
should use `BT_LOG_LEVEL_OFF=y`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
When we receive `RPR_OP_LINK_CLOSE` message with reason other than
`SUCCESS` we should fail NPPI refresh procedure, not complete it.
Dropping `COMPLETE` flag will result in calling `reprovision_fail`
in `prov_link_closed`, not `reprovision_complete`.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
TCP packet allocation timeout is currently 100ms, but there are cases
where it is not enough and as a side effect, the kernel internals are
printing some errors on the log before retrying again, create a
Kconfig parameter to be able to tune this value.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
We should clear the bt_dev.sent_cmd pointer after using it to allocate a
new HCI event buffer in the bt_buf_get_cmd_complete() function.
Otherwise, there is a risk of reusing the same stored net_buf for
multiple consecutive HCI events in case the controller sents duplicate
or invalid event packets.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Added command to terminate the PA sync as the scan delegator.
This can also be used to cancel any pending PA syncs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add callback to notify the application about which
BIS it should sync to when requested by the Broadcast
Asssitant.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support to create a broadcast sink from a PA sync, rather
than using the broadcast sink scan functions.
This allows for the scan delegator implementation to
autonoumsly add broadcast sinks.
This refactors how the broadcast sink uses flags, to
ensure thread safetyness.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This integrates the Scan Delegator functionality with the
Broadcast Sink functionality. The Broadcast Sink will
automatically update the receive state for the PA and BIG
sync values, based on state of the Broadcast Sink.
Similarly, a request to terminate the BIG or PA sync from
a Broadcast Assistant will terminate the Broadcast Sinks'
PA or BIG syncs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add bt_bap_scan_delegator_foreach_state and
bt_bap_scan_delegator_find_state to support finding
specific receive states.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The field is added/modified by bt_bap_scan_delegator_add_src
and bt_bap_scan_delegator_mod_src. This makes it easier
to modify the BIG sync state, without worrying about
the encryption state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the cmd_bap_scan_delegator_rem_src to remove
receive state sources locally as the Scan Delegator.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add cmd_bap_scan_delegator_mod_src to modify a BASS
receive state source as the scan delegator in the
shell.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The scan delegator attempted to put the subgroup pointer into the
metadata data, instead of the metadata.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a test case that tests the scan delegator and
broadcast assistant features when the scan delegator
syncs to a PA without being asked to by the
broadcast assistant.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The check did not work when aggregated_bis_syncs
was 0. Also modfied the function to be more readable.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for adding a source from the scan delegator itself.
This is useful if e.g. the broadcast sink syncs to a PA.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_bap_scan_delegator_remove_source failed due to invalid length,
as the buffer supplied to scan_delegator_rem_src should not
contain the opcode.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The requested_bis_sync value is not part of the BASS receive
state. Moving the field makes it possible to use the
recv_state struct in more situations.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The scan delegator will no longer be responsible for
handling the actual synchronization of the periodic
advertisers, and will offload this to higher layers.
The reason for this, is that scanning is a global state,
and should be avoided autonousmly by the stack. The
application is much better suited for handling this.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the receive_state_updated callback for the scan delegator.
This callback will be called whenever a receive state is updated
by any means, giving the upper layers the option to always know
the latest changes.
This commit also refactors the name used for the internal
receive state (which contains additional information), for
the sake of readability.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The Scan delegator will rely on upper layers calling
bt_bap_scan_delegator_set_bis_sync_state instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_bap_scan_delegator_set_sync_state has been refactored
to bt_bap_scan_delegator_set_bis_sync_state, as it will,
going forward, only be used to set the BIS sync states,
and not the PA sync state. The PA sync state will, in a future
commit, but autonousmly handled by the scan delegator
based on the PA sync callbacks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The set sync state will be used for upper layers to set the BIS
sync state. This is due to the fact that the scan delegator cannot
automatically get this information from the ISO layer, unlike
the PA sync state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Per the BAP specification, if the Broadcast Sink role is
supported, then the Scan Delegator shall also be supported.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
- Introduce a new Kconfig to enable mempool in RTIO
- Introduce a new RTIO_DEFINE_WITH_MEMPOOL to allocate an RTIO context
with an associated memory pool.
- Add a new sqe read function rtio_sqe_read_with_pool() for memory pool
enabled RTIO contexts
- Allow IODevs to allocate only the memory they need via rtio_sqe_rx_buf()
- Allow the consumer to get the allocated buffer via
rtio_cqe_get_mempool_buffer()
- Consumers need to release the buffer via rtio_release_buffer() when
processing is complete.
Signed-off-by: Yuval Peress <peress@google.com>
Update the policy such that every completed sqe has a parallel cqe.
This has the primary purpose of making any reads in the sqe visible
to the consumer (since they might have different buffers).
Signed-off-by: Yuval Peress <peress@google.com>
For ztest twister would parse the symbol information that was
generated as part of the build (zephyr.symbols). However the format
of the zephyr.symbols files is highly dependant on the toolchain.
Move to using pyelf to parse the symbol information directly from
zephyr.elf instead so that this works regardless of toolchain.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
By default there is only CONFIG_LOG_FUNC_NAME_PREFIX_DBG=y enabled. When
both Bluetooth (CONFIG_BT=y) and logging (CONFIG_LOG=y) subsystems are
enabled, then other CONFIG_LOG_FUNC_NAME_PREFIX_{INF,WRN,ERR}=y options are
pulled in as well using an 'imply' Kconfig command indirectly from
`CONFIG_BT_LOG`. This behavior was introduced recently as part of
commit af01a0f313 ("Bluetooth: Logging: Move all logging symbols
together") with no explicit reason provided.
Pulling in LOG_FUNC_NAME_PREFIX_* options automatically with (CONFIG_BT=y
&& CONFIG_LOG=y) blows up flash usage. As an example of downstream project
(nRF52840-based, with Bluetooth and WiFi connectivity), it increases flash
usage from 473668 bytes to 487856 bytes. This seems "only" 3% difference,
but this is actually a lot when there is no good reason why this happens.
Downstream users quite often compare flash sizes of subsequent Zephyr
releases and this 3% footprint increase might be a blocker at some point.
Additionally, it is not trivial to find the root cause of footprint
increase for most (non-expert) users.
The reason why there is so much footprint overhead because of
CONFIG_LOG_FUNC_NAME_PREFIX_*=y is because each function in the
codebase (be it Zephyr or downstream application) that contains logging
macros (LOG_{DBG,INF,WRN,ERR}()) is bloated because the function name has
to be included in the output image.
Remove 'imply LOG_FUNC_NAME_PREFIX_*' commands from 'menuconfig BT_LOG'
option, so that flash usage does not increase too much. Those logging
options are not enabled by other subsystems, so Bluetooth should not be an
exception here.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
RPR Client doesn't send RPR_OP_LINK_REPORT and therefore it can't wait
for it using ack ctx. It should have been RPR_OP_PDU_OUTBOUND_REPORT
to cover a case where Outbound PDU transmission failed. But in this case
the link status will be non equal to BT_MESH_RPR_SUCCESS (see pb_error in
rpr_srv.c) and the link state will be set to idle. And the client will
reset the link together with ack ctx.
When bearer user (provisioner.c) sends an Outbound PDU, it uses the
callback (see bt_mesh_prov_send in provisioner.c) to send a next PDU,
but it doesn't check the error code even though it is provided through
the callback. Therefore calling the callback with error code would
require error handling in provisioner.c.
With ordinary provisioning PB-ADV doesn't call the callback in case of
error, but closes the link by timeout if doesn't receive ACK (see
prov_send_adv in pb_adv.c). PB-GATT always calls the callback with
error code 0 once the PDU is transmitted (see buf_send in pb_gatt.c).
Thus this change aligns RPR Client implementation with other bearers.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
When central is sending SMP Pairing Request is it unknown if
pairing will be legacy or LE SC so set OOB flag if any OOB
data is present and assume to peer device provides OOB data
that will match pairing type.
This was affecting following qualification test cases:
SM/CEN/OOB/BI-01-C
SM/CEN/OOB/BV-01-C
SM/CEN/OOB/BV-03-C
SM/CEN/OOB/BV-09-C
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Secure Channel Base Key (SCBK) is a secret key used to derive the session
keys used to encrypt and decrypt OSDP packets. Secure coding practice
requires us to clear such sensitive data from stack once we are done
needing it. This patch addresses this issue.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
OSDP secure channel message blocks are terminated with a 0x80. This means
that even for zero length messages, we would have at least one block of
encrypted data to decrypt (since message blocks are rounded up to the next
16 byte boundary). The current length assertion checks for 16 byte
alignment but a malicious peer could send a specially crafted packet with
zero length blocks. Fix this issue by adding check for length == 0 case.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
HID readers are responding to a KEYSET command with an ACK in plaintext
instead of using the current session keys to acknowledge this command
(which is the reasonable thing to do as the command itself was received
encrypted with the old key). Since the spec doesn't say anything about
this, both methods are technically correct.
Make changes to CP so it allows ACKs in plaintext for KEYSET command in
particular and make the PD implementation do this too as it makes the code
look cleaner there (perhaps HID did it for the same reasons :D).
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
If command or reply has no data, PD "should" use secure message types
SCS_15 or SCS_16. But some PD seem to not implement this correctly. We
will be tolerant towards those faulty implementations.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
OSDP command KEYSET is used to set the secure channel base key for all
connected PDs. This key is then used to derive the session keys for each
secure channel session. When the app wants to set the this key, it has
to issue a command and then both the CP/PD has to be notified of this
change so they can store this key in a non-volatile medium for future
operations across power cycles.
The current implementation of OSDP had limited support for key
management. This patch adds all the bells and whistles needed to handle
keyset command/event in the CP/PD application.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Hoisting a `length--` helps simplify a lot of code which has ad-hoc -1s
in a bunch of places. Also, fix some formatting issues and remove
unnecessary log lines.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Struct sh_telnet should be initialised before first function call.
Right now there is a possibility that telnet_accept function will
be called before memset.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
Add a new backend for Host Commands that uses UART. The backend bases
asynchronous UART API.
The UART backend is mainly used by FPMCU.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
There were a missing NULL check for the track segment in
paused_state_command_handler when performing the segment
operations.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The discovery parameters may contain values from previous
discovery calls. The simply and future proof solution to
this is to simply memset it before using it.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the subscribed callback is called with value_handle = 0,
then it should not be treated as a subscription complete.
This will happen when bt_mcc_discover_mcs is called, as
reset_mcs_inst unsubscribed to all characteristics before
discovering again.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add macro BT_MCS_VALID_OBJ_ID to verify the OTS Object
ID before attempting any OTS operations.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If server or bootstrap writes a lifetime value less than
configured default lifetime, client will automatically overwrite
the value with default one.
This gives better control for the application where client
behaviour is fine tuned on the Kconfig, but default values
from bootstrap server cannot be fine-tuned.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This patch allow to use isotp use_fixed_addr feature
with CAN identifier which not match SAE J1939 format.
Signed-off-by: William MARTIN <william.martin@power-lan.com>
Extend the invert command to run cfb_invert_area when given four arguments.
Make a change to invert the screen immediately in case of run invert
without arguments.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Add the `draw text` command to execute the `cfb_draw_text()` API.
The command is similar to the `print` command. The difference is
`draw text` can render to coordinate that is not on tile boundaries.
The command is not run `cfb_framebuffer_clear()`,
So it allows rendering appendiceal with keeping already drawn image.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Add cfb_draw_text() API for rendering text.
It is similar to cfb_print(), the difference is cfb_draw_text() accepts
coordinate that is not on tile boundaries and don't wrap the line.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Implements dot-by-dot font rendering to make cfb_print() able to
draw text even at a coordinate that is not on tile boundaries.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
cfb_print does not modify either address and contents of
the pointer that is pointing drawing text.
Thus, it can add a const modifier.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
cfb_framebuffer_finalize() invert the framebuffer, and it still
leave as inverted after executing the function.
It restores the framebuffer at the end of the cfb_framebuffer_finalize()
for the continued drawing.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
dev and clear_display parameter are unused and only
the framebuffer was cleared. A condition which calls
cfb_framebuffer_fanalize when clear_display is
true is implemented. Then not only the buffer,
but buffer and display are cleared.
Signed-off-by: Dölker Kim <KDoelker@baumer.com>
This function had only one use in SenML CBOR formatter and it
contained some specific tweaks, so move the function to be a
static member of that module.
Fixes#53674
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Fail compilation when incorrect configuration is detected, i.e. when
SHELL_BACKEND_SERIAL_CHECK_DTR is set but UART_LINE_CTRL is not set.
Use periodic timer to wait for DTR instead of waiting in uart callback
to prevent blocking caller workqueue and/or sleeping in ISR.
DTR check was only ever supported with interrupt driven backend so add
appropriate depends on to Kconfig.
Fixes: e9f238889b ("shell: uart: Add waiting on DTR signal before
sending data")
Fixes: #47120Fixes: #54705
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When LwM2M engine is paused, stop functionality just
marks the intent and when we resume, it will send the
de-registration if that was requested.
Otherwise it will stay in SUSPENDED state until resumed
and then goes into ENGINE_DEREGISTERED -> IDLE.
This also removes the blocking loop from lwm2m_rd_client_stop().
It does not need to block because lwm2m_rd_client_start()
is already checking if client is in IDLE.
Fixes#56254
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Various bluetooth tests fails to link because bt_le_ext_adv_set_data
can't be resolved. Solve this by adding a check CONFIG_BT_EXT_ADV
around use of bt_le_ext_adv_set_data.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Instead of passing the test parameters to the websocket function, by
casting the pointer to integer (which may not work on 64-bit platform
due to int/pointer size mismatch), let the test allocate a file
descriptor, and initialize it with test context. The tested functions
expect a file descriptor as an argument anyway, so it's a more intuitive
approach.
The conditional test code within WS implementation can retrieve the test
context by using FD APIs to obtain the object represented by the FD.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Added using LOG_DEFAULT_LEVEL kconfig option in log module
template for assigning the default log level to newly created
module instance, instead of assuming always INFO level.
Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
C only permits labels on statements, not declarations. Separate the
declarations from the assignments so that the labels can target
statements instead.
Signed-off-by: Keith Packard <keithp@keithp.com>
Some cases, especially those dealing with faults need to inject output
manually, so provied a macro for special case.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When lfs mount fails and there is no formatting requested, the return
code must be translated to errno before being passed to the application
layer.
Additionally, only log a warning that the FS will be formatted, when the
system is not read-only.
Fixes#56378
Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
The PAST sender needs to support periodic advertising
and the PAST receiver needs to support periodic advertising
sync.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The check is very unlikely to be needed, but fixing
warning about assigning ARRAY_SIZE to an uint8_t value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
We get compile warnings of the form:
error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
[-Werror,-Wint-in-bool-context]
if (!isprint(byte)) {
^
Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This feature adds support for using a custom function to format
the timestamp used for all logging backends. When the kconfig
option LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP is set the custom
formatting function will always be used.
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
Many/most LE Audio services are dynamically registered,
but have been enabled without BT_GATT_DYNAMIC_DB.
Add select BT_GATT_DYNAMIC_DB for the services. Select
was used instead of depends on to make it simpler
to enable them.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This adds new hidden compilation flags that indicate whether the
implementation is configured to be able to receive/transmit audio data.
The flags are profile agnostic to loosen dependencies between
modules/services.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This vastly increases the performance of file transfers using the
fs_mgmt group over MCUmgr by allowing the file handle to remain open
between commands instead of having to open, feek, read/write then
close the file handle for each invocation.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
There was a bug in the BLE backend when it was the only enabled
backend. Instead of using the API `log_backend_activate` to
activate the backend, the logger requires the first time to be
enabled with `log_backend_enable`.
Signed-off-by: Victor Chavez <chavez-bermudez@fh-aachen.de>
This commit removes the possible race condition when notifying
the bonding request.
When the race condition appears there is possibility that
one of the cores would never send notification for bonding.
This change makes it sure that the notification would be sent
at least once.
Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
Added a new logger backend to recieve data over a BLE
notification characteristic.
The characteristic is based on the UUID from the Nordic connect SDK
service NUS, which allows to have a UART shell over BLE.
The idea behind this, is that this logger can be used directly
with the NRF apps or any other BLE UART terminal app.
Signed-off-by: Victor Chavez <chavez-bermudez@fh-aachen.de>
This change fixes the deregister functionality for
icmsg backend. There are two changes:
Memory access layer was not initialized properly
when the endpoint was registered again. This lead to
memory fault when attepmt to write to the buffer was
done.
Mbox driver was initialized before memory access layer
was initialized. This could lead to race condition
where immediately after the mbox driver was initialized,
the receiving work is scheduled due to pending interrupt.
In that case an attempt to read from garbage address will
occur.
Signed-off-by: Emil Obalski <Emil.Obalski@nordicsemi.no>
Adds the transceive op which is needed for full SPI support. Notably
in RTIO transceive is expected to be a balanced buffer pair of the same
length and have non-null tx/rx bufs.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Adds a callback op to RTIO enabling C logic to be interspersed with
I/O operations. This is not safe from userspace but allowable in kernel
space.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
When sending small buffers out it makes sense to copy rather than
reference to avoid having to keep the small buffer around for the
lifetime of the write request.
Adjusts the op numbers to always be +1 from the previously defined op
id making it easier to re-arrange if needed in the future.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
When demand paging is enabled, only a minimal set of functions
are available at boot. Anything not marked as boot functions
would not be loading in memory at boot which would result in
page faults when jumping to those functions. However, at early
boot, demand paging has not been enabled yet. So we need to
mark necessary functions as boot functions so they are placed
in the correct linker section where they are loaded at boot.
Fixes#56414
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Remove unnecessary guarding. With `BT_DEBUG` removed, those conditions
were not needed anymore.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
We get compile warnings of the form:
error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
[-Werror,-Wint-in-bool-context]
if (!isprint(byte)) {
^
Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This commit adds new API functions for AICS
Setting automatic/manual only gain modes
Setting mute disabled
Use new functions in btp.vcp
Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
We get compile warnings of the form:
error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
[-Werror,-Wint-in-bool-context]
if (!isprint(byte)) {
^
Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
We get compile warnings of the form:
error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
[-Werror,-Wint-in-bool-context]
if (!isprint(byte)) {
^
Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Adds a device pm_toggle shell command which calls pm_runtime_device
functions put and get to toggle the runtime power state.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Store information from the biginfo in a
broadcast_sink->codec_qos struct, and add a reference to that struct
when syncing, so that the stream->qos contains a valid struct
with properly initialized information.
This also adds a guard for the codec_qos.latency as that
is not set nor used by the broadcast sink (as it is
not available).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove Kconfig symbol `BT_DEBUG`. It was not useful anymore with the
previous logging updates.
Replace it, where it was used, by the file local debug symbol.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Add the `zephyr,pm-device-runtime-auto` flag to `pm.yaml` and
`struct pm_device`.
This flag is intended to signify to the boot system that device runtime
PM should be automatically enabled on the device after the init function
has run.
Only run `pm_device_runtime_auto_enable` function on a device if
initialisation succeeded. This prevents actions being run on devices
that are not ready.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
conn->le.keys are set on-demand when actual security action happens and
it is possible that permission check needs to happen before those.
This fix regression in following qualification test cases:
GAP/SEC/AUT/BV-23-C
L2CAP/LE/CFC/BV-25-C
L2CAP/ECFC/BV-32-C
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
When FPU is enabled for Arm64, the saved_fp_context must be tracked by
thread info to visualize correctly the FPU context of threads.
Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
As name suggest upgrade only should allow image upgrades onlu, but due
to greater or eqal sign used in version comparison, upgrade actually
also accepted current version.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Adds an optional feature that can be used to time out a partially
received MCUmgr packet over the shell interface. Prior to this
change, if a header was received, then the whole shell would be
unavailable until the module is rebooted or additional full MCUmgr
packet was sent.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Returning an error code when PM is not supported for a device only makes
writing drivers harder, as instead of checking for failures with `< 0`,
they also need to check for `-ENOTSUP`.
From the point of view of a driver, an `-ENOTSUP` return value is
equivalent to success, as if the device it is trying to turn on doesn't
support PM, by definition it is already enabled. This is equivalent to
the API behaviour when `CONFIG_PM_DEVICE_RUNTIME=n`.
Whether a device supports PM or not can still be determined at runtime
by inspecting the return code of `pm_device_runtime_enable` if
necessary.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Only run `pm_device_runtime_put` on the dependent domain if the original
claim operation succeeded. This fixes unbalanced operations when running
```
pm_device_runtime_get(dev);
pm_device_runtime_put(dev);
```
On a device that does not have PM enabled but does have a power domain.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Both L2CAP and GATT have same requirements with regards to error code
on no encryption when LTK is or isn't present.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
“Insufficient Encryption” shall be returned only if link is not
encrypted and proper LTK is present, otherwise “Insufficient
Authentication” shall be used.
Core Specification 5.4 Vol. 3 Part C 10.3.1
"If neither an LTK nor an STK is available, the service
request shall be rejected with the error code
“Insufficient Authentication”.
Note: When the link is not encrypted, the error code
“Insufficient Authentication” does not indicate that
MITM protection is required.
If an LTK or an STK is available and encryption is
required (LE security mode 1) but encryption is not
enabled, the service request shall be rejected with
the error code “Insufficient Encryption”."
This was affecting GAP/SEC/AUT/BV-11-C qualification test case.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This moves duplicated bt_bap_iso_unbind_ep function call to
be handled when ASE enters BT_BAP_EP_STATE_IDLE state.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes possible double bt_bap_stream_detach() function call.
The bt_bap_stream_detach() called from ascs_ep_set_state
state BT_BAP_EP_STATE_IDLE handler.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The fact of having such extern in iso_internal.h forces the source files
that include this header to include conn_internal.h. This breaks the
encapsulation of conn object.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes incorrect behavior of ISO server listen that was not handling
the case of two endpoints sharing the same CIS/CIG and the endpoints
belonging to different connections.
Fixes: #51552
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This moves the ISO server registration to bt_ascs_init.
When the ASCS gets cleaned up (the callbacks are unregistered), the ISO
server gets unregistered.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This cleans up the code a bit by replacing the occurences of
SYS_SLIST_FOR_EACH_NODE with SYS_SLIST_FOR_EACH_CONTAINER(_SAFE)
so that the explicit CONTAINER_OF() usage is not needed.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes invalid Unsupported Opcode Response_Code that
happened to be sent in ASE Control Point notification
as the response to operation initiated with Mandatory opcode
to support.
When the Unicast Server callbacks are not registered, every
operation that is initiated by client will fail with
Unspecified Error instead.
Fixes: #56139
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes ASE that is not returned to pool when Codec Config
operation failed. The ASE is allocated in Codec Config operation
context. With this fix, if the operation failed to complete,
the ASE is returned back to the pool, so that it can be allocated
again by this or other client.
Fixes: #56138
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes redundant bt_ascs_ase_get_from_slab function and moves it's
functionality to ase_new(). It's sane, because the ASE shall be
allocated from ase_new() function context only.
bt_ascs_ase_return_to_slab() has been renamed to ase_free() to follow
the naming convention. Furthermore, few logs have been fixed/added.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The ID is ensured to be valid before ase_new() function is called, as
the client request is already validated.
On the other hand, if function is called from server initiated procedure
context, the assert shall occur as it indicates stack issue.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This adds cleanup of ASCS that is called when upper layer unregisters
it's callbacks. Without callbacks registered, the service is unusable.
The ASE's that were in non-idle state stay in this state, because the
implementation returns an error on every operation that is performed by
the client. The cleanup added moves all the ASE's to idle state.
Fixes: #56111
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Mode affects access to flash aread for `block_start`. When mode is set
to `BT_MESH_BLOB_READ` function return early, and because
`BT_MESH_BLOB_READ = 0` this is default behaviour. For write flash area
must be erased to allow driver to write there new data - bits can only
be pulled down, so overwrite will not be permitted.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Add is_suspended() routine to have control over the rd client from the
outside whether it is suspended.
Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
Deprecate Kconfig symbol `BT_DEBUG_LOG`. With the new `BT_LOG` having
the same effect, `BT_DEBUG_LOG` is not useful anymore and shouldn't be
used.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Move all Kconfig symbols related to Bluetooth logging into the newly
created `Kconfig.logging`. The logging symbols are now grouped by into a
menu "Bluetooth logging". Closely related symbols are grouped with each
others. For example, audio related logging symbol are found behind a
submenu "Audio" inside the "Bluetooth logging".
The deprecated logging symbols have also been moved in a submenu of
"Bluetooth logging", it's easier to avoid them so.
Behavior of the Bluetooth logging system:
When `LOG` symbol is selected, if Bluetooth is enabled (`BT` symbol
selected), the Bluetooth logging is enabled.
If the user does not set any log level, the Bluetooth logging symbols
will inherit the log level of `BT_LOG_LEVEL`. If the user does not set
the level of `BT_LOG_LEVEL`, the default log level will be the one
defined by the logging subsystem. Which currently is `LOG_LEVEL_INF`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
PR adds 2 acknowledgment contexts to RPR client to handle
scanning and provisioning in parallel.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Consistently process BIS data, codec data and codec metadata.
Range check count of data received so that buffer overflow cannot occur.
Signed-off-by: Chris St John <chris_st._john@bose.com>
Socketpair functionality has matured enough to be used in a
consistent way now regardless of architecture or platform,
even on `native_posix`.
Remove the experimental status to reflect that.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
When receiving extended advertising reports with incomplete
data status, it is not necessary to mark for recovering from
currently assembled fragments, but rather drop them and
start a fresh assembly of subsequently received extended
advertising reports.
Timing changes in the Controller cause Periodic Advertising
PDUs AUX_SYNC_IND + AUX_CHAIN_IND to be placed between
primary channel ADV_EXT_IND and AUX_ADV_IND. This causes the
Controller to generate alternating incomplete and complete
data status reports, exposing the Host bug that is fixed in
this commit.
Relates to commit ba09a252ec ("bluetooth: host: refactor
bt_hci_le_per_adv_report data reassembly").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add automatic adding of the CAP Acceptor Set Member AD data.
This also moves the CAP Acceptor service data into the
cap_acceptor.c shell implementation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add an input device to take input key events as an input and generates
short press or long press devices as output.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Fix ticker to explicitly trigger worker when ticks_to_expire
is less than or equal to elapsed time.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update ticker implementation to reschedule unreserved ticker
that use ticks_slot_window.
This will avoid unreserved ticker from continuously
overlapping with reserved tickers. And the change is
required to reduce processing overheads before reserve
ticker timeout callback executes.
Unreserved tickers with ticks_slot_window will always yield
to any colliding reserved or unreserved tickers.
The implementation moves unreserved tickers (no ticks_slot
value, in this case continuous scan window) to end of a
colliding reserved/unreserved ticker so that reserved
tickers (like central role) do not have high overheads due
to unreserved ticker's prepare (scanner) be preempted
everytime before reserved ticker's prepare (central).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add check to the Remote Provisioning Client model init call
that verifies that the model is located at the root element.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This allows us to get the result of synchronous transfer without
any hacks, just from the net_buf structure.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The ISO hci_le_cis_req event handler was missing
calls to bt_conn_unref and bt_iso_cleanup_acl to properly
clearn up the reference counters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added missing bt_conn_unref where bt_conn_lookup_handle is
called, but where the function returns without providing the
conn pointer to the caller.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When we supply the conn pointer of the remote device that
provides the PAST information, we do a lookup on the
conn_handle using bt_conn_lookup_handle which takes a
reference count. This count is never dereferenced again.
This commit adds calls to bt_conn_unref to ensure that we
do not keep the reference count after the function
returns.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
"The (ATT attribute read) callback can also be used locally to
read the contents of the attribute in which case no connection
will be set."
This means that callback may be called with NULL conn. Since
for ascs_ase_read NULL conn object have no meaning just return
error.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This adds ascs_cleanup() function guarded by ZTEST_UNITTEST. The purpose
of it is to clean up the ASCS between the tests.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Fixes a bug where goto statement results into network layer skipping
the forwarding of unicast message on the ADV bearer, if the message
gets succesfully sent on the GATT bearer. This is undesirable. Node
has no knowledge of which external entity has which unicast address.
It may be possible that Proxy node can deliberately add unicast
addresses of other nodes to the whitelist to receive some traffic
for sniffing.
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
From now app layer is able to return explicit response code and
reason that will appear in ASE Control Point notification.
Fixes issues of ASCS/SR/SPE/BI-(07/08/09)-C PTS test cases, where
PTS was receiving wrong response codes and reasons.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Updated the 3 places in extended advertising where the ticker was
previously inquired about the expiration of another ticker ID in a
separate mayfly (adv_aux, adv_sync and adv_iso). It will now use the
new ticker feature where another ticker IDs expiration info will be
added to the callback.
Channel map updates are now handled in ticker_cb and applied immediately
if the ticker is not running
Signed-off-by: Troels Nilsson <trnn@demant.com>
It is now possible (via the extended ticker interface) to ask for
expiration information for another ticker ID to be returned in the
ticker callback. This utilises the extended ticker interface and a
callback function with a different context to keep the current ticker
interface as unchanged as possible.
Signed-off-by: Troels Nilsson <trnn@demant.com>
Deprecated Health client and server API has been deprecated for two
releases: 3.2.0 and 3.3.0.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Unit test project for bt_pub_key_gen().
This is part of subsys/bluetooth/host/ecc.c unit testing.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Move newly added `bt_data_get_len` and `bt_data_serialize` from `ead.c`
to `data.c`.
Also, removed unnecessary include of `zephyr/kernel.h`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
In case native IPv6 is disabled, Kconfig entries related to native IPv6
stack should not be enabled. Otherwise, circular dependencies can be
created if native stack is disabled, as in case of recent changes in
NET_IPV6_RA_RDNSS option (where a dependency for a native stack module
was enabled).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Create a new Bluetooth library and add Encrypted Advertising Data to it.
Encrypted Advertising Data is a new feature from the Bluetooth Core
Specification 5.4. It provides a way to communicate encrypted data in
advertising, scan response and EIR packets. To do that it introduce a
new advertising data type called `Encrypted Advertising Data`. Also, it
introduce a new characteristic called `Encrypted Data Key Material`,
this provides a way to share the key material.
The library add two main functions `bt_ead_encrypt` and
`bt_ead_decrypt`.
Two helper functions are added to `bluetooth.h`. `bt_data_get_len` and
`bt_data_serialize`, the first one allow the user to get the total size
of a set of `bt_data` structures; the second one generate a spec
compliant bytes array from a `bt_data` structure. The last one is useful
because `bt_ead_encrypt` take as input those kind of bytes array.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Move the SoC Flash nRF sync ticker implementation into
Bluetooth Controller Subsystem folder, as internal headers
are included.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Refactor the Bluetooth Controller's CMakelists.txt to
consistently use zephyr_library_sources_ifdef() and
zephyr_library_include_directories_ifdef().
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This fixes ASE release from QoS configured state.
The `ops->released` callback was not called and the `bt_ascs_ase`
was not returned to the pool, because `stream` object was already
detached.
Fixes: #55900
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes possible dereference of free'd bt_ascs_ase object.
The ASE without ISO connection that goes to Releasing state will be
automously transitioned to Idle state. Thus, the `ase` object might not
be vaild anymore.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This moves ASE Control PDU length validation before request processing.
If the PDU length is not as expected, the operation shall be considered
as invalid. Thus shall be rejected.
ASCS_v1.0; 5 ASE Control operations
"A client-initiated ASE Control operation shall be defined as an invalid
length operation if the total length of all parameters written by the
client is not equal to the total length of all fixed parameters plus
the length of any variable length parameters for that operation"
Fixes: #55747Fixes: #55748
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Fix a memory issue when calling boot_read_bank_header the length should be
the size of `struct mcuboot_img_header`.
Fixes#54459.
Signed-off-by: Joel Guittet <joelguittet@gmail.com>
Add new helper functions to increase readability and to
ensure correctness when aborting procedures.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use the same unicast streams and group for the BAP and CAP
shell commands. This results in maximum flexibility, as well
as the niceness of use from CAP, as well as less memory usage.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When performing the CAP Unicast Start procedure, the remote
server(s) may change the state of the ASE before the procedure
is complete.
If the state change is unexpected, we stop the procedure and
call the callback, and then the caller can decide what to
do after that (presumably call the stop procedure for the
streams that may be setup).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Implements the CAP unicast stop procedures, which is used
to stop (either disable or release) multiple streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Implement the CAP unicast metadata update procedure.
The procedure lets an application update the metadata of one
or more CAP streams in a single function call, while also ensuring
that the provided metadata follows the requirement from CAP.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This modifies the audio.c shell module to support
multiple connections.
This adds support for the cap_initiator unicast-start command,
which supports multiple endpoints on multiple devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Implement the CAP unicast start procedure, which
will put one or more CAP streams from the idle state
to the streaming state, across or more ACL connections.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Move the input listener section declaration in common-rom-misc.ld
instead of using a custom input.ld file. This seems to be the common
practice for upstream iterable sections and seems to solve a
compatibility issue where the section was getting allocated incorrectly
on esp32 based platforms.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add check in CMake files to prevent resource overlap for
TIMER0, TIMER1, RTC0.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
In general, RTC and TIMER driver implements counter API but there
are exception when those peripherals are used in a custom way
(e.g. for system timer or bluetooth). In that case, system must
prevent using counter based on a reserved instance. Previously,
it was managed by Kconfig options but that cannot be maintained
when switching to devicetree configuration of the counter driver.
A new approach removes Kconfig options and instead adds static
asserts in the files which are using direct peripherals. Those
asserts check if given node is not enabled in the device tree.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The TX timeout configured with SO_SNDTIMEO on a socket did not work
properly. If the timeout was set on a socket, the TX would work as if
the socket was put into non-blocking mode. This commit fixes this.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The timeout recalculation logic was duplicated across several routines,
therefore it makes sense to make a helper function out of it,
especially, that the same functionality would be needed for the send
routines.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
SO_RCVBUF option processing at the TCP level was broken. The option
value was only checked once, when the TCP context was allocated. This
made little sense, as at this point the option would not even get a
chance to have custom value. If the user modified the option after the
socket (net_context) was created, it had no effect on the TCP operation.
This commit fixes this, by checking the option value whenever new packet
is processed, so that the configured window size is updated at the TCP
level before we report it in the TCP ACK. In order to achieve this,
introduce a new helper function, to refresh the configured window sizes,
to avoid bloating `tcp_in()` even further.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Some systems can support only legacy OOB pairing while others only
LE SC OOB pairing.
The existent API function "bt_set_oob_data_flag" was removed.
Two new API functions were added:
* "bt_le_oob_set_legacy_flag" to signal that legacy OOB pairing is used
* "bt_le_oob_set_sc_flag" to signal that LE SC OOB pairing is used
The code will now advertise the presence of OOB flag depending
on the type of pairing method(SC vs legacy)
Signed-off-by: Sebastian Panceac <sebastian.panceac@ext.grandcentrix.net>
User can now use self-defined BLOB ID for transfer instead of using
random one each time. This allows to send multiple FW Update Start
messages with same BLOB ID, for example to resume previous one.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
If device rebooted while in `BT_MESH_DFU_PHASE_TRANSFER_ACTIVE` phase
we should not recover into it, but set `BT_MESH_DFU_PHASE_TRANSFER_ERR`
instead. It's because we no longer remember which block is currently
transfered so new FW Update Start must be received and transfer
restarted.
If device rebooted while in `BT_MESH_DFU_PHASE_VERIFY_OK` it means
we didn't manage to apply image before reboot. We should enter
`BT_MESH_DFU_PHASE_VERIFY_FAIL` phase, which will allow to verify it
again and possibly apply. This is with agreement to specification
regarding receiving FW Update Start when FW is already received.
This commit also alligns handle_start with specification: when
FW is already received, we should set phase to
`BT_MESH_DFU_PHASE_VERIFY`, send Status message, then proceed to Verify.
Previously, `verify` was called before sending status, so status
contained phase set to `BT_MESH_DFU_PHASE_VERIFY_OK` or
`BT_MESH_DFU_PHASE_VERIFY_FAIL`. This would prevent DFU Client
enter refresh procedure.
`blob_recover` also expects BT_MESH_DFU_PHASE_TRANSFER_ERR now.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
These targets already received FW so there is no point to transfering
it again. What's more, these targets will not accept transfer and will
be dropped by DFU Client. If FW is already received DFU Client should
skip transfer and proceed to refresh procedure.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Move all audio related shell implementations to the
audio directory, to use the same structure as Mesh.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds dummy link layer for offloaded ifaces, allowing
ifaces to directly receive l2_enable calls
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
In order to take granular input use micro seconds as input for TWT
intervals, this helps us in providing inputs such as 65.28ms without the
need of using floating points.
This also expands the TWT wake interval range to 262.144ms, earlier as
we want to use uint8, limited to 256ms.
Also, remove the units from the variable names, this is unnecessary and
also avoids doing breaking changes.
Update release notes as this is a breaking change, both type and
variable names are changed.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Remove ad-hoc `CHAR_SIZE_MAX` in favor of `BT_ATT_MAX_ATTRIBUTE_LEN`.
The maximum size of an attribute is the same as the maximum size of a
characteristic.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The commit changes the fs_mount to not allow mounting same system,
with the same private data pointer, at two different mount paths.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The pending_sqe logic to track where in the ring queue the concurrent
executor had left off was slightly flawed. It didn't account for starting
all sqes in the queue and ending back up at the beginning.
Instead track the last SQE in the queue, from which the next one in the
queue will the one to start next.
If we happen to sweep the last known SQE in the queue, reset it to NULL
so the next time prepare is called we start at the beginning of the queue
again.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Transactional submissions treat a sequence of sqes as a single atomic
submission given to a single iodev and expect as a reply a single
completion.
This is useful for scatter gather like APIs that exist in Zephyr already
for I2C and SPI.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Implement a custom abort_cb callback to perform Tx and Rx
flush and adjust the SN/NESN values.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ull_prepare_dequeue to not skip events when preempt
does not match the event in the head of the prepare queue.
The head of the prepare queue does not match when
ull_prepare_dequeue has put the head of the queue to the
last of the queue when it is calling lll_resume interface.
This happens when there is already an active event which
needs a preempt timeout to be setup and there is another
non-resume event in the pipeline which now becomes the
head. The fix ensure to restore the order of the events
if a preempt timeout was to be setup.
Currently ull_prepare_dequeue loops through all events
before stopping at the original way the queue was. This is
not efficient and is a scope for improvement in future.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Connected ISO time reservation that was missing the
event start and end overhead values.
Fix missing event end overhead values in ACL connection
time reservation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Calculate CIS offset of secondary CIS(es) using CIG reference point.
This fixes issue with e.g. two CISes associated with separate ACL
connections.
Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit enables having multiple CIS/CIG setups/connects and
teardowns in sequence.
- For central, cig->lll.num_cis is initialized to cis_count and
untouched until ll_cig_remove. The value shall indicate number of
allocated instances, to ensure correct CIG traversal.
- Keep CIG/CIS instances for central until ll_cig_remove
- Initialize CIS instance state vars in ll_cis_create, similar to the
peripheral flow.
- In ll_cig_remove, always release streams and CIG instance. Do not
remove paths, as this is done from host at bt_iso_chan_disconnected.
- Remove unsued cis_count member in ll_conn_iso_group.
- Use correct function ull_iso_lll_ack_enqueue at LLL flush to have
data path respected.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Some recent PRs included conditional compilation for
KCONFIG_BT_LL_SW_LLCP_LEGACY, which must be removed.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The slot reservation code is only valid for the refactored LLCP;
a guard was in place to ensure that it was not compiled in for
legacy controller code. This commit removes this guard
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
This commit removes the code related to advanced scheduling from
ull_sched.c, since this code only works for the legacy controller.
Implementing advanced scheduling for the refactored LLCP is tracked
in its own issue
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The code that was added for delaying notifications to the host,
which was only implemented for legacy controller, is removed
in this commit
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
This commit removes the legacy LLCP code including the
Kconfig option
It also updates the babblesim tests, and removes the
tests for the legacy controller
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The copying from the presets to the stream codec and qos
structs were not done in a way that worked. Fixed by doing
a more proper and deeper copy.
This also fixes a small issue with using the wrong
default preset.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
After commit 3486f133e9
GATT Proxy service registration is broken because it is registered from
settings_load() in mesh_commit(). Because mesh_commit() is called before
sc_commit() is called in gatt.c, bt_gatt_service_register() can't be
called yet.
Use k_work to postpone the service registration.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The BT_BAP_UNICAST_CLIENT_PAC_COUNT is there due to a merge conflict
gone wrong. Removed again.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove redundant use of local variable chan_idx in the
lll_chan_iso_subevent() function.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
For ISO-subevents channel selection must use remap table always
-regardless of channel is a mapped or unmapped channel.
Signed-off-by: Henrik Møller <heml@demant.com>
Ensure that the stream released callback is only called after
the CIS has disconnected. Since the ACL disconnect event
may come before the CIS disconnect event, we use the
unicast_client_ep_idle_state in the unicast_client_reset
function to use the existing state verification, and only
after both the ACL and CIS has disconnected, we
finalize the reset of the stream and call the released
callback, assuming that the CIS can be disconnected.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The BT_ISO_STATE_DISCONNECTING was never set when the
CIS was actually in the disconnecting state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Previously we assumed only a single stream, and deleted
the unicast group on the first stream released.
Now we wait for all the streams to be released before
deleting the group.
This still assumes that all streams are initiated by us
as the client, and will not work if using the
BAP unicast client and server role concurrently.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove a bad LOG_ERR that should never have been merged.
Added the valuet that was logged to the debug log statement.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The conditions of the assert were incorrect compared to the
text, and caused an assert to happen when it shouldn't.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
We get compile warnings of the form:
drivers/console/uart_console.c:508:8: error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
[-Werror,-Wint-in-bool-context]
if (!isprint(byte)) {
^
Since isprint returns an int, change check to an explicit test against
the return value.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Add supplementary header <zephyr/fff_extensions.h>. Add macro
to fff_extensions.h for simplifying definition of custom fake functions
needing call-unique information for producing desired output data.
When an array of custom fake context structures is defined and
the return field within the first structure instance is registered
with the standard SET_RETURN_SEQ() macro of FFF, the
RETURN_HANDLED_CONTEXT() macro provides the inverse logic to
recover the context structure for this called instance. The body of
the custom fake handler is provided to the RETURN_HANDLED_CONTEXT()
macro for appropriate execution and access to the custom fake
parameters.
A test suite is also provided to verify macro implementation and
illustrate usage. It is at:
zephyr/tests/subsys/testsuite/fff_fake_contexts/
This code was verified by:
1. (Pass) west build -p always \
-b unit_testing tests/subsys/testsuite/fff_fake_contexts/ && \
./build/testbinary
2. (Pass) west build -p always \
-b native_posix tests/subsys/testsuite/fff_fake_contexts/ && \
./build/zephyr/zephyr.exe
3. (Pass) ./scripts/twister -p unit_testing \
-T tests/subsys/testsuite/fff_fake_contexts/
4. (Pass) ./scripts/twister -p native_posix \
-T tests/subsys/testsuite/fff_fake_contexts/
5. (Pass) cd doc && build html-fast
Fix#55246
Signed-off-by: Gregory Shue <gregory.shue@legrand.com>
The timeout used upon opening the link with the server relates to the
PB-Remote Link Open procedure, but not to the whole provisioning
procedure. For the provisioning procedure, the timeout should be at
least 60 seconds as explained in section 5.4.4.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit fixes an issue where the RPR Client gets stuck after sending
PDU to RPR Server (even with segmented flag), but doesn't hear anything
back from the server.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit fixes an issue, where the RPR Client gets stuck forever
until reboot if it doesn't receive Link Status or Link Report message
when openinig the remote provisioning link.
The RPR_CLI_LINK_OPEN flag was used to control the remote provision link
and protect against receiving an unexpected message, but it didn't cover
a case when neither of messages were received from the RPR Server.
cli->link.state only changes by Link Status or Link Report message and
is set to BT_MESH_RPR_LINK_IDLE when opening the link. Therefore, when
the RPR Client's timer timed out, the client didn't reset its internal
states.
This commit adds an additional state to cover this intermediate state
when the client initiated the link opening but didn't receive any
response.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
To enable Bluetooth controller coexistence feature, there is
implementation of ticker task, which aborts any ongoing radio events
during assertion of the grant pin. This solves the co-existence issue
in the role of the subordinate transceiver.
Signed-off-by: Tomáš Beneš <tomas@dronetag.cz>
Remove redundant EVENT_IFS_US used in Control PDU timing
calculation. The BIG radio event ends with Control Subevent
and hence there is no need to add EVENT_IFS_US at the end
of the BIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO Sync Receiver PDU reception to enqueue towards ULL
any PDUs that where received before the BIG event in
unreserved timespace is aborted due to overlap with other
radio events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In the case of a constrained system that uses dynamic channels (ie, not
much initial credits), the user's log would be flooded with those three
messages.
This is not really an error per se as the stack will handle it properly and
reschedule the sending of the buffers as soon as more credits arrive.
Thus downgrading the severity of
- the l2cap messages, as they are only compiled when dynamic channels are
enabled
- the conn message. Reporting the error belongs in the upper layers.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Currently the zperf_tcp_receiver can handle only one TCP connection
each time, modify the code to poll and handle multiple connections.
Take the occasion to unify the bind and listen part of the code
between ipv4 and ipv6 part using a structure introduced to handle
the multiple connections.
Now in case the zsock_recv fails, we can't stop every connection
and fail through the error label, so just print the error message
and report the failure through the callback.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reduce the scope of in4_addr_my and in6_addr_my pointer variables
that are currently global, but they are used only inside
tcp_receiver_thread.
Take the occasion to fix a typo in one error message.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
This moves bt_data_parse function outside of hci_core.c.
Having it in separate file makes unit testing easier as the
function do not use kernel objects, thus can be used in unit tests
without a need for adding any mocks.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Avoid the use of weak functions and call the respective functions only
if vendor-specific data path is supported. The weak dummy functions
will not implement the desired behavior anyway. This change makes it
explicit that these functions need to be implemented by the vendor.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
When releasing a stream as the unicast client, we may get
either the ASE state notification with state idle or
the control point notification first. If we get the
ASE state notification first, we pretend we get the
CP notification first, and call the release callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the unicast client operation callbacks to the shell, simply
printing the values sent by the server.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add callbacks for control point notifications sent by the
unicast server. These will allow the upper layers to know
if and why a specific operation failed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The "Invalid Length" response code was called truncated,
which does not match the spec definition.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Implemented:
-- Released framed padding PDUs when data received in SDUs for a given
event do not fully utilise BN.
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
When building with an LLVM toolchain get the following warning:
bluetooth/mesh/pb_adv.c:774:4: error: expression which evaluates to zero
treated as a null pointer constant of type
'void *' [-Werror,-Wnon-literal-null-conversion]
PROV_BEARER_LINK_STATUS_SUCCESS);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix by adding a cast to (void *).
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Adds persistent storage for SAR server RX and TX set cmd parameters.
Also ensures that SAR RX and TX parameters are set back to default values
upon reset of the mesh device.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Fix NULL dereference when dereferencing txing_stream, which was used
instead of default_stream.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Cast pointer to `void *` for `%p` parameter.
Otherwise lots of warnings in the log like below:
`<wrn> cbprintf_package: (unsigned) char * used for %p argument.
It's recommended to cast it to void * because it may cause
misbehavior in certain configurations. String:"%s: (%p): >>
length:0x%08x cur:%p, end:%p" argument:3`
Signed-off-by: Jun Qing Zou <jun.qing.zou@nordicsemi.no>
Inherit BT_ISO_TX_BUF_COUNT value when BT_ISO is enabled
to set BT_CTLR_ISO_TX_BUFFERS count.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing radio configuration that limits the maximum PDU
len on reception to consider that Control PDU can be larger
than the max PDU size in the BIS parameters.
Use dedicated PDU buffer for transmission and reception of
BIG Control PDUs so that it is independent of maximum ISO
PDU length which can be less than BIG Control PDU length.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This fixes "Conditional jump or move depends on uninitialised value(s)"
error seen in valgrind.
The stream object that is allocated by application has to be initialized
as it may contain invalid data.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The word "valid" is already in use to mean slots that return true for
`bt_mesh_dfu_slot_is_valid`, whereas `bt_mesh_dfu_slot_foreach` iterates
over all added slots.
Signed-off-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
This moves net_buf_simple related code to separate source file.
Having those in separate file makes unit testing easier as simple
network buffers do not use kernel objects, thus can be used
in unit tests without a need for adding any mocks.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
As there is dedicated NET_BUF_SIMPLE_* logging macros set,
NET_BUF_SIMPLE_DBG shall be used in this place instead.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Add support for setting the location value
(BT_CODEC_CONFIG_LC3_CHAN_ALLOC) in the codec configuration.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The function is now called get_named_preset and only
returns a named preset. The QoS parameter handling
has been moved to a new function, cmd_stream_qos,
which can be used to set specific QoS for a stream.
The get_named_preset does also no longer set the default
preset, and cmd_preset must be used for that now.
This means that a function like cmd_config no longer
has any side effects, thus making it easier to set up
multiple streams with different presets.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The hacky handle_metadata_update that copied the metadata to
a variable, since stream->codec->meta could not be modified,
has been replaced with a proper solution now that
stream->codec->meta can be modified.
It still only supports settings the streaming context, but
it is much easier to expand now.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Make the BAP shell presets constant. This reflects more
what they represent, and make it not only possible, but also
easier, to modify the individual streams QoS and Codec
configurations, without affecting other streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Most of this struct is bookkeeping for the dynamic channels.
This isn't needed for e.g., a simple peripheral using GATT.
With a peripheral_hr build for nrf52840dk_nrf52840, we save
280 bytes of RAM.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
In dns_resolve_reconfigure() check if the DNS servers already exist
before cancel all ongoing queries. This will solve an issue with
getaddrinfo() returning DNS_EAI_CANCELED when receiving a retransmitted
DHCP offer and when receiving a IPv6 Router Advertisement.
Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
Mutex and double-linked list can be statically initialized.
This removes a little bit of boot time overhead.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
When a stream for a sink ASE goes into the enabled
state we automatically execute the receiver start ready
operation as the unicast server.
This makes the shell easier to use as the server.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bap send command would set txing_stream but the
pointer would never be reset.
The txing_stream is mainly to handling the start_sine,
so only {start|stop}_sine commands now sets this.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit enables zephyr to configure the FatFs FF_FS_REENTRANT
option and support fs actions from multiple threads.
CONFIG_FS_FATFS_REENTRANT enables the option and provides zephyr
mutex wrappers.
Signed-off-by: Nicola Ochsenbein <Nicola.Ochsenbein@husqvarnagroup.com>
The multi resource and create flags were reversed, meaning that resources
were defined as multi resource but weren't being created by default. That
doesn't reflect the LWM2M Software Management, which specifies which
objects can be multi resource and which are mandatory.
The post write callbacks were assigned to the validate callbacks.
Signed-off-by: Michal Ciesielski <michal.m.ciesielski@voiapp.io>
NVS cache was used only in read function. This commit add the usage of
NVS cache in write and gc functions.
Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
Add opcode information for cmd timeout assert,
since BT_DBG usually not show in real product,
however we can't see any information just from
assert message.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
When vendor specific commands are disabled by setting
BT_HCI_VS=n the host still calls bt_read_static_addr,
but that function is not compiled in, resulting in a
build error.
Fixed by moving the code in controller/hci/hci.c
outside of the conditional compile
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Package length was previously stored on 10 bits which limited
package size to 1023 bytes. Descriptor which contained package
length field had one unused bit which can be used to increase
package length field to 11 bits doubling the maximum package
length.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
When packacge exceeds the limitation warning log is printed
and message is dropped.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Some internal macros were still using 2 suffix which comes from
time when there was v1 and v2. Cleaning up by removing the suffix.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Reschedule dedicated relay adv sets immediatey after finishing
advertising of the previous relay message. This allows a node to
relay messages as fast as possible when Relay Retransmit Count state
is zero using less relay adv sets.
When Relay Retransmit Count state is non-zero, the delay doesn't do
anything as the time between pushing a relay message to the host and
triggering adv_sent callback will be greater than this delay. In this
case the relay adv set will send a next message immediately.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The unicast client would attempt to send the
receiver start ready opcode to the server for
source ASEs before the CIS was connected, which
is a spec violation.
The code has been refactored to set a boolean,
and then send the receiver start ready opcode on
CIS connection instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes compilation errors of BabbleSim tests generated by gcc-12
when MOD_REL_LIST_SIZE is zero.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
A subscription check was still being done in the
gatt_notify_multiple_verify_params() fn, regardless of the value of
CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION.
This could lead to getting this warning if BT_GATT_NOTIFY_MULTIPLE is
enabled, and the notifications not being sent to unsubscribed peers.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
[216/319] Building C object zephyr/subsys/bluetooth/controller/
CMakeFiles/subsys__bluetooth__controller.dir/hci/hci.c.obj
zephyrproject/zephyr/subsys/bluetooth/controller/hci/hci.c:
In function 'hci_vendor_cmd_handle_common':
zephyrproject/zephyr/subsys/bluetooth/controller/hci/hci.c:5459:17:
warning: implicit declaration of function 'vs_set_min_used_chans';
did you mean 'll_set_min_used_chans'? [-Wimplicit-function-declaration]
5459 | vs_set_min_used_chans(cmd, evt);
| ^~~~~~~~~~~~~~~~~~~~~
| ll_set_min_used_chans
....
zephyr-sdk-0.15.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../
../../../arm-zephyr-eabi/bin/ld.exe: zephyr/subsys/bluetooth/controller/
libsubsys__bluetooth__controller.a(hci.c.obj): in function
`hci_vendor_cmd_handle_common':
zephyrproject/zephyr/subsys/bluetooth/controller/hci/hci.c:5459: undefined
reference to `vs_set_min_used_chans'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Once the bt_ascs_ase is taken from the mem_slab, it has to be memset to
override the junk data.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The z_set_timeout_expiry() function is a wrapper provided in the
timeout subsystem that has some corrections for timelicing. But the
suspend code doesn't care; by definition there are no active threads
that might be timeslicing at the point where the OS is suspending.
Use the lower-level timer driver API instead.
(z_set_timeout_expiry() is also about to disappear)
Signed-off-by: Andy Ross <andyross@google.com>
1. `zsock_socket()` gets the right packet familiy.
2. `inet_pton()` returns 1 on success.
This should address #55193.
Signed-off-by: Sebastian Arnd <sebastianarnd@gmail.com>
Provide a means of declaring zero or more HTTP services, each
with zero or more static HTTP resources.
Static HTTP resources are those which have fixed paths[1] which
are known prior to system initialization. Some examples of
static http resources would be
* a forwarder from '/' to '/index.html'
* a REST endpoint with fixed path '/api/foo' and detail
pointing at some implementation-specific function
* a Javascript file in string form with fixed path '/js/util.js'
* a 'construction' image with path '/res/work.png'
* a gzip-compressed 'Hello' HTML file at '/hello.html'
Without describing in any detail how static HTTP resources are
organized or served by any given HTTP server, we can describe
what static resources exist on a system in a common way that
does not require any optional facilities (e.g. filesystem) and
relies only on addressable memory.
Additionally, for the purposes of simply allowing others
to implement custom HTTP servers in a consistent way, or
benchmarking implementations, or having a consistent testsuite
to use across multiple implementations, it is helpful to have
a common method to declare HTTP services and static resources
for Zephyr.
[1] https://en.wikipedia.org/wiki/URL
Signed-off-by: Chris Friedt <cfriedt@meta.com>
In the unicast client we should reset the stream before calling
the released callback. This is so that we can reuse the stream object
in the released callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
USB Mass Storage Specification for Bootability requires MODE SENSE(10)
command. MODE SENSE(6) and MODE SENSE(10) generally access the same data
but differ in the maximum allocated length and LLBAA support. However
there is no point in extracting common handling because there no mode
pages are supported now.
Fail MODE SENSE requests if asking for anything other than supported
page codes (to which the essentially hardcoded response is valid).
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Several places used the bt_audio prefix where it shouldn't.
Also moved the BAP documentation to its own file.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added a new header file bap_lc3_preset.h which contains
the definitions of the LC3 (pre)sets defined by the
BAP spec.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rename the bt_audio_unicast_client API to bt_bap_unicast_client
and move the API to bap.h
Also adds the _bap_ infix to the bt_unicast_client functions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rename the bt_audio_audio_server API to bt_bap_unicast_server
and move API to bap.h.
This also adds the _bap_ infix for bt_unicast_server.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes compiler unused variable error
warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
461 | struct bt_ascs_ase_status *status;
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Mass Storage Class allows device to either silently discard OUT endpoint
data after receiving invalid CBW or to STALL the OUT endpoint (and keep
it STALLed regardless of host clearing halt) until Reset Recovery.
Switch from silently discarding to STALL in order to allow host realize
that device waits for Reset Recovery without transferring complete OUT
data.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
While both the server and client are allowed to terminate
the CIS when a stream is released, it is, per the BAP spec,
the client's responsibilty. This commit modifies it so that
the client will actually get a chance to do its responsibilty
by adding a small delay before our ASCS disconnects the CIS.
The CIS disconnection has kept with a delay, rather than
removed, in case that the Unicast Client is not properly
performing it's responsibility.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix scan window value corruption due to modification of
stored ticks_window value when enabling continuous scan.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Removes the unused pac_pache from the unicast_client.
This moves the storing of the PAC records (in the form of
struct bt_codec) from the stack to the upper layers.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The thread analyzer cannot be really used with the
POSIX architecture.
As:
* Code takes 0 simulated time to execute.
So the analyzer will report 0 cycles being used.
* The stack allocated by Zephyr is not actually used
(except for a tiny part used by the arch code itself
to do a bit of thread bookkeeping).
The POSIX architecture uses a separate stack
(from an underlying Linux pthread) which Zephyr is blind
about. So the thread analyzer is going to only report
a tiny stack utilization.
Prevent users from selecting them together to avoid confusion.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Initial commit introducing the input subsystem into Zephyr.
Includes the input_event data structure, the input_report_* APIs, an
iterables sections based subscription API and two operation modes:
synchronous, where the listeners are called directly, and asynchronous,
where the listeners are called in a dedicated thread.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Latest modification to LLCP removed 'monitoring' of cis->established
flag in LLCP, relying instead on signal through ULL.
For this to work properly the signal must also be generated, so this is
introduced. Note - checking of cis->established flag could be removed
if caller ensures only calling once (on establish condition)
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
This adds commands to advertise Solicitation PDUs, configure
On-Demand Private Proxy and manage Solicitation PDU RPL.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
This is initial implementation of Proxy solicitation procedure.
This includes:
- support for sending and receiving Solicitation PDUs
- On-Demand Private Proxy functionality (Server and Client) controlling
behaviour of node after receiving Solicitation PDU
- Solicitation PDU RPL Configuration (Server and Client), which manages
Replay Protection List for Solicitation PDUs.
Proxy Solicitation allows to enable advertising of Proxy service on node
by sending Solicitation PDUs. These PDUs are not part of Mesh messages;
instead, these are non-connectable, undirected advertising PDUs with
their own format, containing Proxy Solicitation UUID.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
This patch adds for handling Models Metadata Get Page 128.
Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Composition Data Page 1 contains information about relations between
models. Implementation saves relations into array of tuples
{ptr to base, ptr to extension, relation type} on model initialization
and uses this information to construct Composition Data Page 1.
Appropriate structures and methods were added to API, allowing user to
parse all received data into Composition Data Page 1 formats:
Composition Data Page 1 Element, Model Item, Model Extension Item.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
- Add entry for client and server in composition data.
- Add Client commands to aggregate and send messages.
MESH/SR/AGG/BV-02-C requires more key slots.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Includes Opcodes Aggregator Server and Client. To use Opcodes Aggregator
client features with some client model, that client should support async
API.
Co-authored-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
Co-authored-by: Mia Koen <mia.koen@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds support for private beacon sending and receiving.
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Add Transport SAR Configuration models to shell.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Add support for:
- SAR Configuration Client and Server models
- Transport SAR configuration states
- Using SAR Transmitter/Receiver states in segmentation
and reassembly process.
Bsim tests fixes:
- Fix failing replay attack test. The replay attack test doesn't
consider retransmission attempts at the transport layer. When
retransmission happens, SeqNums get increased and the test logic
doesn't work anymore. The simplest fix would be to disable
retransmissions at the transport layer.
- Add device synchronization API to synchronize transport va test.
Device configuration may take different time on transmitter and
receiver. Add synchronisation barrier between devices.
- Fix msg_frnd test. Timing in transport sar behavior has been
changed, which affected test_friend_msg test. Now acknowledgments
are sent much faster and this needs to be considered in the test.
- Fix unicast_low_lat test. Increase number of retransmission
attempts when long segmented message is sent.
- Reduce timeout in kr_old_key test.
- Relax SAR RX state configuration in DFU and BLOB tests.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Anders Storrø <anders.storro@nordicsemi.no>
Co-authored-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
- Adds Large Comp Data Server and Client
- Defines some dummy metadata for Health Server
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
- Adds Large Composition Data Server and Client definitions
- Adds Client API definition
- Adds Health Server Metadata definition
- Refactors Composition Data processing (as a Server) to use common
methods with Large Comp Data Server
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Stine Akredalen <stine.akredalen@nordicsemi.no>
Co-authored-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds commands in the mesh shell for remote provisioning client
operation, including scanning, provisioning and reprovisioning.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds remote provisioning models rpr_srv and rpr_cli, and exposes them as
a bearer for the provisioning process.
The remote provisioning models provide the following features:
- Remote provisioning of new devices, using a remote provisioning server
as a proxy.
- Reprovisioning of existing devices, generating a new device key and
changing addresses and composition data.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Composition data page 128 represents the new composition data after a
composition refresh procedure. The implementation stores the old
composition data (before applying a DFU or similar), and uses that as
page 0 if present. As the device has already rebooted by the time page
128 becomes active, its active composition data is page 128, while the
backed up data is the "old" data, which should be shown as page 0.
Co-authored-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds conditional support for the BLOB and DFU models in the mesh shell.
Additionally creates a dummy BLOB stream for testing.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Anders Storrø <anders.storro@nordicsemi.no>
Co-authored-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Co-authored-by: Mia Koen <mia.koen@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds support for the Device Firmware Distribution Server model from Mesh
Model specification v1.1.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
Co-authored-by: Anders Storrø <anders.storro@nordicsemi.no>
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Co-authored-by: Mia Koen <mia.koen@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds DFU models from the Mesh Model specification v1.1.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Co-authored-by: Anders Storrø <anders.storro@nordicsemi.no>
Co-authored-by: Mia Koen <mia.koen@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds support for the BLOB Models from Mesh Model specification v1.1.
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Anders Storrø <anders.storro@nordicsemi.no>
Co-authored-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Co-authored-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
Co-authored-by: Mia Koen <mia.koen@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Implementation of the enhanced provisioning authentication (EPA)
that is based on SHA256 and HMAC security algorithms.
OOB authentication mandates EPA usage.
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
All mesh 1.1 features are gathered behind a KConfig options.
Default is disabled.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Add a callback similar to net_recv that notifies the application when a
message is received in access layer. This is is useful for testing
purposes (especially automated testing).
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
This prevents a Configuration Client from binding an app key to a model
that only supports DevKey-based security.
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Mesh Profile Specification Errata 11341
3.6.4.3 Message error procedure
When the Upper Transport layer receives a message that is not
understood, then the message shall be ignored.
A message that is not understood includes messages that met one or more
conditions listed below:
• The Transport Control message opcode is unknown by the receiving node.
• The Transport Control message size for the Transport Control opcode
is incorrect.
• The Transport Control message parameters contain values that are
Prohibited
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Mesh Profile Specification Errata 11302
Section 3.5.5.
When a Friend node receives a message that is destined for a Low Power
node (i.e., the destination of the message is a unicast address of an
element of the Low Power node or in the Friend Subscription List), and
the TTL field has a value of 2 or greater, then the message shall be
processed as follows: If the Friend Queue already contains a message
with the same SEQ and SRC fields as in the received message, or if the
SRC field of the received message is a unicast address of an element of
the Low Power node, then the message shall not be stored in the Friend
Queue. Otherwise, the TTL field value shall be decremented by 1, and
the message shall be stored in the Friend Queue.
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Mesh Profile specification errata 11627
Section 3.10.5:
When a node is added to a network, the node is given an IV Index.
If the node is added to a network when the network is in Normal
operation, then it shall operate in Normal operation for at least
96 hours. If a node is added to a network while the network is in
the IV Update in Progress state, then the node shall be given the
new IV Index value and operate in IV Update in Progress operation
without the restriction of being in this state for at least 96 hours.
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Mesh Profile Errata 11392
Section 4.4.3.2.1 Current Fault state:
When the value of a Health FastPublish Period Divisor state is non-zero,
and a Current Fault Fault Array (see Section 4.2.15.1) for at least one
Company ID contains records, an unsolicited Health Current Status
message set to the value of that Company ID and the FaultArray field
containing a sequence of faults representing a sequence of faults in the
Current Fault Fault Array (see Section 4.2.15.1) shall be published
every number of seconds as defined by the value of the Publish Period
divided by the value represented by the Health Fast Period Divisor
state, or every 100 ms (the minimum Publish Period value whichever
is greater.
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Mesh Profile Specification Errata 11737 specifies that
Period/Count Log value 0x11 is not defined Log field
transformation in Table 4.1.
Errata 11737 adds value 0x11 to Log field transformation
table with 2-octet value equal to 0x10000 which does not fit into
two octets. This patch changes period calculation to 32-bit precision.
There is also a special case for publication count. If the
log value is equal to 0x11 then the publication count value
should be 0xfffe. When sending Hearbeat Publication Status
message we should return the same value as the one received
in Publication Set so we have to add a case in hb_pub_count_log().
Co-authored-by: Alperen Sener <alperen.sener@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Allow to register a callback function which is called when a firmware
update is canceled by the cancel command.
Signed-off-by: Marc Lasch <marc.lasch@husqvarnagroup.com>
If an event with corrupted length arrives, the extra check makes the
handler return early to avoid reading data out of bounds.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
When possible re-use the already allocated RX node for notifications.
Store (retain) RX node and Link element on RX if NTF could occur.
Pass link element to LLCP (ull_cp_rx()) together with RX node.
New RX node type RETAIN introduced to signal retention
When no RX node is available allocate one and hold off TX on procedures
until such time that a node is available for NTF.
In case waiting for NTF buffer avail is needed, allocate and store TX
node to use for TX once NTF becomes available.
CIS Established (incl. timeout handling) is now handled entirely as a
specific event driven by ull_conn_iso - ie removal of procedure check
of cis->established and cis->expire, as this is doubling mechanism
in the conn_iso context.
Unit test and helpers updated to handle new node type.
Function ull_cp_release_ntf() was used only in unit test, so moved to
helper context.
Updating release_ntf to handle the fact that with piggy-backing in test
context the node used for NTF can be from two different memory pools
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
When doing "bt connections" the currently selected ACL (default_conn)
is now indicated with a "*" making it easier to determine which
of the connections is currently selected.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use internal constant ZSOCK_POLLIN instead of POLLIN to
make the http_client source file compile without error with
CONFIG_NET_SOCKETS_POSIX_NAMES disabled.
Fixes#55423
Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
Those files includes soc.h header which exists not for all boards.
soc.h consists soc-depended defenitions and need to be included by
soc-depended sources
Signed-off-by: Dmytro Semenets <dmytro_semenets@epam.com>
Combining CONFIG_LOG_OUTPUT_FORMAT_LINUX_TIMESTAMP and
CONFIG_LOG_TIMESTAMP_64BIT results in a wrong timestamp, as the
Linux timestamp format print call assumes a 32 bit variable for
the seconds. Fix it by using a different print format for 64 bit
timestamps.
Fixes: #55372
Signed-off-by: Martin Sollie <ms@aziwell.no>
Changes Kconfig symbols to depend on symbols rather than selecting
them, this avoids a cmake dependency loop.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Changes Kconfig symbols to depend on symbols rather than selecting
them, this avoids a cmake dependency loop.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
In the Bluetooth Core Specification, the minimum
ISO_Data_Packet_Length is 0x0001, hence fix the
BT_ISO_TX_MTU range to allow a minimum value of 1.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
By using an mpsc queue for each iodev, the iodev itself is shareable across
contexts. Since its lock free, submits may occur even from an ISR context.
Rather than a fixed size queue, and with it the possibility of running
out of pre-allocated spots, each iodev now holds a wait-free mpsc
queue head.
This changes the parameter of iodev submit to be a struct containing 4
pointers for the rtio context, the submission queue entry, and the mpsc
node for the iodevs submission queue.
This solves the problem involving busy iodevs working with real
devices. For example a busy SPI bus driver could enqueue, without locking,
a request to start once the current request is done.
The queue entries are expected to be owned and allocated by the
executor rather than the iodev. This helps simplify potential
tuning knobs to one place, the RTIO context and its executor an
application directly uses.
As the test case shows iodevs can operate effectively lock free
with the mpsc queue and a single atomic denoting the current task.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Handling panicking while in an ISR. Instead of attempting to call
`pm_device_get` for each character, ensure that the hardware is enabled
when `log_panic` is called.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Allow the log_backend_uart char_out implementation to integrate with
'Device Runtime Power Management'.
Without using runtime PM, it is impossible for the application to manage
the power state of a UART instance, given that any module in the
application could theoretically LOG_* or printk at any point in time.
This removes the need to manually call `pm_device_state_set` when the
lowest power states must be reached, while still allowing log messages
to be output.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
The asserts in the USB-C stack functions were causing compilation
errors when asserts were enabled in Kconfig.
This was caused because the asserts checked if the functions
parameters were within limits specified by the state machine arrays.
At the position of these asserts, these arrays were only declared
without specifying the size of them, what prohibited the asserts from
knowing the size of arrays and checking if specified value is within
limit of it.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
When a query is done, the query isn't set to NULL.
This can cause a nullptr exception in invoke_query_callback().
Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
This gives our users some indication of why they are not receiving
long advertisements.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
If getting the conn info of an ISO channel, the ISO channel may
not yet have an ACL connection, so we cannot get the
ACL source and destination addresses from the ACL.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Using `struct shell *shell` would be more consistent but triggers CI
check on MISRA rule 5.7 "A Tag name shall be a unique identifier"
Signed-off-by: Simon Frank <simon.frank@lohmega.com>
Font kerning was used but it was not possible to change it.
Also, font_idx was set to zero twice in init.
Signed-off-by: Simon Frank <simon.frank@lohmega.com>
Track LBA rather than byte offset in order to simplify the code and
support devices larger than 4GiB.
Signed-off-by: JP Sugarbroad <jpsugar@amazon.com>
Fix Extended Scanning support for BT_CTLR_LOW_LAT variant
of the Controller implementation by closing the scan window
for every ADV_EXT_IND PDU received that that ULL_LOW context
is enabled back and ticker job can process the request to
start auxiliary PDU reception. Without the change the
ticker job would only run at the end of the scan window that
caused the auxiliary scan prepare to assert due to delayed
ticker timeout expiry callback.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Packet handlers registered with net_conn API should not use NET_CONTINUE
to report packet processing status. As they register for a specific
local port, it cannot be assumed someone else will handle the packet,
and for net_conn this status is not really handled differently from
NET_OK. Therefore, reporting NET_CONTINUE, and not freeing the packet,
can result in a packet leak.
Too short packets should not really be handled differently from other
malformed packets in DHCPv4 module, therefore report NET_DROP instead of
NET_CONTINUE.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
With BT_GATT_SUBSCRIBE_FLAG_NO_RESUB the MCC subscriptions would
be resent to the server on reconnection. Since this may trigger an
error, the error will trigger a call to the MCC discover complete
callback.
For MCP We can assume that the server stores the subscriptions if
we are bonded, and thus we can use BT_GATT_SUBSCRIBE_FLAG_NO_RESUB.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If we discover both sink and source ASEs, then we attempt
to subscribe to the ASE CP characteristic twice. However,
if we are already subscribed, then the callback is not called,
and then the 2nd call to discover will not return properly.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When `CONFIG_BT_SETTINGS_DELAYED_STORE` is enabled, reschedule the storage
work immediately instead of processing it in the current context.
When that config is not enabled, process the storage in the current
context.
Processing this work (i.e. using the settings API and its likely
FLASH-based backend) in the current context (cooperative prio) may mess
with the real-time constraints of the application threads.
Fixes#55067.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Currently, in tcp_received function defined in zperf_tcp_receiver
module, the assignment of session->state to STATE_COMPLETED is
overwritten on the same path to STATE_NULL and a session is
considered free for both STATE_COMPLETED and STATE_NULL, so remove
the assignment to STATE_NULL.
Remove the break from the STATE_COMPLETED case handling so that it
can fallthrough, in case the same session is used after finish.
Remove also the STATE_LAST_PACKET_RECEIVED case because this state
is never reached.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
The modules zperf_udp_receiver and zperf_tcp_receiver use two
different functions to get a zperf session to store the
statistics, there is a TODO comment in the zperf_session module
suggesting to unify that part.
So delete the get_tcp_session function and use get_session for
both TCP and UDP receiver module.
Delete sock field from struct session because it's not used
anymore.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Currently the maximum number of zperf sessions handled is hardcoded
to 4, create a Kconfig parameter, with default value 4, to make the
maximum number of sessions configurable.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
If an event with corrupted length arrives, the extra check makes the
handler return early to avoid reading data out of bounds.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Fixes a segfault if a discovery event happens while discovery is not
active and the discovery callback is null.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Rework the Host Command support. It includes:
-change API to backend
-change a way of defining rx and tx buffers
-fix synchronization between the handler and backend layer
-simplify the HC handler
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Follow naming pattern in the subsystems(logging or shell) and name
the layer between generic handler and peripheral driver "backend".
The name doesn't suit that well to the SHI backend, because there isn't
SHI API itself and the SHI interface is used only for the host
communication. So the backend code includes the peripheral driver itself.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
The Host Commands can be used with different transport layers e.g. SHI
or eSPI. The code that provides the peripheral API and allows sending
and receiving Host Commands via different transport layers is not
actually drivers of a peripheral, so move it to the
subsys/mgmt/ec_host_cmd folder.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Check if device runtime is enabled in the beginning of
runtime_suspend to avoid unnecessary checks.
This does not change the current behavior.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Check if device runtime is enabled in the beginning of
pm_device_runtime_get to avoid unnecessary checks.
This does not change the current behavior.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Use client context to seperate buffer usage.
Use new `TFTP_EVT_DATA` event to send data to application.
Use new `TFTP_EVT_ERROR` event to report error to application.
Update `tftp_get()` and `tftp_put()` API to use the client context.
Signed-off-by: Jun Qing Zou <jun.qing.zou@nordicsemi.no>
Fix the order of setting the alert level before the callback.
Without this fix, the alert level would be incorrect if
the upper layers ever tried to perform any other IAS operations
in the callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Actually `execute_cb` is fed with an array of char* and the size of
that array, instead of a single char* buffer and its byte size.
This fix expects a single, already joined, optional shell argument and
feeds `execute_cb` with proper arguments.
Signed-off-by: Stefan Schwendeler <Stefan.Schwendeler@husqvarnagroup.com>
set_device can be called in interrupt context at least with
stm32u5 soc. Calling k_usleep from there causes the isr
to run forever.
Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
There is a touchy spot where registering a service might result in sending
service changed indications that are not necessary. This is due to a race
condition between the SC work and the GATT DB hash being calculated.
Only allow users to call this API when we know it is safe:
- either before BT is initialized
- or after settings have been loaded (and hash calculated)
Fixes#54047
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Prevent race condtions between the stack and the low-priority thread by
calculating the hash (and acting on it, e.g. for marking peers
change-aware, sending SC indications, etc) in the settings_load() context.
Fixes#54773
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
`ATT_PENDING_SENT` wasn't cleared when L2CAP reported an error when sending
the packet. This resulted in the channel being unusable for ever, since we
only clear that bit on a response (that will never be sent).
Found when setting `CONFIG_SYS_CLOCK_TICKS_PER_SEC=32768` in the
`notify_multiple` test. The kicker was the bug didn't manifest when EATT
wasn't enabled:
- we were queuing two unsubscribes back to back in the test
- on UATT we have to wait for a req-rsp pair before enqueuing a new one
- on UATT we only have one channel anyways
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
In the header the websocket protocol needs a SHA1 hash. This is
implemented using the mbedtls_sha1 function. Select the option
MBEDTLS_MAC_SHA1_ENABLED from the Kconfig of websocket to ensure this
function is build in.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Introduce new USB Mass Storage Bulk-Only Transport implementation
written from scratch. Main goal behind new implementation was to
separate USB and SCSI parts as clearly as possible.
Limited set of SCSI disk commands is implemented in separate source code
file that is internal to USB device stack. While it should be possible
to use the SCSI implementation by other components there is currently no
other user besides USB MSC and therefore SCSI header is kept private.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Use a consistent nil_desc name for the descriptor that
terminates a class (function) descriptor.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Avoid implementations in the subsys emul directory to keep the directory
focused on emulator subsystem instead of consumers. Consumers should be
implemented side-by-side to their drivers
Signed-off-by: Yuval Peress <peress@google.com>
Allow the emulator to sit in the same directory as the driver
implementation. This will make working on the emulator much easier and
keep the emulator subsystem directory clean by allowing it to focus on
the actual subsystem and not the use cases of the subsystem.
Signed-off-by: Yuval Peress <peress@google.com>
In ull_llcp* some functions used in unittesting did not have
the llcp_ prefix
Although this is not a big issue since they are only used when
testing the module this commit adds the prefix so that we
have a more consistent naming
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Update unittests for the following areas/controll procedures
- API
- collision handling
- invalid PDUs
- unsupported procedures
- buffer allocation
- TX queue
- Data Length Update
- PHY update
- Encryption
- Ping
- Version
- Channel map update
- Min. used channels
- Connection update
- SCA
- Terminate connection
- CTE request
- CIS create
- CIS terminate
Also moved the internal API tests from the ull_llcp* files
to the proper unittest C-file
Unused files are removed
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Fix mayfly_prio_is_equal() function when BT_CTLR_ZLI is
enabled.
When Zero Latency IRQs are used, LLL execution priority
is the Zero Latency IRQ priority and will not be equal
to ULL execution priority.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Peripheral CIS supervision timeout due to missing access
address timestamp capture in subsequent subevents when
anchor point was not sync in the first subevent.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Changed incrementing `for` loop counters to `size_t` from `int` to
eliminate warning, "warning: comparison of integer expressions of
different signedness: 'uint32_t' {aka 'unsigned int'} and 'int'
[-Wsign-compare]"
Signed-off-by: Zachary J. Fields <zachary_fields@yahoo.com>
Turn off display_blanking to make it able to refresh on a device
even when blanking default off.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Add missing check for receiver_ready in the state
change to enabling state. This change makes the
the check in the state change similar to the check
in ascs_ep_iso_connected
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add USB device class API to notify class instances that an endpoint
has been halted or cleared due to a feature request.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The Bluetooth 5.4 specification was recently released, and has a new
version identifier (0x0D or decimal 13) assigned to it in the
Bluetooth Assigned Numbers.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Add the zexpect API, inspired by GoogleTest's EXPECT API. This API reports
test failures while allowing test execution to continue. This enables test
reports to show more than a singule failing property on a failing test.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Use proper format for size_t type eliminating warnings of type:
...
error: format '%u' expects argument of type 'unsigned int', but
argument 2 has type 'size_t' {aka 'long unsigned int'}
[-Werror=format=]
...
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commits allows for setting up multiple streams in
a single CIG as the unicast client.
It fixes an issue with the unicast server not using
the configured QoS when transmitting audio data.
Improves upon setting the preset for the different
type of streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The multi-endpoint backend of the ipc_service subsystem contains two
roles with separated implementations: initiator and follower. There
was many code duplications for both roles. This patch introduces a new
IPC library: icmsg_me containing common code extracted from both roles
and encapsulating access to common data fields.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
This change fixes code to match the description in
https://github.com/zephyrproject-rtos/zephyr/pull/55061
(see commit 9ecef4b).
This preserves the previous default behaviour of the
shell dummy backend.
Signed-off-by: Nick Ward <nix.ward@gmail.com>
TCP implementation abused the packet processing result reporting
mechanism, by reporting NET_DROP for every packet other than data
packets (which were passed to the application). This simplified the TCP
implementation a bit, as it didn't need to deal with packet releasing.
While technically it worked, it gave incorrect results when it comes to
packet statistics, as a lot of valid TCP packets were counted as
dropped.
This commit fixes this. Each packet that was properly processed by the
TCP stack is not either released at the TCP level, or passed to the
application. In both cases, NET_OK is returned to the network core,
indicating the packet has been properly processed and consumed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Some operations such as Config, QoS, Enable and Stop
are only available for the unicast client, but since
they share the bt_audio_stream prefix, we leave the
agnostic part of it in stream.c, and move the actual
implementation to unicast_client.c.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
stream.c had code that was only useful for the unicast server/
ASCS, and have been moved to ascs.c instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There was a corner case that last registration timestamp was used
to detect if we can try UPDATE instead of full registration.
When timestamp was not cleared and DNS resolving failed, it might
cause engine to skip the resolving and continue retrying an UPDATE
message until timeout.
Fixes#54504
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When we have establised an DTLS handshake and try LwM2M Update,
if the server rejects it, we fall back to sending full registration
but when doing so, we should also clear out any observations.
It was intentional that we don't go to ENGINE_DO_REGISTRATION
state as that would close the socket and cause DTLS handshake.
Fixes#54974
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Only socket error that we should ignore is EAGAIN (EWOULDBLOCK),
others might be indicating that there are some serious errors
in network layer.
When network stack would block us, just drop the packet and
let CoAP layer handle the retrying.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Various functions, mostly concerning time-series cache, were not
using const pointer while they still did not modify the content.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
In the switch statement there are two cases guarded by ifdef's.
These cases are not compiled in for the following Kconfig settings:
BT_PERIPHERAL=n
BT_CTRL_PER_INIT_FEAT_XCHG=n
The following function call then becomes dead code
This is fixed here by adding the proper guards around the whole case
statement
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Dummy shell was always started with log backend enabled with filter
statically set to INFO level.
AFAIK no use of such log backend can be made, thus causing waste of
resources.
The new changes keep INFO as the default filter level. In order to
disable log backend to be attached to the Dummy shell,
CONFIG_SHELL_DUMMY_INIT_LOG_LEVEL_NONE has to be set.
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
There are just list of child files to include, right now there's a hint
of that trying to be alphabetical but then entries have been added with
various logic, so one has to figure where stuff has to be added.
Rewrite these to:
- keep the list alphabetical, for CMakeLists unconditional first,
conditional after so one just has to select and sort
- drop the spaces in the Kconfig
- use a single space between target and directory
- rename from "Sub Systems" to "Subsystems" (single word)
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Any Power Delivery message state that expects a reply must
start a sender response timer. This change addes a super
state that implements the Sender Response Timer
functionality, from which Power Deleiver messages states
can inherit from.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
LEGACY_INCLUDE_PATH has been defaulting to "n" and marked as deprecated
in both v3.2 and v3.3. Drop the option entirely for v3.4.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Minor refactoring in getaddrinfo() to make the code easier to
read and to make handling IPv4 and IPv6 support more equal.
- Move common wait and error handling code to exec_query()
- Use the same check for CONFIG_NET_IPV4 and CONFIG_NET_IPV6
- Add extra sanity check for family before exec_query()
- Do not set errno when return DNS_EAI_ADDRFAMILY
Fix issue with setting port number for all DNS servers.
Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
Handle RA RDNSS and use the first DNS server fetched. This is needed
when building IPv6 only without static DNS server IP addresses.
This implementation does not handle the lifetime, because the current
resolve logic does not have support for a DNS server lifetime.
Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
There is no reason why the default size should be 2,
because an event is only a combination of
{uint32_t + void*} + info
Using 2 as default causes a high risk of loosing events,
setting the default to a more sensible value of 5 still
restricts memory usage but keeps it more safe.
Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
The current implementation doesn't handle
re-entrant calls correctly, causing events
to get lost.
Under specific conditions, re-entrancy happens
from event callback done by net_mgmt.c back into
'net_mgmt_event_notify_with_info' causing circular
buffer administration corruption.
These conditions are:
- llmnr_iface_event_handler
- mdns_iface_event_handler
- wifi_mgmt_raise_connect_result_event
- dhcpv4_immediate_timeout uses a workaround
Validated the fix on a Nucleo_H743ZI, using an
sample app.
Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
In the case of no ARP entry, the incoming packet is added to the ARP's
pending queue, while ARP is being resolved. Here a reference is taken
by the ARP layer to the packet to avoid it being freed, but the Ethernet
immediately puts down the reference and send the ARP packet to the
driver.
If the ARP request fails for some reason, L2 returns failure to net_if
which then puts down the reference and the packet will be freed as the
reference count is now zero.
But the packet is still in the ARP's pending queue and after timeout
ARP will put down the reference causing double free bus fault (double
free message is only seen if the CONFIG_NET_PKT_LOG_LEVEL_DBG is
enabled, so, a bit hard to debug.
Fix this by clearing the ARP entry and pending queue after taking a
reference and then free ARP packet, IP packets are either freed by ARP
pending queue drain or net_if layer.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Commit 2c00dd5fec ("Bluetooth: host: check net bufs have enough room in
user_data") added a build time check of user data size. This check does not
pass with default CONFIG_BT_CONN_TX_USER_DATA_SIZE=8 and with
`native_posix_64` platform, as 16 bytes are needed in order to store
`struct tx_meta`.
Select 16 as default value for 64bit platforms, so Bluetooth samples/tests
are buildable for `native_posix_64`.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Implement the CAP initiator broadcast audio start procedure.
This basically just verifies that the stream context
is set in the metadata, and then calls the BAP
procedure.
We define a new opaque struct, bt_cap_broadcast_source,
that is just an abstraction of the bt_audio_broadcast_source
but is used to indicate that these functions require a
broadcast source created by the CAP function (and not the
BAP) function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fixes a bug where we cleanup the broadcast sink without
properly terminating the BIG sync first.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix AUX_ADV_IND AUX_SYNC_IND radio utilization by having a
configurable offset.
Define an offset between AUX_ADV_IND and AUX_SYNC_IND when
using Advertising Interval for the Extended Advertising and
Periodic Advertising that are same or multiple of each
other, respectively.
Note, to get advertising intervals that are same or
multiple, the Periodic Advertising Interval shall be 10
millisecond more than the Extended Advertising Interval;
this is because the AUX_ADV_IND PDUs are scheduled as
periodic events of Extended Advertising Interval plus 10
milliseconds (Advertising Random Delay) as the periodic
interval.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the Close Isochronous Event (CIE) implementation so that
it follows the Bluetooth Core Specification definition:
Link Layer implementations will normally end a CIS event
early when all scheduled payloads in both directions have
been transmitted and acknowledged.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rename lll_df_conf_cte_tx_disable() to lll_df_cte_tx_disable()
so that it can be used as a common function between connection
and connectionless implementations.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
cp_build_command returns the length of the built packet and early
returns for errors. This means there is no need to keep track of return
code in a separate variable -- if we reached the end, we succeeded.
Along with this change, some more changes to enhance maintainability and
readability are also done.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
With changes to the phy layer and the way we build and dispatch
commands, we can now simplify some parts of CP state machine. This patch
builds on previous patches to reduce some state transitions and fixes
some bugs in those paths.
While at it, also implement an exponential back-off for PD offline after
a timeout. This is useful when there is a transient PD timeout but the
PD itself is not totally dead.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
After the check_packet() split from decode_packet() for handling multiple
packets in the RX buffer, PD state machine needed to me modified to
start handling it correctly. While at it, simplify the states as PD does
not have as much state anyways.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
The method send_command was building the packet and also sending it.
This is a problem because even command build failures are reported as
command send failures; although the former can be mitigated by changing
kconfig parameters depending on use cases.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
To handle multiple packets in RX buffer, we need to perform checks on
the buffer first and determine the length of one packet and extact only
that many bytes from the RX buffer instead of pulling everything at
once and failing if there are bytes from the next packet in the buffer.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
When a PD is set online, we need to do other actions along with it. To
make this easier in future, move cp_set_state(pd, OSDP_CP_STATE_ONLINE)
to it's own method cp_set_online(pd).
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Select in Kconfig causes many issues with dependency loops, this
resolves the issue by replacing most select with depends on for
MCUmgr, including updates to the sample smp_svr application and
tests.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
When handling ASE Control operations requested by client,
first verify that the requested ID is within the allowed range.
If it does, lets assume that the NULL returned from ase_find()
means the ASE state is set to idle.
This will fix ASE Notification Response code expected by
the ASCS/SR/SPE/BI-18-C PTS test case.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Add a new function for the unicast client that verifies whether
or not the unicast client can terminate the CIS given the
state of any paired endpoint and the CIS state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When releasing a stream causing the CIS to disconnect, there was
a race condition between the CIS disconnect event and the
idle state notification from the unicast server.
This ensures that if we are disconnecting a CIS as part of the
release, then we wait for the CIS disconnect event before calling
the "released" callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add state check for BT_ISO_STATE_CONNECTING before disconnecting
the CIS, else we could end up in a race condition where we
did not disconnect the connecting CIS, and then still have
a CIS afterwards.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a check to see if the ISO is connected before we attempt to
disconnect it. In the case where a stream was not in the streaming
state and was released, the CIS is unlikely to be connected.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When notifying a long (string) value in MCS, each
connection's MTU is taken into account when
(potentially) truncating the notification.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The truncation of the MCS string notifications was incorrect.
As per the MCS specification, the MCS shall send ATT_MTU - 3
if the value cannot fit in the notification.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
According to RFC3927, hosts with only IPv4 LL address should still be
able to send packets to destination w/o IPv4 LL address:
A host with an IPv4 Link-Local address may send to a destination
which does not have an IPv4 Link-Local address. If the host is not
multi-homed, the procedure is simple and unambiguous: Using ARP and
forwarding directly to on-link destinations is the default route
This behaviour however was not possible with Zephyr, which only allowed
to use IPv4 LL source address for IPv4 LL destinations.
Fix this, by introducing a final fallback (only if IPv4 autoconf is
enabled), to select IPv4 LL address as a source address if no other
address is available.
Additionally, modify the ARP routine a bit if IPv4 LL address is in use.
There's no really point to forward the packet to gateway if IPv4 LL
address is used, as such addresses are not routable. Instead, try to
find the peer in local network in such case.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
A fix to accept valid shell commands of the form `log backend
shell_rtt_backend disable`, i.e. to affect all modules when no modules are
specified.
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
Add a DSB before doing WFE in cpu_sleep(), to ensure the
memory transactions are complete.
Add a note clarifying a dependency for the existing solution
(dependency is satisfied by ARCH code but is good to state
clearly).
Relates to commit f1264b7e47 ("drivers: entropy: nrf5: add
docs and a DSB in get_entropy_isr").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
We need to make sure the user_data of the network buffer has enough room to
store the L2CAP metadata.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Since we accept buffers from external sources in L2CAP, we need to make
sure that we have enough room in user data to store the metadata necessary
for fragmentation over the HCI link.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Assignment to br_chan should be placed after the call of server->accept().
Otherwise, br_chan will always be a null pointer.
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
Running bsim with Valgrind highlighted a couple of
places where read access to uninitialized memory happens.
Config client rewrites publication parameters with not
initialized uuid pointer. Bitfields those are allocated on
the stack keeps not used area uninitialized too.
Uninitialized area is stored in the persistent memory.
PR fixes that.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Bypass the IP stack and go directly to L2 with
SOCK_RAW/IPPROTO_RAW sockets in net_if_send_data().
Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
Multiple components may use the settings subsystem, so ensure
settings_subsys_init() is thread safe.
Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
If extended advertiser is used, then advertiser sends callback
quite close to the real tx end time. No necessity to consider
advertisement time in lpn rx delay. It allows lpn to spend
less time in active scanning and save more power. Unfortunately,
legacy advertiser shows very slow precision. It is mandatory to
consider adv time for it. Additionally, unnecessary considering of
the advertisement duration has been removed for receive window in lpn.
It makes scanner window longer for a couple of milliseconds.
This is the responsibility of friend node to configure window that
it can manage.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Previously we would call conn_cleanup for all connections,
however this had multiple problems such as:
-Not destroying conn->tx_pending packets and causing an assert
-Calling conn_cleanup for connectable adv, triggering
disconnected callback
Now we will use bt_conn_set_state to manage the teardown of
connections correctly. First, if in connected or disconnecting,
set state to disconnect complete. Then for all states, set
state to disconnected. This will carry out proper cleanup
and teardown when required.
To do this, it was required to keep the tx_thread open as
this is used in disconnecting teardown, so this has been
moved to below the conn_cleanup_all call.
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
Add a callback for READ request to download files with arbitrary length.
Define TFTP_BLOCK_SIZE in API header for application to allocate buffer.
Signed-off-by: Jun Qing Zou <jun.qing.zou@nordicsemi.no>
The client context shall be allocated once paired i.e. encryption is
enabled. This fixes issue that client context was allocated only for
bonded devices and as a result the ATT Unlikely Error was replied to
Control Point operation that paired remote requested.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This renames has_client.ntf_bonded to has_client.ntf_pending as this
field is valid for paired devices an contains the notification state.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The functions allow to return structure holding information of audio
stream endpoint.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Adds an optional shell command for testing the speed of the flash
device and file system, which outputs a rough speed for reading a
file.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds an optional shell command for testing the speed of the flash
device and file system, which outputs a rough speed.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The warning was visible even when `bt_le_adv_stop()` was successful, which
is confusing to end-users.
Signed-off-by: Paul Adelsbach <paul@boxsection.org>
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
In the case that the CIS has been setup as bidirectional, and
only one of the directions have an ASE configured yet,
we should only care about valid ISO packets when doing this
check. The reason is that some controllers send HCI ISO data
packets to the host, even if no SDU was sent on the remote
side. This basically means that empty PDUs are sent to the
host as HCI ISO data packets, which we should just ignore.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the unicast audio streams, there can be a mismatch
between the CIS state and the endpoint state. This
was previously logged, but since this would be logged
continously, we guard it with CONFIG_BT_AUDIO_DEBUG_STREAM_DATA.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Only the receiver of the audio is allowed to send the
receiver start ready command.
Furthermore, this removes the automated transition to the
streaming state on the server, as the server now shall
call bt_audio_stream_start to put the stream into the
streaming state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Commit add hidden Kconfig option CONFIG_FS_FATFS_FF_USE_LFN
that is passed to ELM FAT to define FF_USE_LFN configuration.
The FF_USE_LFN still depends, indirectly, on choice
CONFIG_FS_FATFS_LFN_MODE config options
CONFIG_FS_FATFS_LFN_MODE_BSS, FS_FATFS_LFN_MODE_STACK and
FS_FATFS_LFN_MODE_HEAP, but the logic has been moved out of
zephyr_fatfs_config.h into Kconfig file.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
New event LWM2M_RD_CLIENT_EVENT_REG_UPDATE to indicate
application that engine starts registration update.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
The backend_name_get() function always sets 'entry->syntax' to
the name of the last backend, but a calling function iterates
over the idx until 'entry->syntax' is null.
Solution: Added a check that the index is less than the number
of backends and added getting the name of the backend
by the given index.
Signed-off-by: Mikhail Siomin <victorovich.01@mail.ru>
IEEE802154 drivers expect, that a complete 802.15.4 frame fits into a
single net_buf provided in a net_pkt.
There is a corner case with header compression when this could not be
the case. If the IPv6 packet before IPHC exceeded 802.15.4 MTU, it'd
consist of several net_buf's. This was not an issue, if the IPv6 packet
after header compression still required fragmentation, as the
fragmentation module took care of formatting individual net_buf's
properly.
For short range of packet sizes however this was no the case. The IPv6
packet, after header compression, might not require fragmentation any
more. As the IPHC logic only modified the IPv6 header part, by trimming
the buffer in front of the net_buf, such a packet would still consist of
two net_bufs, even though it should fit into a single 15.4 frame. Such
packet was passed to the driver, causing the driver to send only part of
the packet, from the first net_buf.
Fix this, by using net_pkt functions to manipulate the packet, instead
of operating on net_buf directly. net_pkt_pull() will not trim the
buffer in front, but rather move the entire packet content to the front.
On the other hand, net_pkt_compact() will assure that there's no gaps in
the net_bufs. In result, packets that do not require fragmentation,
should be placed into a single net_buf, as expected by drivers.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
`rp->le_max_num` was passed unchecked into `k_sem_init()`, this could
lead to the value being uninitialized and an unknown behavior.
To fix that issue, the `rp->le_max_num` value is checked the same way as
`bt_dev.le.acl_mtu` was already checked. The same things has been done
for `rp->acl_max_num` and `rp->iso_max_num` in
`read_buffer_size_v2_complete()` function.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The SC indication can be sent only if the GATT Service Changed is
enabled in the configuration. Change fixes build issues related to
implicit sc_indicate declaration when Service Changed is disabled.
Fixes: #54813
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Change removes GATT Client dependency for storing CCC and CF on pairing
complete and identity resolved. These features are needed also if GATT
Client role is disabled.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
On bond establishment: save the CF and CCC data that have been written
before the peer was bonded.
On identity resolved: update the CF data to use the peer's identity address
instead of its private address (same as is currently done for the CCC).
Fixes#54770.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fixes a bug introduced in the previous refactoring: we would always mark
all peers as change-unaware. Now we only do so when the hash has been
recalculated.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Previously, if the app registered a bunch of services at boot before
calling `settings_load()`, then the hash would be silently overwritten.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The spec says we have to persist the change-aware status of bonded peers
between resets.
This stores it at the end of the CF storage that we currently have.
Fixes#54173
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Store the Client supported features value when it is written to, instead of
only on disconnection/identity resolved.
Works around the situation where a user bonds, CF is written and the device
is abruptly powered off, discarding the CF value, but keeping the bond.
Fixes#54172.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
to send response with code 0x09 = Invalid Configuration Parameter
Value and reason 0x0a = Invalid_ASE_CIS_Mapping.
Previous response code was BT_ASCS_RSP_UNSPECIFIED (0x0e) and
reason BT_ASCS_REASON_NONE (0x00).
Fixes ASCS/SR/SPE/BI-15-C and ASCS/SR/SPE/BI-16-C PTS test cases.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Allows receive packets that are bigger than
CONFIG_RNDIS_BULK_EP_MPS.
Considering:
* MaxPacketsPerTransfer is 1
* MaxTransferSize is 1558
* PacketAlignmentFactor is 0 (20=1)
The rndis_bulk_out shall be able to receive transfer
up to 1558 bytes (inclusive).
Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
Fixing typo in llcp_lp_cc_established revealed the need for completing
the CIS establishment procedure by additional call to local/remote
check_done function.
Fixed by exposing lr_check_done and rr_check_done with naming update and
calling after injecting the CIS_ESTABLISHED event.
Signed-off-by: Morten Priess <mtpr@oticon.com>
If CIS offset in LL_CIS_IND is less than EVENT_OVERHEAD_START_US, the
controller is not able to establish the CIS in the ACL connection event
specified, but needs to start setup one connection event earlier.
With this commit, if offset is larger than EVENT_OVERHEAD_START_US the
first CIS event can be prepared in due time immediately.
This enables the controller to setup first CIS, even when instant is
equal to the ACL event_counter.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Fix Periodic Advertising time reservation when enabling with
ADI support. As the PDU is updated, use the updated PDU to
calculate the time reservation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add implementation to schedule BIG events after Periodic
Advertising when Periodic Advertising is enabled after
Extended Advertising has already been enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
As the range of ticker_id has been checked, context specific
get interface be used instead of doing range check again in
ull_hdr_get_cb().
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix auxiliary PDU time reservation calculation to reserve
for possible increase in PDU len due to updates to data in
the Common Extended Header Format of the PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix assertion due to delayed prepare of first BIG event when
supporting encryption. Crypto calculation introduce extra
processing delay causing the scheduling of first BIG event
to be delayed. Detect such delay and skip to next ISO
interval.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the access address and radio ready timestamp to derive
the value of the first subevent, so that correct anchor
point reference is used in scheduling subsequent subevents.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix uninitialized CIS LLL structure member variables,
uninitialised CIS acl_handle causes HCI command disallowed
for acl_handle's other than 0x0000.
Initialize other variables like sn, nesn etc. when create
CIS control procedure is performed.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This fixes an issue whereby when USB CDC is used for receiving MCUmgr
commands, the commands are corrupted, invalid or messed up by
increasing the receive buffer size so that it can handle at least 1
full MCUmgr fragment.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Refactoring the periodic advertisment report receive function
to make the handling of data reassembly more readable.
Signed-off-by: Pierce Lowe <pierce.lowe@nordicsemi.no>
This changes the periodic scanner to drop periodic adv
reports with incomplete data. This avoids incorrect data
being sent to application in the case where the periodic
adv data is not successfully received by the scanner.
Fixes zephyrproject-rtos#54072
Signed-off-by: Pierce Lowe <pierce.lowe@nordicsemi.no>
It should be possible to configure/initialize the DHCPv4 for an
interface when the interface is down, the DHCPv4 however should not
proceed with the procedure in such case.
Add a simple check to prevent DHCPv4 from sending packets when interface
is down. As the module registers to the NET_IF_UP event, the procedure
will be restarted when the interface goes up.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Currently, if timeout is not configured for the network initialization in
the config module, the initialization function will configure IPv4/IPv6/
DHCPv4 regardless of the interface status. This is not the case when the
timeout is set, and the interface was not brought up during the timeout
period. This lead to ambiguity in terms of interface initialization.
This commits unifies the behaviour between these two cases. The
aforementioned initializations will always take place, regardless of the
interface status. The IPv4/IPv6 and DHCPv4 routines should be prepared
to deal with interfaces that are not brought up. The only difference
now, between timeout and no timeout scenario, is that the former will
report an error in case the timeout occurs wile waiting for the expected
events.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Socket faults or timeouts in CoAP deregistration messages
caused RD client state machine to restart registration.
Fixes#54136
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
During the requesting state, ignore NAKs from any
non-requesting server. This gives the requesting
server a chance to ACK the request.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
9.4.2 section, Part C, Vol 3 of the Bluetooth Core specification v5.3
states the following in the case that the device is in non-bondable
mode:
If Security Manager pairing is supported, the Host shall set the
Bonding_Flags to ‘No Bonding’ as defined in [Vol 3] Part H, Section
3.5.1 and bonding information shall not be exchanged or stored.
Fixes#54104
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
If we are using `CONFIG_ARCH_POSIX`, then include
`<fcntl.h>`. Otherwise, include `<zephyr/posix/fcntl.h>`
since there are no requirements to use `CONFIG_POSIX_API`
internally.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
* include `<zephyr/posix/fcntl.h>` instead of `<fcntl.h>`
* drop unused logging header and module declaration
* reorder headers alphabetically
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Redefine mask of host-controlled feature bits to include only features
that are supported by the controller. This fixes a conformance test
failure where setting an unsupported host-controlled feature bit was
not rejected as it should.
Set the Connected Isochronous Streams (Host Support) bit from the host
only if unicast support is configured to avoid failures in
broadcast-only configurations.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Update help message of some commands of the Bluetooth Shell that were
inconsistent.
Also add the `dir-rpa` parameter to the advertiser parameters to fully
support directed advertisment parameters.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Fix advanced scheduling to consider active BIG events when
establishing new Central connections. This will schedule
AUX_ADV_IND, AUX_SYNC_IND and Central connections of similar
interval to be non-overlapping.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update advanced scheduling implementation to consider other
active BIG events when scheduling new BIG instances.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
During discovery the unicast client subscribes to the
ASCS CP characteristic. However, this was done asynchronously
at the end of the discovery, and the discovery complete
callback was called before the subscription was done.
Since the unicast client relies on the auto CCC discovery,
the actual subscription takes place a few connection intervals
after the unicast_client_ep_set_cp function was called. The
result of this is that the actual subscription was missing
when the unicast client application starts performing
BAP operations.
The change done here postpones the discovery callback
until after the CP subscription has taken place, ensuring
that the unicast client correctly receives the CP notifications
when performing BAP operations. This also allows the unicast
client to use the discovery parameter in the
bt_audio_discover_params struct, rather than yet another
discovery parameter struct, saving some memory.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When IPv4 autoconf is enabled and IPv4 LL address is configured on an
interface, the subnet mask should be updated accordingly, otherwise it
can lead to unexpected behaviour (like for example not identifying peer
LL address as a part of the same subnet).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
For socket families that are niether INET/INET6 e.g., PACKET, we cannot
estimate header length, so, if the payload is zero as well, networking
stack drop the packet.
Instead, allow for zero header + payload packets and let L2 take care of
handling them, for some L2's this is still a valid frame.
E..g, In case of Wi-Fi this is sent as 802.11 Header + LLC Header
(no payload).
Add unittests for both AF_INET + Zero payload and AF_PACKET + Zero
payload.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
There was a bug where BT_AUDIO_DIR_SINK should have been
BT_AUDIO_DIR_SOURCE when setting supported contexts.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The websocket implementation did not comply with the RFC 6455 when it
comes to connection close. The websocket should send in such case Close
control frame. This commit fixes this behaviour.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The websocket "socket" layer did not handle ZFD_IOCTL_SET_LOCK command,
and just forwarded it to the underlying socket. This overwritten the
mutex pointer used by the underlying socket, resulting in erroneous
behaviour in certain cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fix sn and nesn values of ISO data when starting a new burst.
When central retransmitted but did not get an ack, it did
not update the sn correctly causing the peripheral to drop
the next ISO data PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The address type in the periodic adveritising sync
established event is incorrectly set to 0x01
(BT_ADDR_LE_RANDOM) when the address is a resolved one,
where it should have been BT_ADDR_LE_RANDOM_ID.
The address type has been fixed by offsetting by 2 to get
BT_ADDR_LE_PUBLIC_ID or BT_ADDR_LE_RANDOM_ID when the
address has been resolved.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This mirrors the behaviour of MLD packets, the only other ICMPv6 subtype
that is tracked separately.
Inbound ND packets are already counted as received ICMP packets by way of
going through the ICMP receive path.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
This caused outgoing MAC address lookups to count as one received and two
sent Neighbour Discovery packets, when it's really one sent Neighbour
Solicitation and one received Neighbour Advertisement.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
The net_pkt pointer provided to net pkt commands was not validated in
any way. Therefore it was fairly easy to crash an application by
providing invalid address.
This commit adds the pointer validation. It's checked whether the
pointer provided belongs to any net_pkt pools known to the net stack,
and if the pointer offset within the slab actually points to the
beginning of the net_pkt structure.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When using extended advertising commands, the advertising set is not
considered to be over until we receive `BT_HCI_EVT_LE_ADV_SET_TERMINATED`
from the controller. Only then do we clear the `BT_ADV_ENABLED` flag.
The problem is that `bt_le_adv_resume` is called on connection established,
which can happen before adv set terminated, and in that case it will
early-return because `BT_ADV_ENABLED` is still set.
This change triggers `bt_le_adv_resume` when we get
`BT_HCI_EVT_LE_ADV_SET_TERMINATED`.
Fixes#53048
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Adds event tracing to sysview. This will allow the event related
tracing symbols to be found when CONFIG_SEGGER_SYSTEMVIEW is
enabled.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Fixes various unresolved symbols when kernel event object tracking
is enabled via CONFIG_TRACING=y.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Native POSIX target still needs to use the <fcntl.h> header
instead of <zephyr/posix/fcntl.h>
Also removed the include from various files that did not use it.
Also changed fcntl() calls to zsock_fcntl() because we directly
use zsock_* calls elsewhere.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Fix missing DF related Radio register reset on radio_reset().
Regression in commit 465a96181d ("Bluetooth: Controller:
Explicitly set all bits of used radio registers") due to the
removal of NRF_RADIO->POWER register use that was used to
reset all Radio registers on every new Radio Event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
`ad_len` was never initiatialized before we started
incremetenting and using it.
We would also override any user data in ad_init, which
is fixed by using the length of the user data as an
offset into the array.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fixes issue where a build warning would be emmited for sockets_tls.c due
to usage of the deprecated fcntl.h header file.
Signed-off-by: Jared Baumann <jared.baumann8@t-mobile.com>
Fixes dead code warning. At this point we have already checked for
broadcast and it is set to false.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Workaround sequence number misalignment to ISO event count
when ISO data is supplied in bursts, example through USB.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove BT_HCI_DATAPATH_ID_DISABLED define as 0xFF, which is
reserved for future value for Data_Path_Id parameter.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
- Include ISO stream count in ISO streams definitions in
controller.
- Create ISOAL source on controller when ISO data path is
setup.
- Send broadcast data buffers transferred from host over
HCI to ISOAL as ISO SDU fragments.
- Allow bot conn and ISO data to use data_buf_overflow.
- Store ISO interval during BIG create.
- Remove ISO data path for each BIS during BIG terminate
procedure.
- Set value (temporarily) for ISOAL target_event enabling
it to Tx data.
- Check status of data fragment sent to ISOAL for memory
allocation and other errors.
- Destroy ISOAL source when ISO stream released.
- Use ISO Advertising handle, not stream handle to destroy
ISO data path.
- Remove extra ISOAL sink destroy call when removing ISO
data path.
- Add FIXME comment as reminder to address LL_ASSERT on
isoal_status error.
Signed-off-by: Carl Stehle <droid@appception.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix calculation of ISO interval such that multiple bursts
can be transmitted per ISO interval. This means we can now
have SDU_Interval < ISO_Interval and more than one SDU will
be transmitted in each ISO_Interval.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing jump to Rx ISR done that caused the Control PDU
to be enqueued as ISO data PDU, causing the ISOAL to assert
on receiving invalid LLID.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO timestamp wrap around which caused ISOAL to assert
checking for valid timestamp.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Define a internal BT_CTLR_ISO_TX_BUFFERS to allocate ISO Tx
buffers used for Broadcast and Connected ISO.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix race between isoal_source_deallocate() and
isoal_tx_pdu_emit(). Initiating a local initiated terminate
triggers NULL pointer dereference.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Refactor ll_setup_iso_path to support Synchronous Receiver
and Connected ISO to be built together.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix uninitialized CIG ULL reference count when creating a
CIG after a previous disconnection.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS and CIG teardown in Central and Peripheral Role.
cig->lll.num_cis value is used in peripheral role to count
active CISes, and cig->cis_count is used in central role.
Both central and peripheral will stop ticker for CIG when
num_cis and/or cis_count is zero, respectively, but only
peripheral role will release a CIG context. The Central
will keep the CIG context allocated and only mark it as
not started. Remove CIG command will be used for central
role to release a CIG context.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS ISO Tx buffer leak on terminate when the datapath
has been deallocated.
Add a FIXME comment regarding ll_tx_ack_put() being called
from LLL execution context, while it is a ULL callable used
by ACL connections to dispatch ack.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Do not call util_aa_le32() from ISR context as random number
generation in entropy driver on nRF5x series invokes
k_sem_take.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix assertion check on link_tx_free when CIS is created a
second time. The Tx mem queue has to be initialized on every
new CIS create as CIS disconnect does the deinitialization.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Reorder the functions in ull_central_iso file to match the
order of HCI commands in the BT Spec.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Workaround the access that check if datapath is NULL when
the stream has already been released. Memory Pool overwrites
first 8 bytes to maintain the free list and free count. This
causes the datapath fields if placed in the first 8 bytes to
not be NULL after the memory is freed.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add code to generate ISO data buffer overflow event if more
than allocated ISO data PDU buffers are tried to be
requested by host or for SDU fragmentation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use instant_latency at the CIG start event count to detect
skipped connection event around the instant. In the future
add implementation to compensate for skipped ACL connection
event and adjust the CIS event count at CIG start.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Reuse ull_conn_event_counter() function in LLCP
implementation to get the current radio event counter value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIG offset such that it follows after the ACL connection
time reservation to avoid overlapping.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add LLL interfaces implemented by ULL to get group by stream
and to get stream by group iterator functions.
Rename function to set CIS established to reflect that it is
LLL accessible.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix channel indices calculation implementations conditional
compile so that it can be reused for Connection ISO events
and subevents.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add interface to have separate Tx and Rx packet timer status
reset, so that packet timer can be setup ahead in time for
starting the Tx or Rx subevent and status reset only clears
the respective PPI/DPPI that was used when Tx or Rx
completes.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use BT Spec. defined abbreviations for number of subevents
(nse), burst number (bn), flush timeout (ft) etc.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update Kconfig to list Central and Peripheral ISO as
supported. Will continue to be listed as Experimental.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add conditional compilation for Peripheral ISO support,
use CONFIG_BT_CTLR_PERIPHERAL_ISO.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Re-arrange include in ull_peripheral_iso file to be
consistent with other similar files (ull_central_iso).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rename LAST_VALID_CIS_HANDLE to LL_CIS_HANDLE_LAST, to be
consistent naming with LL_CIS_HANDLE_BASE.
Add IDX_FROM_HANDLE defines.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Refactor the Connected ISO group and Connected ISO stream
context to be consistent in defining the bitfields and also
rearrange structure members.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing BT_LL_SW_LLCP_LEGACY cond compile causing
compile error when building Peripheral ISO samples with
legacy control procedure implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This patch replaces many instances where raw loops were used to copy bytes
with memcpy calls.
No functional change intended.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Do not check or send the first entry in the pd->cp[] device capability
table which is for function code 0 which is not a defined function code.
Signed-off-by: David Vucich <dave@alcatraz.ai>
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
By default, on errors, pd_decode_command replies with osdp_NAK with
sub-error code set to OSDP_PD_NAK_CMD_LEN (achieved using the ret ==
OSDP_PD_ERR_GENERIC check before return). This is works for all packet
framing errors; but when a more specific error code needs to be sent, ret
has to be set to something other than OSDP_PD_ERR_GENERIC (a suitable error
code happens to be OSDP_PD_ERR_REPLY) to prevent the tail check from
overwriting the error info.
In CMD_KEYSET, we fill a more specific error code but do not set the ret to
OSDP_PD_ERR_REPLY. It causes this error to be reported as a framing
error hence loosing some extended info about the error. Fix this issue by
reordering the checks a bit.
Fixes: 7f4d2c741b "mgmt/osdp: Add support for Secure Channel"
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Initially, subsys/mgmt had its own STR() macro for string pasting which was
replaced with the zephry provided STRINGIFY(). The definition of this macro
seems to have lingered on so remove it.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
During handshake, only certain types of secure block types (<= SCS_14)
are allowed. A rouge CP/PD can try to bypass the handshake by directly
sending a secure block type ahead of the sequence and gain a secure
channel. Fix this by adding a check in packet decode time.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
OSDP specification section 5.7 states that a transmitting device has to
drive the transmission line to a marking state for a period of one char
in the current baud rate. This can be achieved by sending 0xFF. Since
this is not mentioned in the packet structure definition, many commercial
implementations of OSDP out in the wild do not send/expect this byte.
To work with such non-conforming devices, we will try to be as flexible
as possible in the PD: send mark byte only if the other side sent one. In
case of CP, we have no option but to send the mark byte to be as close
to the specification as possible. If a particular use case needs the CP
to not send it, we will provide a Kconfig option to disable it.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Now that we have the necessary infrastructure to collect events from PD
apps, we can use them to translate it to OSDP packet sequence for card
reads and key press events.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
OSDP compliant devices communicate their capabilities and discover what
their peer can and cannot do. Right now, PD advertises these capabilities
and expects CP to honor them. Although this is not known to cause any
issues, it is not desirable to allow such accesses.
Add a check of incoming commands to to validate that the corresponding
capability was enabled and advertised.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Since cmd_data member is used by both commands and events to store the
contents of current transaction, rename it to ephemeral_data which
better reflects the purpose of the variable.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
The TLS_HOSTNAME socket option expects a NULL terminated string and
doesn't really care about the optlen provided. However, as the option
expects that the string is NULL terminated, the optlen value should take
NULL character into account, for consistency across the codebase.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When a maximum duration or number of advertisements has been set for an
advertisement set, we will exceed that limit if the last advertisements
happen to be overlapping (ie. we have two primary advertisements pointing
to the same AUX_ADV_IND).
We now have a check in the ticker_cb that will ignore the callback if the
state is such that advertisement would have been stopped if ull_adv_done()
had been allowed to run in the meantime.
Signed-off-by: Troels Nilsson <trnn@demant.com>
When executing the bt_audio_broadcast_source_reconfig the streams
did not get assigned the new QoS, the ISO parameters were not
properly updated and the codec was not set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
I get a high failure rate for tests/kernel/mem_protect/stack_random
because the default rand32_timer used with QEMU is just too mediocre.
Make it more random looking.
Reference: https://nuclear.llnl.gov/CNP/rng/rngman/node4.html
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
If the ACL disconnects, then the unicast server cannot send
a notification to the client about the endpoint and
stream being released. We now call the released callback
if the stream's endpoint was not idle before the disconnection.
Similarly the unicast server (ASCS) did also not call the
released callback if the ACL disconnection causes a endpoint
release.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add an argument to i2c_dump_msgs() to log the data from reads too. And
then rename the function to i2c_dump_msgs_rw() so the API doesn't
change. If the dump is done after a transaction is processed, as
opposed to before, then the read data is valid and can be very useful.
Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
The emulator structure currently initializes a bus-level API that is
used to communicated register accesses to the emulator from the parent
bus.
Add support for declaring a backend API for emulators. This provides
tests a common way to interact with emulators of the same device type.
Signed-off-by: Keith Short <keithshort@google.com>
Add Bluetooth HCI USB transport layer implementation for the new
experimental USB device support based on the existing implementation
subsys/usb/device/class/bluetooth.c.
This implementation, unlike existing one, contains the interface
descriptors for isochronous endpoints. Since we do not support voice
channels, these are just there to avoid issues with Linux kernel btusb
driver when this implementation is part of a composite configuration.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
allow disabling reports (synchronise but don't generate sync reports)
and allows enabling sync reporting with filtering of duplicates.
the default option remains to establish sync, with sync reports,
but without duplicate filtering.
Signed-off-by: Raphael Treccani-Chinelli <raphael.treccani@nordicsemi.no>
Devices with write block size greater than 16 could not use settings_fcb
due to small buffer size.
Update value in test as well.
Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
Bluetooth does not need to be enabled to register services,
therefore the newly introduced automatic bluetooth SMP transport
registration system can be simplified by returning enabling of
bluetooth back to the application.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
There is a pending TODO regarding unifying net_tcp_unref() and
net_tcp_put(). Given that net_tcp_unref() is no longer used by the upper
layer (it should only use get/put APIs), the function can be removed
from external TCP API, as referencing/dereferencing is now only used
internally by the TCP stack.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The net_context/TCP connection context ref counting needed to be fixed,
to avoid situation where TCP connection context could be released
before net_context is released.
Generally, this commit modifies the ref counting of the above as
follows:
* net_context is referenced both by the application and TCP stack, when
created.
* TCP context is referenced by the application when created. The TCP
stack adds ref to the TCP context only after connection has been
established.
* TCP stack needs to call the final upper layer callback when connection
is closed, but before the TCP context is released (i. e. to give upper
layer chance to dereference the context on its side). For this,
tcp_conn_close() was introduced which is called from within TCP stack
instead of directly dereferencing the TCP context.
* TCP stack dereferences the net_context only after the TCP context has
been released (i. e. upper layer has dereferenced TCP context on it's
side and connection has been tear down, if established).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Implementation of Broadcast ISO encryption using crypto
toolbox function h8. And support for encryption in lower
link layer for nRF5x series.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Make Data, ISO, BIS and CIS PDU structure's octet 3 vendor
specific.
This will allow vendors not supporting the octet 3 or
CTEInfo (8 bits) to save 1 octet in their PDU structures.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add implementation to parse ACAD and find the BIGInfo before
setting up Broadcast ISO Synchronization.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Convert endianness of supplied parameters before calculating
the AES-CMAC. Bluetooth stores values in little-endian and
crypto traditionally operates on big-endian storage.
Relates to commit e9c542ab5b ("Bluetooth: Add the
cryptographic toolbox function h8").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Wait until encrypt change to trigger the re-subscription quirk.
Otherwise it could fail with insufficient security.
Also gate it behind a kconfig to make apparent its dependencies:
If `add_subscriptions()` is executed in the first place, that means that
the device was bonded and thus that it has to encrypt the link eventually.
`BT_GATT_AUTO_SEC_REQ` should take care of that.
Also add a new flag to `bt_gatt_subscribe_params` to not send the same CCC
write multiple times in some cases.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The nRF HW models have been updated to correspond to a 52833 instead
of a 52832. Let's follow them.
The motivation for the change is to enable proper BIS encryption support
(for BT LE Audio ISO).
Changes:
* Point in manifest to latest HW models
* SOC_COMPATIBLE_NRF52832 has been removed, and SOC_COMPATIBLE_NRF52833
added in its place (with no uses at this point)
* Where SOC_COMPATIBLE_NRF52832 was used to set encryption like for a 52832
(to avoid using the MAXPACKETLENGHT), we set the condition to just
SOC_NRF52832.
Note: The MAXPACKETLENGHT register exists in the new simulated nrf52833,
thought it does nothing.
* In the BLE ctrl LLL radio HAL, all macros are renamed accordingly
(timings are NOT changed).
* Board dts definition now refers to the 52833 soc definition. New 52833
features set as not supported by now.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Legacy Control Procedure fix. Fix missing release of the
node rx allocation that was reserved at the start of the
LE Connection Parameter Request procedure and the procedure
ends with reject indication transmitted to the initiating
peer.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The following fixes were applied:
- Multicast Rx packets stats were not recorded due not parsing the
ethernet header. The function that tried to parse the ethernet header
was parsing the ethernet packet beyond the ethernet header.
- Added a new stats for unknown protocol which gets updated when the
ethernet layer encounters an unknown ethernet packet type.
Fixes#53994
Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
Rework the implementation of `pm_device_children_action_run` to use the
common `device_supported_foreach` iterator.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
To write tests it is necessary to offer init function for the RDClient
to define custom fakes before.
Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
This reverts commit 5824ac90ecd8dd06d9ea117d345dbc6b069e5840.
The resulting revert takes into account changes to the predicate that
guards the use of `resp_addr`.
In the resulting revert, the predicate guarding the use of `resp_addr`
is differs from the naive revert because the intention of that predicate
is to know when `conn.c:bt_conn_le_create` decided to use the Host
resolver. And, the logic in `conn.c:bt_conn_le_create` has changed. The
changes to the logic in `conn.c` are in the following commits:
89780d715d5a09325ba9
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Fix filter accept list and privacy feature Kconfig default
based on whether host has them enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Change the http timeout mechanism to use poll instead of shutdown.
This should fix a problem where the shutdown will be called in a
different thread context which can lead to deadlocks on certain
driver implementations like offloaded modem drivers.
Fixes#53967
Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
When removing a CIG, the instance and associated CIS instances were not
always released. This causes repeated Create_CIG/Remove_CIG operations
to fail assertion with resource error.
Enables CONFIG_BT_CTLR_CENTRAL_ISO in bsim_test_audio.
Fixes issue #53301.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Similar to the ad_init that automatically adds advertising data
from other modules, pa_ad_init has been added to do the same
for periodic advertising.
The only use case so far is the BAP broadcast source
data, if enabled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The call to audio_ad_data_add will now either call
connectable_ad_data_add for connectable advertising, or
unconnectable_ad_data_add for unconnectbale advertising.
Most service UUIDs etc. does not make sense to advertise if
not connectable.
This also adds the BAP broadcast advertising data to
unconnectable.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the advertising is connectable, and we have privacy,
then according to the HAP spec, we should not advertise
the HAS uuid.
This was done by simply truncating the advertising data, but
it was only truncated by 1, instead of by the size of the
UUID.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
New LLCP will process the CIS establishement in the TX path, meaning it
will only process once every ACL connection interval.
If ACL connection interval is significantly longer than the ISO
interval, CIS packets corresponding to the ACL connection interval will
be lost. This may cause latency in audio rendition.
By processing the CIS establishment in the RX path, notification will be
sent immediately, and audio path is enabled fast to reduce latency.
When a CIS fails to establish, the controller shall complete the
procedure by sending a CIS_ESTABLISHED event containing the error.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Disconnect CIS immediately if event done extra status indicates MIC
failure. Return reason BT_HCI_ERR_TERM_DUE_TO_MIC_FAIL.
Fixes EBQ test /LL/CIS/PER/BV-27-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
When the 'instant' of a CIS is postponed by increasing the conn_event of
the CIS_RSP compared to CIS_REQ, the CIS offset shall be calculated as
an equivalent window offset by an integer number of ISO intervals.
This is obtained by increasing the CIS_Offset_Min and CIS_Offset_Max by
the modulus of the connection interval delay time.
Signed-off-by: Morten Priess <mtpr@oticon.com>
To be able to timely start the first CIS/CIG, if the requested instant
is the next connection event, call ull_peripheral_iso_start directly
from rp_cc_state_wait_rx_cis_ind instead of waiting for next time
through the state machine.
To enable ULL/LLL to prevent adding latency when LLCP is waiting for
instant, local- and remote procedures with instant now expose a function
for checking this state.
Fixed event_counter function to prevent one-off in RX path. Unified to
use single function ull_conn_event_counter.
Fixed LLCP unit tests and added new mock function.
Signed-off-by: Morten Priess <mtpr@oticon.com>
USB stack did leak memory on every SET ADDRESS request. UDC control
allocator could cope with up to 13 leaked allocations. Therefore,
issuing bus reset 13 times in a row (in addition to automatic reset
after connecting the USB cable) was enough to exhaust memory and
thus drive USB stack inoperable.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
The sink ASE does not have a disabling state, but since the
stream callbacks does not necessarily match the ASE states,
we need to do our own check to see if a sink ASE has been
disabled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Before this commit we simply always notified/indicated
all presets and active index to any bonded device, even
if they never subscribed to anything, or even if we never
registered HAS.
This commit modifies that, so that only the proper
connected clients will get the notifications/indications,
and that we only send them if something has changed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The security_changed callback may be called before
bt_has_register has been called, thus making the active_preset_work
handler uninitailized, causing an ASSERT when the work is submitted
in the security changed callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Calling bt_has_register multiple times would cause attempts
to register a HAS multiple times. Fixed by adding a check
and return with EALREADY if it is already registered.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The POSIX spec requires that `SO_LINGER`, `SO_RCVLOWAT`,
and `SO_SNDLOWAT`, and `SOMAXCONN` are defined in
`<sys/socket.h>`. However, most of the existing socket
options and related constants are defined in
`<zephyr/net/socket.h>`.
For now, we'll co-locate them. It would be
good to properly namespace things.
Additionally, a no-op for setsockopt for `SO_LINGER` to
make things Just Work (TM) for now.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Add check preventing Out of band access. There are tests trying to
access out of band handle like:
test_sink_invalid_ref and test_source_invalid_ref trying to access
handle 99.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
The updatehub shell cmd_info allocate memory but not checks function
return. This add missing checks and proper error handle.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
The current updatehub version forces user application to run in kernel
mode. This add necessary api syscalls to isolate userspace from kernel.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Add support for configuring power save timeout in Wi-Fi chipsets.
Changes to configure power save inactivity timer.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
z_cpus_active count becomes incorrect when the state is
PM_STATE_RUNTIME_IDLE and CONFIG_PM_DEVICE is enabled.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This service allows to synchronize the clock with the application
server.
Synchronization requests are initiated by the device in a regular
interval, configurable via Kconfig.
The implementation only supports TS003-2.0.0, as the previous revision
TS003-1.0.0 requested to temporarily disable ADR and and set nb_trans
to 1. This causes issues on the server side and is not recommended
anymore.
Signed-off-by: Martin Jäger <martin@libre.solar>
This is a prepartion for adding actual services needed for firmware
upgrade over the air (FUOTA).
The services run in a dedicated work queue.
This commit introduces code that initializes the work queue and
provides functions to schedule uplink messages after a given timeout.
Signed-off-by: Martin Jäger <martin@libre.solar>
This commit changes VOCS set location behavior.
When an RFU location is written, VOCS ignores it.
Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
Use the maximum data PDU size time reservation space
considering the Data length could be updated from default
27 bytes to maximum support size.
If maximum time reservation is disabled then time space
reservation corresponding to the default data length at the
time of the start/enable of Central role is used.
Note, currently this value is only used to space multiple central
connections and not for actual ticker time reservations.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix connection parameter request procedure to be cacheable
if a remote control procedure is in progress.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix legacy control procedure implementation to avoid
connection update procedure with reason instant passed
(0x28).
Connection Update Indication PDU is enqueued after data
enqueue to LLL context is paused and the enqueue resumes
when already enqueued data PDUs are all acknowledged.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove the init command for teh CSIP Set Coordinator.
The main reason for this is that we want to ensure that we
register the conn callbacks early so that `conns` array is
properly filled.
The other callbacks registered in the init function
can easily be moved to where they are needed, and even
unregistered to avoid parsing more data than we need.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
During the NVS initialization, if gc had to be done, the NVS cache
rebuild wasn't called.
Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
While porting the coverage.c file from RIOT to Zephyr, which employs
different compiler flags, I noticed several -Wcast-align GCC warnings on
arm. I think, as is, the current implementation may perform unaligned
memory accesses which may not be supported on certain platforms. To
workaround that, I have rewritten the code for RIOT using
bytewise-writes with `memcpy`.
Signed-off-by: Sören Tempel <tempel@uni-bremen.de>
Full resource names aren't as long as combined basename- and name-buffer
sizes but the compiler doesn't know it. Increasing the buffer size to
avoid the compiler warning.
Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
Since the event length update is not necessarily an improvement
in all situations a Kconfig option is added so that it can
be disabled for the users that do not need it.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Fix the controller implementation to perform connection
event length reservation based on the completed Data Length
Update and/or PHY Update Procedure.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
When init_igmp is called the ipv4 pointer was not initialised.
Therefore, a different API needs to be used to ensure that IPv4
is enabled when calling init_igmp.
Fixes#53913
Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
Deprecate the old API and replace with new one which uses
the lwm2m_obj_path struct instead of a string.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Deprecate send API using the string references as paths.
Replace it with one using path structs.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Deprecate old API and make new API using path structs
instead of using old string reference based paths.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Deprecate old API and offer a new API for object and resource
creation and deletion. The new API uses path struct instead
of using a string as a reference to a path.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Proper handling re. non-supported CIS TERMINATE
This fixes EBQ test LL/PAC/CEN/BV-01-C on the general level.
'Replaces' #ee2a43b5dcf884730130345c402d87b2bce9dba1
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Add option to disable CRC for fcb entries. This improves the write
throughput significantly at the cost of not detecting corrupted data
in flash. This is beneficial for aplications that needs the extra
write throughput, where error detection is done elsewhere.
Allow the FCB entries in flash to have a valid CRC when CRC is
disabled in the FCB. This allows existing solutions to disable
CRC checking, while keeping the CRC areas intact. Note that this
is a one-way option.
Fixes#53707
Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Cancelling transfers on suspend contradicts Universal Serial Bus
Specification Revision 2.0, 9.1.1.6 Suspended:
* When suspended, the USB device maintains any internal status,
including its address and configuration.
The internal status definitely includes any pending USB transfers.
If there is a class that wants to cancel transfer on suspend, then the
cancel should be initiated by the class, not the device stack itself.
Update hal_nordic to a version that does not abort all endpoints at
suspend. It seems that aborting endpoints on suspend in nrfx driver was
the actual reason why transfers were canceled on suspend.
Remove transfer retriggering on resume from CDC ACM and Bluetooth class
implementations because transfers are no longer cancelled on suspend.
Other classes do not have any suspend related workarounds implemented.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When we receive Node Reset message, we schedule work in the system
workqueue to call bt_mesh_reset(). In bt_mesh_reset() we call
bt_conn_disconnect() to disconnect proxy client. bt_conn_disconnect()
will put a buffer to a pool and call k_sem_take to let BT HCI TX thread
process this buffer. Because we stop scanner after disconnecting the
proxy, we can still receive a message at this point. Since BT RX thread
has higher priority than the system workqueue, if we receive a message
while in bt_mesh_reset(), it will be processed when we call
bt_conn_disconnect().
Stop scanner before resetting the mesh to avoid processing of a received
mesh message while in the process of resetting mesh.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If, while storing app or net key, or changing cdb, we receive another
mesh message that affects setting of the same key that the mesh
currently stores, the new change won't be stored.
The settings subsystem API has rescheduling point inside. The mesh
settings are stored in the system workqueue and by default mesh messages
are processed from BT RX thread which has higher priority than the
system workqueue.
When the case above happens, a new change will be written to the same
cache entry. But this cache entry will be invalidated after leaving
settings API, which in turns will invalidate the new change:
- Receive Config AppKey Add message
cfg_srv.c -> app_keys.c: bt_mesh_app_key_add()
app_keys.c: update_app_key_settings()
app_keys.c: bt_mesh_settings_store_schedule()
- store_pending() in settings.c is scheduled
settings.c -> app_keys.c: bt_mesh_app_key_pending_store()
app_keys.c: store_app_key() called to store new app key
app_keys.c: settings_save_one() calls flash driver and sleeps
- Receive Config AppKey Delete message while in sleep,
which wakes up BT RX thread before returning to the system workqueue
cfg_srv.c -> app_keys.c: bt_mesh_app_key_del()
app_keys.c: update_app_key_settings()
app_keys.c: app_key_update_find() finds entry and returns it
app_keys.c: update->clear = 1
app_keys.c: bt_mesh_settings_store_schedule()
- returning back to bt_mesh_app_key_pending_store() from
settings_save_one()
app_keys.c: update->valid = 0
- the key won't be deleted next time store_pending() is scheduled.
This change moves entry invalidation before calling settings API so that
after returning from settings API, a new change won't be unintentionally
invalidated.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Allow the streams to be paired when creating unicast group. This will
allow to reuse the same ISO for the paired streams.
Fixes: #51796
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The img_mgmt_flash_area_id would add processing of
slot2_partition and slot3_partition if they only exist, even if
not used at all.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Add BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED as the default supported
context. This is primarily due to the requirement that it
shall always be supported, and the value 0 (previous
default) was invalid.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The call to set_supported_contexts in set_src_supported_contexts
gave the wrong value by reference.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Unit test project for bt_keys_update_usage().
This part of subsys/bluetooth/host/keys.c unit testing.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
A follow up to commit 1d7a077e11 - apparently the PPP interface should
not be brought entirely down internally, as this can break further
communication with the host. Because of that, reintroduce functionality
that used to be covered by net_if_carrier_down() (which basically
skips the L2 enable(false) call), but limited to PPP scope only.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fixes#53786
The variable slot_plus_us is assumed to be a number in us unit.
To assign the maximum possible CTE length to this variable,
BT_HCI_LE_CTE_LEN_MAX has been used while this parameter is defined
in a 8us units (it's 0x14=20 that corresponds to 160us).
To convert this number to us, it's needed to be multiplied by 8.
Signed-off-by: Saleh Mehdikhani <saleh.mehdikhani@unikie.com>
The bt_has_register_param's preset_sync_support and independent_presets
make sense only if CONFIG_BT_HAS_PRESET_COUNT is non-zero meaning the
CONFIG_BT_HAS_PRESET_SUPPORT is enabled.
Otherwise, those parameters shall be skipped.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Add command to perform the Periodic Advertising Set
Info Transfer procedure, which transfers information
about a periodic advertising set to a connected device.
In essence this is just PAST but from the advertiser
instead of a 3rd device.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In ascs.c we had a case where we assigned stream->conn
without taking the ref.
In bt_audio_stream_attach we did not check if stream->conn
was NULL before taking a reference, causing multiple calls
to ase_config to take multiple references.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The purpose of this commit is to facilitate future improvements to the
LPN and friendship feature. By being able to identify friendship related
messages on the advertising layer, it will be possible to treat these in
a specific manner so that message exchange between LPN and friend
devices can be conducted in a more power efficient manner.
This commit adds the following:
- A separate tag for friendship related messages
- A optional separate advertising set for friend related messages
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Adds Kconfig option to enable tuning the Friend receive delay window.
Friend poll events can be made more efficient by compensating for the
time the non-ideal advertising latency otherwise would add to the receive
delay.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This changes some of the MCUmgr transport CMake select statements
to depends on, this is to align with other in-tree symbols that
do not pull in whole subsystems and instead only allow selection
if those subsystems are already enabled.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
- Adds mmc.c
- Edits sd.c to init and probe MMC
- Adds mmc init to sd_init
- Some functions from sdmmc.c should be in sd_ops because
they can be used by both sdmmc and mmc.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
In sd subsystem, made one header for all the init functions
instead of having a bunch of header files with one function.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
split reusable portions of SDMMC protocol code into sd_ops.c, so other
SD protocols can use these functions directly without compiling in the
SDMMC subsystem.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add stub code for SDIO support, capable of verifying card responds to CMD5.
This commit also changes the architecture of the SDIO probe step to make
adding new protocol support more streamlined, and enable compiling out
support for undesired protocols.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit updates all in-tree code to use `CONFIG_CPP` instead of
`CONFIG_CPLUSPLUS`, which is now deprecated.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit moves the files under `subsys/cpp` directory to the
`lib/cpp` directory because the C++ ABI runtime library and the
standard C++ library components are not a "subsystem" (aka. API) in
conventional sense and is better described as a "library."
Classifying the C++ ABI runtime library and the standard C++ library as
"libraries" instead of "subsystems" also better aligns with how the
existing C standard library implementation (`lib/libc`) is handled.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Wi-Fi bands are regulated by a governing body depending on operating
country, add support for the user to provide a country of operation as a
hint to the Wi-Fi chipset.
Ideally if the chipset supports this is all handled internally, in that
case "get" is useful but for testing and other usecases add a "set" as
well, similar to "iw reg set" or "country_code=" configuration in
hostapd/wpa_supplicant in Linux world.
This add a new offload API operation "reg_domain" that can be used to
either get or set the regulatory information.
The validation is left to the underlying chipset, shell only does basic
validation, (XY/00).
This is just a regulatory hint to the chipset, there could be other
regulatory hints e.g., beacon that can override this configuration, so,
an additional option to force this setting despite other hints is also
given for testing purposes.
FYI, the standard database used is [1].
[1] - https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git/tree/db.txt
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
under certain conditions the current implementation did not maintain
the desired sort order.
Signed-off-by: Pascal Brogle <pascal.brogle@husqvarnagroup.com>
Add the ability to change supported contexts in PACS.
Enhance the context command in the shell module to make it configurable.
Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
base name or name can contain up to two shorts.
(object id & object intstance or resource id & resource instance id)
Signed-off-by: Pascal Brogle <pascal.brogle@husqvarnagroup.com>
The purpose of the change was to have the Zephyr network stack
internally add the IGMP all systems 224.0.0.1 multicast address to a
multicast membership list so that multicast hash filter implementations
can add this address to the hash filter.
Fixes#53548
Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
The call to bt_adv_reset_adv_pool is only required in the
broadcaster role, and not in the observer role, regardless
of the setting of CONFIG_BT_EXT_ADV
As the code was this call was also made for the observer.
Note: handling of the setting of CONFIG_BT_EXT_ADV
is already handled in the bt_adv_reset_adv_pool function
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
BOOT_MAGIC_SZ and BOOT_MAX_ALIGN were used in the header without
including bootutil/bootutil_public.h. This change remove the need of
the inclusion by making the dependency private.
Fixes#52095
Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
Fix a bug in setting MAC address using net_if API, the API doesn't do a
memcpy but just stores the pointer and shell was passing stack pointer.
We can use dynamic allocation but freeing the memory for the MAC address
would be trickier, so, use the net management API and let the underlying
drivers figure out the MAC address memory management.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
There is special handling done for resolved addresses to convert
them to "regular" addresses for the upper layers.
This commits adds two helper functions to check if they are
resolved, and if so, then properly copied.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
We only expose random/public address types to the upper layers.
This is done by checking if the address type of events are
resolved addresses, and if so, then we translate them to
public/random.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
As we have to provide LL addresses in big endian to userspace to be
POSIX compliant and we also do not want to reserve extra space for
such addresses, bff6a5cce5 introduced
a change that swaps address bytes in place in the packet before
returning the packet with LL address pointers to userspace.
Unfortunately a regression sneaked into the code base while doing
so: The byte swapping was duplicated when using 6LoWPAN compression
and the byte swapping caused decryption to fail in some cases,
see #53630. This commit fixes the problem.
Fixes: #53630
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
The L2 networking layer checks for return value from enable, but
Ethernet is not checking and always returns 0, so, relay the return
value from the Ethernet driver to networking stack.
This fixes the issue of interface start failing but interface still
being up.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
This add storage abstraction to allow switch between different flash
APIs. This remove the erase command at updatehub core and move it to
storage init phase.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Currently MCUboot and system reset are invoked directly in the sample
applicatiion. This introduce 2 new methods to isolate system from
application.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Move header includes to source file. Currently firmware source files
have a hardcode partition identificator. This moves identificators
to updatehub core.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
The CP app sends PD a "command" and the PD responds to it. Some times,
the PD has something that it wants to tell the PD which it does so in
response to POLL command. Both CP and PD apps need a way to exchange
these info over the OSDP bus. To archive this we will introduce what are
called "events" that allow the PD app to enqueue and CP app to get
notified.
This is analogous to the incumbent "commands" abstraction where, the CP
app enqueues a command and the PD app gets notified of it.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
For all commands and replies, the buffer length needed to build or the
length of data needed to decode needs to be checked and asserted. Right now
we do this by ad-hoc if-s. Add macros that do this at a common location.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
The raw, flags check has become a bit excessive and has begun to affect
code readability. Provide inline functions for those accesses that are
frequent. Also, get rid of `struct osdp_cp` as it can be fully represented
by `struct osdp` itself.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
CP has an array of PDs and pd->offset was the position of the PD in CP's
list. Since offset has many meanings, rename it to pd->idx.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Partial packets in the RX buffers cause the subsequent packet to be
treated as malformed. The RX buffer can have partial data if the sender
is too slow in sending the packet of if there is an interruption in
transmission mid-way.
To avoid any issues due to such partials, flush the uart channel before
sending the command/response.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
The log lines in CP and PD had a prefix such as "CP: " and "PD: " that
does not add too much value as a given device an either be CP or PD
only. This patch removes those and enhances some other log lines while
at it.
It also adds a enum for return values throughout the module to improve
code quality.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Use a flag to report a protocol error to the states. This keeps
state specific actions in the state. Currently, those state
specific actions are handled in the pe_report_error function.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
The name and wording used in template can be misleading.
Use more accurate word instance instead of device since
an implementation does not necessarily have to implement
a device (in the sense of Zephyr device model), and if it
does then devicetree should be used to describe number of
instances as in the case of CDC ACM implementation.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The function checked several value, but the BAP spec does
not specify that these cannot be different from stream to
stream in the CIG. The function thus did nothing but needlessly
restrict the upper layers.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit fixes issue introduced in
5d059117fd.
Use extra flag stored in user data of net_buf to control segmented
messages in Friend Queue. The initial idea with using fragments didn't
work.
This fixes the following PTS tests:
- MESH/NODE/FRND/FN/BV-08-C
- MESH/NODE/FRND/FN/BV-19-C
- MESH/NODE/CFG/HBS/BV-05-C
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Fix UDP TX packet count when DHCPv4 is used. Currently UDP TX counter
is only updated when net context is in use. DHCPv4 however does not use
net_context underneath, therefore it needs to update UDP TX stats on its
own.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit adds the support for host commands being transported
by the Serial Host Interface on the NPCX SoC.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
A variable was defined directly after a label in two case statements,
resulting in build warning with certain compilers.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fixes two issues with the JIT scheduler:
Rescheduling of primary advertising packets for extended advertising
when using the JIT scheduler did not work, since the done events for
the primary events never made it into the reschedule logic
The EVENT_DONE_EXTRA_TYPE_ADV_AUX event (for auxillary packets) could
cause a "reschedule" for a primary event that was actually sent
successfully (causing it to be sent twice)
Signed-off-by: Troels Nilsson <trnn@demant.com>
This prevents a configuration error by selecting the console if
the UART MCUmgr transport is used, which is actually a dependency
for this transport.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Update sdmmc framework to use sdmmc_wait_ready when accessing card in
SPI mode. this will allow cards that do not return to ready to be polled
for busy status until the SD data timeout expires
Fixes#52931
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Recently introduced MISRA-C CI check complains about use of a duplicte
tag, so, shorten the variable from shell->sh to avoid same name as the
structure.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Add a new callback list structure for state change information.
These APIs are meant to eventually replace the single callback API
provided by openthread_set_state_changed_cb().
This will allow multiple users to gain information about
OpenThread stage changes.
Note CONFIG_OPENTHREAD_MAX_STATECHANGE_HANDLERS
with OpenThread's otSetStateChangedCallback() API can also be
used to enable registration of multiple callbacks of this type but this
cannot be modified if a certified OpenThread binary is used in the
build.
Signed-off-by: Nick Ward <nick.ward@ftpsolutions.com.au>
USB_TRANS_NO_ZLP flag has no meaning for usb_transfer() in
host-to-device direction (USB_TRANS_READ).
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
audio_iso.c should only be compiled if we require any streams,
so it is now guarded by CONFIG_BT_AUDIO_STREAM.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
After several fixes of the re-ordering logic in TCP, the receive queue
works as intended and cleans itself up properly. Previously the default
timeout was 100 ms, which pretty much disables it for real applications.
Increase the timeout to 2 seconds to actually enable it for in practice.
This should help pass much more of the Maxwell Pro tests.
This is the first step before removing the timeout completely.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
In case that CONFIG_BT_AUDIO_UNICAST_CLIENT_ASE_SNK_COUNT or
CONFIG_BT_AUDIO_UNICAST_CLIENT_ASE_SRC_COUNT is set to NULL, the
unicast client implementation in the shell would have compile
warnings, since the arrays would be 0 and we would attempt to
access it some places (or rather the compiler/linker would
think that, but it would never happen at runtime).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Array 'days_in_month' of size 12 may use index value bigger then
count of its elements.
Signed-off-by: PawelX Dobrowolski <pawelx.dobrowolski@intel.com>
Fixes an issue whereby event ID was not checked properly, meaning
that OR'd events would not work as one would expect.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Setting a detected packet family (ipv4 or ipv6) in net_context level
instead in lower layers for AF_PACKET/SOCK_RAW/IPPROTO_RAW type sockets
when sending data.
Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
Clear the `ATT_CONNECTED` flag when a channel is detached (could be after
an ATT timeout).
Also convert the assert checking it in `chan send` to an `if` test, since
the channel could be disconnected from a different thread than the one
triggering `chan_send`.
Fixes#53247.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Change the BT_AUDIO_ISO logging module to use
log_config_inherit to be consistent with the other LE Audio
logging modules.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The TinyCrypt is the current library used by UpdateHub to perform
SHA-256 integrity check. This refactor code and add support to
mbedTLS library. It changes default library to mbedTLS to use
hardware accelerator when available.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Currently choice for FLASH_AREA_CHECK_INTEGRITY does not have a
denomination. Without that it is not possible select a default
backend hash backend for integrity check at project configuration.
This add a name to allow select flash area check integrity backend.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
ISO Synchronized Receiver only builds do not transmit and
hence may not have any tx buffers allocated in a
Controller, leaving bt_dev.le.acl_pkts semaphore
uninitialized or bt_conn_get_pkts() returning NULL.
Do not use the semaphore if no Tx buffers allocated in a
Controller.
Regression in commit ef19c64f1b ("Bluetooth: host: poll on
CTLR buffers instead of host TX queue").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add common function to handle large GATT reads of strings.
Initialize the buffer pointers in the net_buf which is used for large
GATT reads by bt_tbs_client_read_call_state() and
bt_tbs_client_read_current_calls().
Define the size of the allocated buffer based on the enabled features.
Signed-off-by: Kim Sekkelund <ksek@oticon.com>
The way that the braodcast clause for handling failing
ISO data path would end up in the __ASSERT. It has been
slightly modified to make it use if-else properly.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The direction of a stream/endpoint/parameter has just been
logged as a unsigned integer. This commits adds a
value -> string internal function that would log
BT_AUDIO_DIR_SINK as "sink" and BT_AUDIO_DIR_SOURCE
as "source".
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The old random timer test was not random-looking
enough on some platforms.
Replace with new test which is psuedo-xoshiro.
The generator is still deterministic
and does not depend on entropy at all,
but should look more random for testing.
Change name of generator tree-wide also.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Update the SBS Gauge driver that implements the fuel_gauge API to implement
a set_property function allowing the writing of an SBS word to the
manufacturer access register per the SBS spec.
Includes an update to the SBS Gauge emulator and SBS fuel gauge tests to
weakly verify the code runs.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Fix SBS I2C transfer emulation to accept reads and writes of 16 bit words
as defined by the SBS spec. This change is tested by a following commit
that implements writing and subsequently reading a written SBS property.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Implement and weakly test fetching the manufacturer access word from an SBS
compatible fuel gauge.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
The macro BT_CONN_INTERVAL_TO_MS was used a fair amount
of places, but it often was used with integers. This meant
that sometimes the resulting (integer) value would be
incorrect, as something like 7.5ms interval would not
be properly stored as a integer in millisecond units.
Adding BT_CONN_INTERVAL_TO_US allows users to still use
integers to store the result, but in a more accurate unit.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The IPv4 autoconfiguration feature relies on the fact, that autoconf
ARP packets are always prepared by the ARP module. After recent ARP
refactoring though that could no longer be the case due to packet
queueing mechanism. This could lead to net pkt leaks in the autoconf
module.
Fix this by skipping the pending packet queue for autoconf packets.
Since for autoconf ARP requests there's no really a pending packet
to queue, it can be safely avoided. This results in the ARP request
being always sent for the autoconf case, preventing the packet leak.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Check data buffer size and return error if
* buffer size is too small for opaque or string data type
* buffer size is not equal to res data length when data type
is fixed size
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
This fixes possible ASE state race condition. The notification is sent
immediately once the ASE state changed that eliminates a situation where
the state was changed by user action (API function call) when the state
was not yet notified to the remote Unicast Client.
Fixes: BAP/USR/SCC/BV-158-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Check return values from lwm2m_rd_client_pause() and
lwm2m_rd_client_resume() when engine thread suspend is requested.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
From 8.3.3.4.2.1 PE_SNK_Send_Soft_Reset State, Error Recovery
should be performed if a Protocol Error happens during a Data
Role Swap.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
Build time check that the number of states initialized
in the state machine array matches the number of enums
used to index said array.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
Accurate timekeeping is something that is often taken for granted.
However, reliability of timekeeping code is critical for most core
and subsystem code. Furthermore, Many higher-level timekeeping
utilities in Zephyr work off of ticks but there is no way to modify
ticks directly which would require either unnecessary delays in
test code or non-ideal compromises in test coverage.
Since timekeeping is so critical, there should be as few barriers
to testing timekeeping code as possible, while preserving
integrity of the kernel's public interface.
With this, we expose `sys_clock_tick_set()` as a system call only
when `CONFIG_ZTEST` is set, declared within the ztest framework.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
This fixes deadlock that happened waiting for meta data in system
workqueue.
The meta data always get freed in the system workqueue,
so if we're in the same workqueue but there are no immediate
contexts available, there's no chance we'll get one by waiting.
Fixes: #53455
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
As the unicast client, we would always create bidirectional
CIS to ensure that the PHY parameter is correctly set.
We can, however, just set the (required) PHY value and
leave the SDU and RTN values as 0, to avoid
creating bidirectional CIS.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If either the sink or source ASE count was zero, calls to
ARRAY_SIZE(srcs) or ARRAY_SIZE(sinks) would cause a build warning.
The arrays should actually not be there at all if the respective
ASE count was 0, as that is just a waste of memory. The arrays,
and all uses of them, have been properly guarded.
This also adds a build assert to ensure that at least one
of them is non-zero, and that we also test building either
of them with the value 0.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This allows us to allocate and bind the Audio ISO structs
to Audio Streams, thus allowing us to create the unicast group
before they have been configured.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There was a bug in bt_audio_iso_unbind_ep that caused an
assert, missing unbinding on stream released callback
and missing state check in bt_audio_unicast_group_delete
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use k_work_delayable instead of k_timer in order to execute timeout in
USB workqueue context instead of ISR context. This fixes Will-Detach on
targets where usb_dc_detach() uses functions not allowed in ISR context,
e.g. nrfx usb_dc_detach() acquires mutex.
Fixes: c27d48c89a ("usb: dfu: Support DFU with WinUSB on Windows")
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
RD-Client is essential part of LwM2M specification and it can't
be disabled from LwM2M engine. This commit deprecates Kconfig
variable CONFIG_LWM2M_RD_CLIENT_SUPPORT and removes
all usages if it.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
`sntp_simple()` was forcing to resolve SNTP-server's URL into IPv4 address
addresses. This was not allowing sntp_init() to succeed in case the system
did not support IPv4 addresses (returning EPFNOSUPPORT, ie. Protocol
Family error).
Now by default SNTP has unspecified family type and it relies on
`net_getaddrinfo_addr_str()` to be able to resolve literal server URLs
into the supported IP family type.
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
Setting `hints.ai_family` to `AF_UNSPEC` was causing
`net_getaddrinfo_addr_str()` and in turn `getaddrinfo()` to resolve the
literal SNTP SERVER first into IPv4 and then (if supported) IPv6 addresses.
This was causing useless waste of time and memory in case IPv4 was not
supported. In addition, in case IPv4 addresses were not supported, other
system components (eg. SNTP) could fail due to the DNS returning IP
addresses with unsupported family type (ie. IPv4).
Now, if address family is not explicitly set to `AF_INET` (ie. IPv4), then
no attempt is made to resolve SNTP server address into an IPv4 address.
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
Add shell command
cache :Enable data cache for resource
cache PATH NUM
PATH is LwM2M path
NUM how many elements to cache
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Fixed problem for matching path url with or without '/'
by change time series data structure to use struct lwm2m_obj_path.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
Call lwm2m_send_message_async() from function
lwm2m_information_interface_send() and remove duplicate code.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
lwm2m_send_message() sends a message directly to the socket. Remove
the function from public API and combine the code with
socket_send_message().
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
Now that we a proper API, shell is just optional, so, make the
dependency optional by refactoring the code.
Also, add a build test combination in twister.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Initializing an event callback with net_mgmt_init_event_callback() just
sets some of the callback fields but do not propagate those masks in the
core. If we want to use the callback, it is necessary to also call
net_mgmt_add_event_callback().
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
The current association logic starts by changing the channel. The way it
is done is wrong because it dereferences req->channel which is simply
not initialized by the caller. But anyway, the command itself does not
support providing a channel so we must already be on the right one when
trying to associate. Hence, drop this channel change call.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
During an association, the peer we are trying to connect to will send us
an association response frame with the destination PAN ID set to the PAN
ID we try to join. If we do not update the hardware address filters
beforehands, it is likely that the hardware will just discard the
response and the association will fail.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
While the packet structures seem to always be reset when they are
allocated, it's apparently not the case of the data buffers. Indeed,
these are allocated differently and just attached to the packet
structure through a frag/buffer member.
Experience shows that we may get uninitialized buffers so let's set
all MAC parameter bits one by one, even the reserved ones.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
The spec clearly states: "association requests shall set the AR bit".
Even though Zephyr can currently only implement RFD devices which are
not expected to support incoming association requests, because this MAC
command is actually processed until being voluntarily ignored, let's
ensure the expected "ar" value is right to avoid failing because of a
wrong reason.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
When validating a MAC command, the "src" and "dst" fields may be set to:
- IEEE802154_ADDR_MODE_SHORT (0x2)
- IEEE802154_ADDR_MODE_EXTENDED (0x3)
- IEEE802154_ADDR_MODE_SHORT | IEEE802154_ADDR_MODE_EXTENDED (0x3)
Hence when the mode check happens, any times the mode is set to SHORT
the check will fail while in practice it was meant to be valid because
the check is:
if (src_mode == src || dst_mod == dst)
Use bitfields when relevant so that when checking capabilities we use
the bit offsets rather than the plain numbers.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
When validating a MAC command, there is sometimes a misunderstanding of
what "src" and "dst" length mean.
There are actually two fields in the MHR:
- One giving the type of address, if it is short or extended, it is the
value provided by the macros IEEE802154_ADDR_MODE_{SHORT,EXTENDED} and
their respective decimal values are 2 and 3.
- One giving the size of the address field, this is
IEEE802154_{SHORT,EXT}_ADDR_LENGTH and their value is actually 2 and 8
(bytes).
The function validate_mac_command() provides inputs to
validate_mac_command_cfi_to_mhr() which expects the former information.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Add reset of buffered messages counter to the initialization function.
It is for testing purposes sinces in the application logging is
initialized only once.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The commit changes flash_map list output to display flash_map
assigned pointer instead of device ID which was not propagated
anyway.
The commit also fixes formatting of the output.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fixes an issue with a missing variable when
CONFIG_IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT is enabled.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fix LwM2M rd client stop call hang when Queue client is at
RX_ON_IDLE_STATE. Added miossing connection resume for
de-register functionality.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
If k_malloc() of filters fails in log_mgmt.c:link_filters_init(),
return an error and do not rely on the __ASSERT(0).
If __ASSERT_ON==0 in the build, assert will not trigger and
code will proceed to execute
memset(NULL, 0, sizeof(uint32_t) * total_cnt);
Avoid this by returning -ENOMEM on error.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Check receiving buffer size and return error if
* buffer size is too small for opaque or string data type
* buffer size is not equal to data lenght when data type is
fixed size
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
After Kconfig options got renamed, some of the no longer fit
to files they have been defined in.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
There are scenarios when it is necessary to globally redefine
a log macro. The existing logging frontend is not sufficient since
it redirects at the function level.
One example is using pigweed_tokenzier. The pigweed tokenizer depends
on intercepting log strings at the macro level to function.
Introduce an option to include a custom application provided header
named "zephyr_custom_log.h" at the end of log.h. This allows an
application to extend the LOG_* macros globally.
This change includes a simple test that redefines the core LOG macros
to include a custom prefix.
Signed-off-by: Rob Barnes <robbarnes@google.com>
Will check an uploaded image's hash against the hash that was
originally supplied before the upload began and return the result to
the client to know if the upload was successful or if there was an
error during upload. Requires CONFIG_IMG_ENABLE_IMAGE_CHECK be
enabled for functionality to be available.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add nocopy feature to icmsg-me initiator and follower roles
in their receive path. This feature is optional, configured
with Kconfig.
Signed-off-by: Hubert Miś <hubert.mis@gmail.com>
Add a nocopy feature for sending message through the icmsg IPC library.
Also eliminate data races if multiple threads are using the
same ipc instance and are trying to send a message simultaneously.
Signed-off-by: Hubert Miś <hubert.mis@gmail.com>
This patch adds an optional nocopy feature for RX message to the icmsg
IPC library. The nocopy feature can be enabled using project
configuration.
If this feature is not used by icmsg users it is recommended to disable it
to reduce memory usage and improve run-time performance.
Signed-off-by: Hubert Miś <hubert.mis@gmail.com>
On system startup icmsg headers space must be cleared before
cores start handshake procedure. The simplest way to enforce
it is to clear memory by the core responsible by enabling
the remote core, before the remote core is enabled and before
the handshake is started.
This patch ensures that nRF53 APP core clears both TX and RX
memory for icmsg before it starts NET core.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
This commit enables the initiator or the follower
role for the ICMSG multi-endpoint backend
depending on dts by default.
It is needed when BT_RPMSG transport for HCI is used.
Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
Instead of calling zperf shell initialization routine on the first
command execution, initialize it during system boot, along with other
zperf submodules.
Remove redundant IP address configuration on an interface. The default
configuration relies on NET_CONFIG module, so there's no need to set the
address manually in zperf.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Zperf shell functionality is now encapsuled within a single file,
therefore it no longer makes sense to have a separate shell_utils
file.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make the TCP/UDP server functionality restartable. Provide a public API
to stop the TCP/UDP server.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add public API for zperf download functionality. The TCP/UDP server
modules are decoupled from shell, allowing to trigger download directly
from the application code. The shell submodule makes use of this new
public API.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add shell option to the UDP/TCP upload command, which allows to execute
the upload asynchronously. This allows to unblock the shell for other
commands during the upload.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit defines a public API for zperf upload functionality. The
UDP/TCP uploader modules are decoupled from shell, allowing to perform
uploads directly from the application code. The shell submodule makes
use of this new public API.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This moves the UDP and Bluetooth initialisation for MCUmgr to be
performed automatically with the new hander registration feature.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Makes group registration functions for MCUmgr handlers static as
they are registered automatically at startup.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This replaces the requirement for applications to manually
register MCUmgr handlers by having an iterable section which
then automatically registers the handlers at boot time.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add the ISO packing field when creating a unicast group.
This refactors the structure of the unicast group create,
as it now takes both the packing as a group parameter, as well
as an array of stream-specific parameters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When there is an ACL disconnect, or the unicast group is otherwise
deleted, the endpoints were not properly handled, causing
incorrect `dir` values and ASSERTs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When adding or removing a stream from the group, the
endpoint may or may not have been allocated depending
on the state of the endpoint.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The hci_le_setup_iso_data_path function required that if
the path->cc was set, the length could not be 0.
There is no reason why it should not be allowed to be 0
in that case.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The unicast client could not create a CIG with a unidirectional
CIS, because it would not set the correct values as per the
HCI spec for the unused CIS direction.
Instead of implementating a work around, this commit modifies
it so that for unidirectional CIS, we copy the QoS values
to the unused direction, so that we always set valid values,
but it also allows us to actually use that CIS direction later,
assuming that the QoS settings does not change.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For the unicast client, the direction for the endpoint
is reversed in terms of RX/TX, i.e. a sink endpoint is
RX for the unicast server and broadcast sink, but TX
for the unicast client, and similar for the source endpoint.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
As written, the title and description of the Kconfig option seem to
specify the logging sub-system will not flush until the buffer is full.
Someone reading this would expect that shorter log message will not be
flushed until the specified number of bytes accumulate.
This is not the case. Each log message is flushed when finished. The
size is only the maximum bytes of a single formatted message's contents
that will be accumated before the backend flushes.
What's more, it only applies in deferred mode. In immediate mode there
is no buffering, not just of multiple log messages but also of the
message contents as they are formatted.
Signed-off-by: Trent Piepho <tpiepho@gmail.com>
bcdHID is intended for the spec version of USB HID. It was pointing to the
v1.1 bcdUSB define which happens to be the same value for the v1.10 hid
spec version. This corrects it to use the v1.11 HID spec.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
websocket_recv_msg() is reworked with using fsm. Now the function
return 0 when payload is empty, -ENOTCONN if socket close. Receiving
empty ping and sending empty pong were added in tests.
Fixes#52327
Signed-off-by: Grixa Yrev <grixayrev@yandex.ru>
The macros are added to make clear which fields of `struct
bt_mesh_msg_ctx` needs to be initialized by an application.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This changes HAS registration to be dynamic and let's the
application set Hearing Aid Type and binaural features.
Often, devices are flashed with generic firmware with some
features stored post factory production, requiring
the settings to be moved from compile time to run-time.
This change will increase the RAM usage as the GATT
service is moved from ROM to RAM.
Signed-off-by: Lars Knudsen <larsgk@gmail.com>
Co-author: Soren Engquist <soren@engquist.dk>
This change changes the previous mcumgr behaviour of return result
codes when the status is 0 (OK) to being legacy behaviour, instead
it will skip the rc field for these responses. If there is only an
rc field with status 0 to return, then mcumgr will now instead just
return an empty map.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add API to do the BAP Broadcast Source Metadata update procedure,
which updates the metadata of a broadcast source while
it is streaming.
This is also makes all checks for the "head stream" the same.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The codec is assigned to the stream. However since the metadata,
which is stored in the codec, may be modified by other means,
the stored pointer cannot be const, and thus the
codec argument to bt_audio_stream_reconfig cannot be const
either.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Decoupled the ASEs from the ASCS Session and made them dynamically
allocated instead. A Kconfig option was added to set the maximum
number of active ASEs at a single time. The intent here is to allow
the developer greater control over memory usage; this fix addresses
one of the largest ram usages in le audio.
Signed-off-by: Fredrik Danebjer <fredrik@danebjer.com>
Refactored out the client and server members of the endpoint struct
and placed the relevant members in wrappers in ascs and
unicast_client.
Signed-off-by: Fredrik Danebjer <fredrik@danebjer.com>
Add logging of the fields in the sent and received pairing
requests and responses. This makes it easier to debug
why a pairing would be e.g. rejected, or simply to get
more insight in the resulting pairing.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
IEEE802154 L2 may modify the LL address during interface operation (when
processing MAC command). So far the L2 workaround the LL address update
protection by clearing the NET_IF_UP flag temporarily, but due to recent
changes it no longer works. Update this workaround to verify
NET_IF_RUNNING flag instead.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Bluetooth IPSP L2 sets the LL address only after establishing Bluetooth
connection. As this can take place after the interface was brough UP by
the application, the network interface API should not block such
attempt. Instead, verify the NET_IF_RUNNING flag.
For the same reason, move the assert verifying that LL address is set
from net_if_up() (which only puts the interface in the admin UP state)
into the function that transitions the interface into operational UP
state.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
After network interfaces state handling rework, it's no longer correct
to verify the connection status on `net_if_up()`, as this only changes
the administrative state of the interface. The interface won't be put in
operational UP state until it's connected.
This check prevented the interface from being brought up during system
boot.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If CONFIG_BT_BREDR=y and bt_dev.le.acl_mtu == 0, then we
would report the bt_dev.br.mtu for ISO channels.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the bt_dev.le.iso_mtu was 0, then we would report
bt_dev.le.acl_mtu if CONFIG_BT_CONN=y (which is often true when
CONFIG_BT_ISO=y). Thus if the ISO MTU is 0, we would often
return a non-0 value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of only conditionally starting the discovery at
0x0001, we now always start it at that handle. Since we are
reading by UUID, this should not really affect performance.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
mcc.c used 0x%016x, but for some platforms we need to
be more explicit and use 0x%016llx to avoid compile
warnings.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The HAS implementation of the security_changed callback
expected all devices to have bonded, and thus always added them
to the ntf_bonded implementation.
This adds a check to whether the device is actually bonded.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Prototypes of those functions are already in header files in
subsys/settings/include/settings/ directory, so no reason to have
duplicates in C files.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This fixes an issue whilst investigating using iterable sections,
which cannot be used when the non-zephyr prefixed functions are
used. It also resolves a possible critical bug intoduced with the
MCUmgr rework whereby functions or elements seem to have silently
dropped.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Rewrite the "net ping" command handling, to allow the command to be
aborted during execution. This includes:
* Using shell bypass mode to capture input whilst the ping is active.
* Using system workqueue to send individual ping requestes, instead of
sending ping requests directly from shell thread, in a blocking
manner. This is needed because in order to receive input in the
registered bypass handler, the shell thread must be unblocked to
process the input.
* The bypass mode is left after receiveing `CTRL-C` character (which
cancels the ping), after receiving all expected Ping replies or after
the timeout occurs.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If bypass mode is left outside of the registered bypass handler, the
command buffer was not cleared, basically containig leftovers from the
processing of the previous command. This resulted in undefined behaviour
on consecutive shell operations.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The PM subsystem should not call the PM control callbacks on
uninitialized devices when entering low-power states.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>
The address could have changed. The issue linked (and bsim test in previous
commit) shows a scenario where that could happen:
- we start scanning, host will use NRPA
- we start advertising, host will use identity address
- a device connects (as a central)
-> advertising resume fails for some unrelated reason
- another device connects (as a peripheral)
- the central device disconnects, we resume scanning
- the peripheral disconnects, the stack resumes advertising
-> but it mistakenly advertises using the NRPA set by the scanner
Fixes#52059 .
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This is initial support. Necessary to test the UHC driver API,
for the USB support test implementations, and upcoming USBIP support.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Moved the name filter last, as that it the most expensive
to use.
The address filter has almost been moved after the more
trivial checks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add filtering for the pa_interval. This can be used to
easier find devices that are advertising with periodic
advertising.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The status field is currently a uint32_t even though there are only
3 possible values. Reducing it to a uint8_t allows status to fit in
existing padding in the struct, saving 4 bytes per ticker_user_op
Updated function signatures to match; ticker_op_func left as-is
to avoid having to update a whole bunch of files for no real benefit
Signed-off-by: Troels Nilsson <trnn@demant.com>
To be able to call pm_device_runtime_put() from an IRQ context, move
from mutexes to semaphores and force the async path when the put
operation is called from an ISR.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
For the async operation move from condition variables to events to
reduce the dependency on the mutexes that cannot be used in IRQ
context.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
The `TEST_RANDOM_GENERATOR` symbol in itself does not imply that a
non-random number generator is selected -- that is indicated by the
`RNG_GENERATOR_CHOICE` choices, of which only `TIMER_RANDOM_GENERATOR`
is a non-random generator.
This commit updates the Random subsystem to print the "non-random
number generator usage warning" when `TIMER_RANDOM_GENERATOR` is
selected, as opposed to when `TEST_RANDOM_GENERATOR` is selected.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
The `TEST_RANDOM_GENERATOR` Kconfig symbol indicates that a non-random
number generator (i.e. a random number generator that is not truly
random) is _allowed_ to be used for testing purposes, and not
necessarily that a non-random number generator is _selected_ -- that is
indicated by the `RNG_GENERATOR_CHOICE` choices that depend on
`TEST_RANDOM_GENERATOR` (i.e. only `TIMER_RANDOM_GENERATOR` as of now).
This commit updates the `TEST_RANDOM_GENERATOR` Kconfig symbol
description to reflect and clarify that.
It also removes the `TEST_RANDOM_GENERATOR`'s dependency on
`ENTROPY_HAS_DRIVER` because the act of _allowing_ a non-random number
generator to be used does not depend on the availability of an entropy
driver -- when an entropy driver is available, by default, the
`ENTROPY_DEVICE_RANDOM_GENERATOR` will be selected; otherwise,
`TIMER_RANDOM_GENERATOR`, a non-random generator, will be selected.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Since 6c30c9ac47 (samples: net: zperf:
Rewrite upload part to use sockets), zperf uses SO_RCVTIMEO in UDP mode,
hence must depend on/enable support for it.
Without SO_RCVTIMEO support, zperf fails like this:
> nb_packets=47 delay=188964 adjust=-13
> setsockopt error (109)
> setsockopt error (109)
> -
> Upload completed!
> LAST PACKET NOT RECEIVED!!!
> Statistics: server (client)
> Duration: 0 us (10.19 s)
> Num packets: 0 (50)
> Num packets out order: 0
> Num packets lost: 0
> Jitter: 0 us
> Rate: 0 Kbps (9 Kbps)
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
In case CIS failed to be established, leave the ASE in enabling state
waiting for peer to retry.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Allow enabling CDC ACM logging only if CDC ACM is not used as logging
backend. This prevents endless recursive logging loop, especially
visible when minimal footprint logging is enabled.
Fixes: #52981
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Only copy the data from the 'parent' buf into the segment buf if we
successfully acquired the HCI semaphore (ie there are available controller
buffers).
This way we avoid pulling and pushing back the data in the case where there
aren't any controller buffers available.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
When there are no buffers, it doesn't make sense to repeatedly try to send
the host TX queue.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Make the ACL fragmentation asynchronous, freeing the TX thread for sending
commands when the ACL buffers are full.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Instead of printing every audio packet (typically
arriving every 7.5 or 10ms), we now only print every 100th.
Ideally we would add support for changing the number of
"skippe" audio packets at runtime in a shell command, but
that will be postponed.
Ideally we would also have a rx_cnt per stream, but that will
also be postponed to the future, and should be fixed with e.g.
the sequence number (seq_num) as well.
Finally this commit also adds a verification if the currently
incoming data packet contains the same ts or seq_num of the
previous one, and print if it does, as this indicates that
we are receiving some invalid data.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The lc3_start_time and lc3_sdu_cnt were not reset properly,
causing it to fail when trying to do start_sine after calling
stop_sine.
This commit also ensures that the sending of the sine wave is
stopped once the stream is either released or stopped.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
bt_le_per_adv_set_data would not accept the ad to be NULL or
the ad_len to be 0, making it impossible to set no data (which
effectively clears existing data).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the advertised length, and the actual length, in the log statement
so it is more clear what the issue is.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In some applications, there is a need to don't start the shell by
default, but run it later on some special condition.
When SHELL_AUTOSTART is set to n, the shell is not started after
boot but can be enabled later from the application code.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
Users may want to do some configuration after the kernel is up, but
before initializing the log_core. Making the log_core's init priority
configurable makes that possible.
Signed-off-by: Ian Oliver <io@amperecomputing.com>
There is already CONFIG_SETTINGS_FILE_PATH, which is set to full file path,
while CONFIG_SETTINGS_FILE_DIR is required to be set to its parent
directory. This is redundant, as parent directory path can be easily found
out either during runtime or optionally during buildtime by CMake.
CONFIG_SETTINGS_FILE_DIR was actually introduced recently after Zephyr 3.2
release as a replacement of deprecated CONFIG_SETTINGS_FS_DIR. This means,
that there is no need to deprecate it for 3.3 release and dropping it
should be fine. Adjust 3.3 release notes accordingly, so that
CONFIG_SETTINGS_FILE_PATH will be used directly.
This patch stops using deprecated CONFIG_SETTINGS_FS_DIR. There is actually
no value in respecting it, as setting anything other than parent directory
of CONFIG_SETTINGS_FS_FILE makes no sense.
There is actually one use of CONFIG_SETTINGS_FILE_DIR in file backend
tests, to derive directory for files containing tested settings.
CONFIG_SETTINGS_FILE_PATH is not used there, so it makes little sense to
derive directory name from it. Instead, just use hardcoded "/settings"
subdirectory, as this was the default value of CONFIG_SETTINGS_FILE_DIR.
Deriving parent directory can be done either in runtime or in
buildtime (e.g. using some helper CMake function). Doing it in runtime
however allows to create directory recursively (which this patch actually
implements), e.g. for some more nested FS tree structure. Additionally it
will simplify migration of settings configuration from Kconfig to
device-tree (yet to be developed feature).
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
There is little reason to panic on settings backend initialization error.
Such behavior was introduced with initial settings subsystem support, which
was adapted from MyNewt. This is not the usual way how Zephyr handles
errors, so it is time to change that.
There is already handling of some errors by simply returning / propagating
them to caller. Rework all the paths that resulted in k_panic() to also
return error codes.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Schedule CDC ACM tx work to happen 1 ms after first unprocessed data
write. This gives enough leeway for the task writing to the queue to
write more than 1 byte before USB workqueue preempts and schedules IN
transfer. Sending more than 1 byte at a time increases data throughput
because transaction overhead remains the same regardless of packet size.
Prior to this change, virtually every IN transaction carried only one
character when CDC ACM was used as a console.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
The CBOR encoding allows strings to have white spaces, and as string
may be used as key it should also be allowed to use space in key.
The commit provides ZCBOR_MAP_DECODE_KEY_DECODER macro, which is
intended to replace ZCBOR_MAP_DECODE_KEY_VAL macro, that allows
to use string keys with spaces in it.
Both macros are available for now.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fix MIC failure transmitting LL_CIS_REQ PDU.
The MAXPACKETSIZE value was not set with using Long Control
PDUs.
Relates to commit e895948047 ("Bluetooth: Controller: Add
Long Control PDU support").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove duplicate PPI/DPPI configuration in
radio_tmr_start_now() which reuses radio_tmr_start_us().
And other minor refactor to remove unnecessary conditional
compilation of a define.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix compilation error for ISO Broadcaster with dynamix Tx
power support, and remove setting tx power for ISO
Synchronized Receiver.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Updated implementation to save power consumption by
scheduling BIG event starting at the first BIS selected for
synchronization. Also, skip reception of any unselected
BISes in between multiple BISes that the Broadcaster is
transmitting. Added advance calculation of next subevent
channel index.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
From Bluetooth Core Specification v5.3 Vol 6 Part B Section
4.4.6.8 Channel indices,
The subevent number se_n shall be set to the values 1 to
NSE, in order, for the subevents on a given BIS - the same
values shall be used for all the BISes in a BIG - and to 1
for the control subevent.
Hence, fix implementation to reset back to se_n to 1 when
next BIS PDUs are transmitted in the subevents.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix broadcast ISO PDU receive connection handle. The look up
was using BIS index instead of the index of the selected
stream that is being received.
Example, when receiving BISes 2 and 4, only the connection
handle for BIS 2 was correct and connection handle lookup
was out-of-bounds for BIS 4; symptoms being that Host
dropped the received ISO PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Budget for one extra ISO Rx PDU buffer for empty/NULL PDU
reception that has to always remain free in order to be able
to setup radio h/w for new PDU receptions.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Setting the protocol type for raw IP packets to be sent so that they
can be passed to Ethernet.
Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
This fixes error log that has been shown if number of calls in the list
was equal to CONFIG_BT_TBS_CLIENT_MAX_CALLS.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
When Receiver Stop Ready operation has completed, the Unicast Server
may request to terminate a CIS and set source ASE state to Qos
configured state immediately. But after CIS disconnected completed,
it will transition source ASE state from Qos Configured to Disabling
state. It's invalid and will cause assert.
we should add Streaming and Enabling state check when CIS disconnected.
Signed-off-by: Hang Fan <fanhang@xiaomi.com>
Fix compile error building application with
BT_LL_SW_LLCP_LEGACY. Request Peer SCA command is not
supported in legacy control procedure implementation.
Relates to commit 76439d0ba4 ("Bluetooth: controller:
integrating SCA procedure and adding HCI API").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introducing common pdu struct declarations for conn param req/rsp and
data length req/rsp to utilize identicality for optimal pdu handling
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
If a central or peripheral is not configured for ISO connected streams,
reject a remote LL_CIS_TERMINATE_IND procedure, responding with an
unsupported feature error (BT_HCI_ERR_UNSUPP_FEATURE).
This fixes EBQ test /LL/PAC/CEN/BV-01-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
For making handle available in vendor sink creation, add ISO handle
to function prototype.
Expose datapath allocation via new ull_iso_datapath_alloc function.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Function ll_setup_iso_path has a construction which causes proprietary
compiler to generate incorrect code. As a workaround, local data path
pointer variables are eliminated.
Signed-off-by: Morten Priess <mtpr@oticon.com>
For framed case, the internal RX SDU counter would increment regardless
of whether the first valid SDU was received or not. According to spec,
SDU counter synchronization is done from first valid SDU.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Make sure ll_iso_stream_connected_get returns NULL until CIS is
established. Always return DISALLOWED when trying to disconnect a CIS
which is not connected.
Signed-off-by: Morten Priess <mtpr@oticon.com>
When a CIS is terminated, the associated link pool must be de-
initialized to be ready for next creation of the corresponding
instance in memory.
Signed-off-by: Morten Priess <mtpr@oticon.com>
The sequence id from iperf starts with 1. The commit changes the
initial value of "next_id" in zperf from 0 to 1. In addition, the
error output of "error" and "out of order" packets is corrected.
Signed-off-by: Yanqin Wei <Yanqin.Wei@arm.com>
Log modes other than the deferred may cause unintended delays during
processing of log messages. This in turns will affect scheduling of the
receive delay and receive window for both, Friend and LPN.
Adding a compilation warning instead of assert as a user may still want
to compile a code with friendship feature enabled without actually
establishing a friendship.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The duration value passed to `struct bt_mesh_adv_cb::start` is an
estimation.
When running mesh with BT_MESH_ADV_EXT option, the actual duration will
be shorter and the `struct bt_mesh_adv_cb::end` is called right after
the contorller finished advertising. Using the calculated duration the
lpn node can be configured for a shorter receive delay and receive
window and eventually use less power.
When running mesh with BT_MESH_ADV_LEGACY option, the time when adv will
be sent out by controller is unpredictable. But the time between start
and end `struct bt_mesh_adv_cb` callbacks is always 50ms for a single
advertisement. Therefore, the receive delay can't be less than 50ms.
With this change, adv duration is calculated between start and end
callbacks, but timers are started after end callback is called. Therefore
we need to consider time between two callbacks when setting timeouts for
timers.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If a user does some heavy operations in friendship callbacks
unintentionally, this may break friendship communication as timers will
be scheduled or messages will be queued only after code execution comes
back from these callbacks. To avoid this issue, call callbacks only after
required operations are done.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Fixes an issue with large packets being received, these packets are
chunked into 127-byte frames for the serial transport but this system
is not needed for the dummy transport as it has a fixed size buffer.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The device information handler can be used to retrieve information about
the configuration of the configured device such as board name, board
revision, firmware version and build date.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The FAT driver converts zephyr paths like /SD:/foo into ELM-FATFS paths
like SD:/foo. Document this behaviour by extracting it into a separate
function (and adding a sanity check).
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Do not assert on invalid PDU in CIS create procedure. Instead terminate
with reason BT_HCI_ERR_LMP_PDU_NOT_ALLOWED
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Adds a missing menuconfig for the DSP library as well as fix an issue
with the zephyr library being a STATIC library and having no sources
in the case of the cmsis backend.
Signed-off-by: Yuval Peress <peress@google.com>
Corrected an omission in the ISO-AL that required an SDU interval to
be added to the reconstructed RX time stamps for each SDU after the
first.
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Test summary can add a lot of noise to the logs when debugging
a specific test using `-test` argument.
Add control to turn this off.
Signed-off-by: Al Semjonovs <asemjonovs@google.com>
This commit removes illegal use of NET_BUF_FRAG in friend.c, which is an
internal flag.
Now `struct bt_mesh_friend_seg` keeps pointer to a first received
segment of a segmented message. The rest segments are added as fragments
using net_buf API. Friend Queue keeps only head of the fragments.
When one segment (currently head of fragments) is removed from Friend
Queue, the next segment is added to the queue. Head has always 2
references: one when allocated, another one when added as fragments
head.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This patch reworks how fragments are handled in the net_buf
infrastructure.
In particular, it removes the union around the node and frags members in
the main net_buf structure. This is done so that both can be used at the
same time, at a cost of 4 bytes per net_buf instance.
This implies that the layout of net_buf instances changes whenever being
inserted into a queue (fifo or lifo) or a linked list (slist).
Until now, this is what happened when enqueueing a net_buf with frags in
a queue or linked list:
1.1 Before enqueueing:
+--------+ +--------+ +--------+
|#1 node|\ |#2 node|\ |#3 node|\
| | \ | | \ | | \
| frags |------| frags |------| frags |------NULL
+--------+ +--------+ +--------+
net_buf #1 has 2 fragments, net_bufs #2 and #3. Both the node and frags
pointers (they are the same, since they are unioned) point to the next
fragment.
1.2 After enqueueing:
+--------+ +--------+ +--------+ +--------+ +--------+
|q/slist |------|#1 node|------|#2 node|------|#3 node|------|q/slist |
|node | | *flag | / | *flag | / | | / |node |
| | | frags |/ | frags |/ | frags |/ | |
+--------+ +--------+ +--------+ +--------+ +--------+
When enqueing a net_buf (in this case #1) that contains fragments, the
current net_buf implementation actually enqueues all the fragments (in
this case #2 and #3) as actual queue/slist items, since node and frags
are one and the same in memory. This makes the enqueuing operation
expensive and it makes it impossible to atomically dequeue. The `*flag`
notation here means that the `flags` member has been set to
`NET_BUF_FRAGS` in order to be able to reconstruct the frags pointers
when dequeuing.
After this patch, the layout changes considerably:
2.1 Before enqueueing:
+--------+ +--------+ +--------+
|#1 node|--NULL |#2 node|--NULL |#3 node|--NULL
| | | | | |
| frags |-------| frags |-------| frags |------NULL
+--------+ +--------+ +--------+
This is very similar to 1.1, except that now node and frags are
different pointers, so node is just set to NULL.
2.2 After enqueueing:
+--------+ +--------+ +--------+
|q/slist |-------|#1 node|-------|q/slist |
|node | | | |node |
| | | frags | | |
+--------+ +--------+ +--------+
| +--------+ +--------+
| |#2 node|--NULL |#3 node|--NULL
| | | | |
+------------| frags |-------| frags |------NULL
+--------+ +--------+
When enqueuing net_buf #1, now we only enqueue that very item, instead
of enqueing the frags as well, since now node and frags are separate
pointers. This simplifies the operation and makes it atomic.
Resolves#52718.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The commit fixes usage of old identifiers, from ELM FAT module,
and adds additional information on how certain options affect
FAT operation in Zephyr.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
- New calculation of Max_PDU for framed case according to BT Core 5.4
- Fix CIS_Offset calculation for multiple CIS usecase
- Fix resume ticker setup for central
Signed-off-by: Morten Priess <mtpr@oticon.com>
Adds fs_mkfs function to fs api. It will allow to perform mkfs operation
in file systems added to Zephyr.
Signed-off-by: Franciszek Zdobylak <fzdobylak@internships.antmicro.com>
Separate ipc_service libraries Kconfig entries from ipc_service backend
entries. IPC_SERVICE_BACKEND_ICMSG_BOND_NOTIFY_REPEAT_TO_MS is renamed
to drop BACKEND part, because this entry applies to a library, not to
one backend. Icmsg related entries are grouped now in a menuconfig for
cleaner presentation in configuration editors.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
The shell_mgmt_config.h and stat_mgmt_config.h as they have been only
providing alternative identifiers for Kconfig options.
Now the Kconfig options are directly used in code and the headers
have been removed.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
188d2dfcca introduced a change where log message queue again
become configurable through Kconfig instead of being fixed in
the code. However, it updated only the configuration of an UART
backend. This commit updates other backends as well. Including
dummy backend which has fixed in the code value.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The Kconfig option allows to set minimum expected sector size
to be supported by FAT fs driver.
When this value differs from CONFIG_FS_FATFS_MAX_SS the driver
will query device for actual sector size, expecting different
sector sizes for different device. When CONFIG_FS_FATFS_MIN_SS
and CONFIG_FS_FATFS_MAX_SS are the same, then there is slight
reduction if FAT driver size, as the query logic is removed
and CONFIG_FS_FATFS_MAX_SS is used for all devices.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
File backend can be read-only with the use of `settings_file_src()` API. It
makes no sense to create file when `settings_load()` is called and
registered file backend won't be used for saving files (because
`settings_file_dst()` was not used).
Do not create file during `settings_load()` if it does not exist yet. This
just requires to remove FS_O_CREATE flag in `fs_open()` invocation.
Open file with read-only access, which is now possible after removal of
`FS_O_CREATE` flag.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This allows the caller to dump a region of memory rather than
dumping one byte (word, etc) at a time. Additionally, it
respects alignment requirements so it works for e.g. 32-bit
register accesses.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
`settings_fcb_save_priv()` already takes `const char *value`, so there is
no reason to cast to `char *` before passing.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
`settings_file_save_priv()` already takes `const char *value`, so there is
no reason to cast to `char *` before passing.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This function was refactored several times due to many features (like
base64 encoding), which got deprecated over time. Simplify it a bit now.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This macro is not used anymore and is strictly a leftover, which should be
removed as part of commit 55be783c85 ("settings: Remove deprecated
SETTINGS_USE_BASE64 support").
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Put all options under one `if SETTINGS` block, so that `depends on
SETTINGS` does not need to be repeated every time.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Introduce an API mirroring the CMSIS-DSP's basicmath. If CMSIS_DSP is
enabled, then it will by default be used as a backend. Developers may
opt into a custom backend by setting CONFIG_DSP_BACKEND_CMSIS=n. If
done, the application must provide `zdsp_backend/dsp.h` and optionally
implement the functions in its own .c files.
Signed-off-by: Yuval Peress <peress@google.com>
This changes the minimal logging Kconfig to select printk rather
than imply it, this is because if someone turns printk off,
minimal footprint logging does not work, therefore it needs to be
a requirement.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Rather than exposing shell commands that take an opcode and
an optional parameter, the shell commands are now explicit
so that it is easier for a person to use the shell.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Generates XML file containing VIF policies by reading the device tree
using EDT.pickle generated during build
This script writes a subset of general and sink-pdo VIF policies in
output file
This script gets invoked during build if enabled through kconfig
The generated XML containing USB-C VIF policies could be used by
USB PD/Type-C analysers/testers to understand USB-C properties and
perform tests accordingly
Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
Add experimental CDC ACM implementation for new USB device stack.
It currently implements only UART IRQ API support and is WIP.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The device supprt brings support for multiple stack instances,
multiple configuration, asynchronous transfer model, ability to
change most of the properties of a device at runtime and
the composition of configuration and classes at runtime.
The stack requires new UDC driver API and is not compatible
with old driver API (usb_dc_). The classes (functions) of old
(current) USB device stack cannot be used with new ones and must
be ported.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The `audio connect` shell command did not really do
anything anymore, and has thus been removed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some of the unicast audio shell commands were guarded by
CONFIG_BT_AUDIO_UNICAST_CLIENT and only usable by the client.
This moves some of the commands to a CONFIG_BT_AUDIO_UNICAST
guard instead, so that they are usable for builds with just
the server.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes VCP Volume Renderer linker error that was seen if built
with VOCS and/or AICS support disabled.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This seems to have caused build failures in spite
of CI passing in PR 52653.
This reverts commit 0a02a4a2af.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Introduce the Kconfig symbol `NET_PKT_BUF_USER_DATA_SIZE`. It is used to
set the user data size in the buffers used in the rx and tx network buffer
pools.
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
This Kconfig setting was deprecated since
commit 8e99db5801 ("Kconfig: net: deprecate `NET_BUF_USER_DATA_LEN`")
and zephyr release 3.0.0.
This commit removes this deprecated and unused setting.
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
An LE controller shall no longer support HCI_Read_Local_Supported_Codecs
[v1] according to BT Core 5.3.
Command bit and support code removed.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Adding a bit-mask to the 'extra' data structure allowing passing info
re. active CIS's to the ull_conn_iso_done handling. Per CIS storing
an expiration time counter, monitoring in done handling. Adding
establishment timeout monitor in CIS Create procedure, completing
and ntf'ing accordingly.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
If a CIS is in teardown state, the data in structure should not be
trusted, so skip passing data to ISOAL
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Instead of storing the calculated reload value (in conn intervals) in
the conn object, now store the timeout value, and perform calculation
when used. This allows using the timeout value across all CIS's without
having to re-calc and store on change of TO
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
This allows putting the UART backend on a serial device that has to be
quiet unless logging is explicitly enabled at runtime.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Added a new Kconfig option for the Bluetooth Host to allow
unauthenticated pairing attempts made by the peer where an
unauthenticated bond already exists on other local identity.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Update the Bluetooth specific Kconfig legacy log template to use the new
log inheriting template.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Add a new Kconfig template that allow log modules to inherit their log
level from their parent module.
For example, the logs used in the Bluetooth audio like
`BT_AUDIO_STREAM_LOG_LEVEL` can inherit their level from
`BT_AUDIO_LOG_LEVEL`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Missing decode of conn_event_count on CIS_IND
Peripheral Suggest update to conn_event_count in case of a delayed
CIS_IND, allowing CIS peripheral more time to setup
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
The Bluetooth spec states that a K-frame exceeding the device's MPS
should trigger a disconnection of the channel.
Fixes two PTS tests that verify this behavior:
L2CAP/LE/CFC/BV-27-C
L2CAP/ECFC/BV-34-C
The current behavior is a silent truncation, which is not very nice for
the user, even if the spec would allow it.
Fixes#52228 and #51174.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Add mayfly locking around the access to the local pending procedure list
as it is accessed by both thread and mayfly.
Fixes#45427
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
When generating notification for Sleep clock accuracy, check for
success on rx_node allocation was left out. This is added.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
When MCC disconnected, it would memset the entire instance.
This causes issues, because the subscription parameters
would also be memset, causing the `notify` callback to
be set to NULL. If this was done as part of a disconnect,
the GATT layer would attempt to call the notify callback
as part of cleaning up the ACL, but if the callback was
set to NULL (from the memset) this caused a fatal error.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If LOG_PRINTK is used then the buffer size needs to be larger to
account for the additional header/footer output from the shell.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This change will enable the logging system to handle printk() calls by
default if printk support is enabled, which improves output resiliency
when logging, mcumgr and printk calls are used. Will disable keep
LOG_PRINTK disabled for tests which are not using the new API as
moving to LOG_PRINTK causes test data to be output to a different UART
in the old test system.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
When reporting a receive state to the upper layers, the broadcast
assistant should report NULL if there is not a receive state
active. The "activeness" of a receive state is determined by
the length of the characteristic - If it is 0 then there
is no receive state active.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some missing features for getting coverage data for unit tests:
- Setting the unit_testing board to have coverage support and native
application.
- Fixing the CONFIG_COVERAGE check
Signed-off-by: Yuval Peress <peress@google.com>
Remove the struct bt_vcp pointer from the volume
renderer API, as there is only ever a single
Volume Renderer instance on a device.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Split the `bt_vcp_cb` struct into separate structure for
the volume controller and the volume renderer.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The VCP server, known as the volume renderer, has a
more explicity bt_vcp_vol_rend API naming scheme now.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove the bt_vcp_vocs API as it did the same as the
bt_vocs API, and did not really any functionality.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The AICS functionality can be exercised using the
bt_aics API instead. These functions did very little
besides cluttering up the bt_vcp API.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Renames almost all occurences of VCS to VCP, as we want to
use the profile as the namespace for volume control.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rename vcs.h to vcp.h to better detail what the
file contains, as it is more than just VCS. This also
renames the Kconfig file.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The LoRaWAN subsystem uses the system work queue internally and needs
more than the default stack size of 1024 bytes. This is considered
in the sample application, but may be forgotten by out of tree users.
Enforcing it via Kconfig prevents users from accidentally getting
hard-to-debug stack overflows.
Signed-off-by: Martin Jäger <martin@libre.solar>
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been
removed. Files that were using them have been updated to use
`zephyr/logging/log.h` instead.
Those replacement have been done consequently:
- `/BT_DBG/LOG_DBG/`
- `/BT_ERR/LOG_ERR/`
- `/BT_WARN/LOG_WRN/`
- `/BT_INFO/LOG_INF/`
- `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/`
- `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/`
Also, some files were relying on the `common/log.h` include to include
`zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has
been added.
For files that were including `common/log.h` but not using any logs,
the include has been removed and not replaced.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Ensure that another established connection with the mesh device don't
mess up pb-gatt server state.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
When a remote devices establishes a ble connection with the mesh device
with default identity and there are more available connection slots, the
mesh stack will try to restart connectable advertisements (either
pb-gatt or proxy depending on the provisioning state). This makes
difficult for an application to advertise own connectable advertisements
as the mesh stack will not let a chance the app to start advertising.
This change adds a Kconfig option that limits number of connection slots
that the mesh stack can use for own connectable advertisements.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This fixes build error that happens when shell is built without CAP
Acceptor Set Member support. The cap_acceptor.c contains shell commands
for Set Member only, thus it's OK to build the code if
CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER is set for now. This can be modified
in the future when shell will be extended with other
Set Member non-specific CAP commands.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The compliance check did not like the otherwise valid
way of returning from read_set_sirk.
The code has been slightly refactored to avoid the check
failing in CI.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use the service instance struct instead of the more generic
`bt_csip` for the CSIP set member API.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use the bt_csip_set_coordinator_svc_inst struct in the
set coordinator implementation instead of the more
generic bt_csip.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modified the CSIP set coordinator slightly to not use the
bt_csip struct at all. For the use a void pointer works
equally well.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Renamed remaining structs and functions that are not
for the set coordinator to use the set member CSIP
role name.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Renamed the coordinated set implementation to use the
profile (CSIP) name instead of the service (CSIS) name, as
the former is more general.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When testing on qemu_x86_64 with e1000 Ethernet driver, there are
several crashes due to list management simultaneously executing on
different cores. Add mutexes similar to other parts on networking
stack, for example tcp_lock.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
As per RFC 2236 Section 9, the IGMP V2 membership reports should be sent
to the group multicast address being reported. Without this fix, when
IGMP snooping is enabled on a network a device is not able to receive
multicast from certain multicast addresses e.g. 239.255.x.x.
Fixes#52449
Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
Implement HCI commands HCI_Read_Connection_Accept_Timeout and
HCI_Write_Connection_Accept_Timeout, and enable the feature in
supported commands.
Remove hardcoded use of default accept timeout in new LLCP code, and
use configurable value instead.
This makes EBQ test /HCI/CIN/BV-03-C pass.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Updates the broadcast source API to create subgroups and
to set BIS specific codec configuration
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use CONTAINER_OF() macro to access outer backend-specific structure. This
removes the requirement to keep `struct settings_store` as the first item
in outer structure.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
LPN should send Poll\Sub Add\Sub Del only once.
Sending multiple times breaks polling time parameters
(Figure 3.17: Friendship timing parameters).
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Adjust skip value so that there is minimum of 6 events that can be
listened to before Sync_Timeout occurs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Currently there is inconsistency in repository file names, APIs, Kconfig
options and documentation around file / file-system backend for settings
storage, as both "file" and "FS (file system)" are used. As an example,
there is `CONFIG_SETTINGS_FS` Kconfig option, but the file that implements
this settings backend is called `settings_file.c`. Another example are
names of static functions that implement settings storage API:
`settings_file_load()`, `settings_file_save()` and
`settings_fs_storage_get()`.
This backend is actually storing all settings in a single file, so it makes
sense to use "File" as the name of backend, instead of a more general
"FS" (which would make sense if several files would be used to store
settings).
Fix inconsistency in used wording in the tree and unify it to "settings
file backend". This naming is more precise to how the implementation looks.
It will also make it easier to grep through the codebase and analyze
existing code.
Deprecate settings_mount_fs_backend() function and all Kconfig options
starting with `CONFIG_SETTINGS_FS`.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Allocation callback in net_buf_heap_cb and net_buf_var_cb
used for net_bufs with variable size payloads, defined by
NET_BUF_POOL_HEAP_DEFINE or NET_BUF_POOL_VAR_DEFINE,
allocate one more octet for internal variable ref_count,
used in function generic_data_ref(), which in turn is needed
for net_buf_clone()).
The user gets a buffer which is shifted by one octet in memory
block. This breaks alignment provided k_heap_alloc and k_malloc.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Renamed the dma-buf-alignment field to a more explicit
and descriptive name dma-buf-addr-alignment.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Add the local advertising address to bt_le_ext_adv_get_info.
This may help with debugging, but is also needed to
properly support something like the BAP Broadcast Assistant.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add CONFIG_CRC for building CRC related routines.
CRC routines are now being built for each application, whether used or
not and are add in the build system unconditionally.
Keep CONFIG_CRC enabled by default for now and until all users have
converted to use the new option.
Partial fix for #50654
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When switching between alternate settings of an interface, it is
currently possible to call set_endpoint() multiple times on an endpoint
without first calling reset_endpoint(). For these situations, it is
beneficial to track endpoints for which set_endpoint() has previously
been called, and then reset them to properly terminate any transfers,
and to return the HAL to the correct state
Signed-off-by: Milind Paranjpe <mparanjpe@yahoo.com>
Fixes accesses a renamed variable when a specific Kconfig is
active that would cause a compile error.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Ensure maximum size of common extended header format be
reserved when CONFIG_BT_CTLR_ADV_RESERVE_MAX=n is used so
that changes to ACAD, like channel map update does not need
frequent update to periodic advertising auxiliary channel
PDU time reservations.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When calculating the offsets between primary advertising
PDU, auxiliary PDU, Periodic Advertising PDU, and BIS PDU,
the values used as anchor points for starting the periodic
interval for auxiliary, periodic and BIG events, should be
ensured to have the minimum auxiliary frame spacing T_MAFS
between the PDUs. EVENT_OVERHEAD_START_US has to be reduced
as this value is used to offset the start of the radio
event on air.
Reverts commit b867f0e8a6 ("Bluetooth: Controller: Fix
T_MAFS between broadcasting roles").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Enable advertiser main to support relay messages, this maximizes
theutilization efficiency of advertising sets, which is helpful for the
sending of dense relays, but for Friend and LPN, it delays the sending
of local messages a little, this may cause the time slot deviation between
friend and lpn, and the power consumption of lpn will increase.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
For Mesh Message, should only process by model layer when dst
is unicast address of this nodes or model subscrip on.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit changes the way bonding between endpoints is processed.
There is no blind attempt to read the buffer without mbox notification.
On second side the notification is repeated multiple times until valid
bonding is detected.
Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
The default number of buffers (contexts) for locally initiated
procedures was 4. Per default the host initiates 3 procedures
when opening a connection, allowing the application to initiate
only 1 additional procedure in parallel.
This commit increases the default to 6, if auto phy-update and
dle is enabled, increasing the robustness for an application.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Remove Kconfig file samples/subsys/usb/usb_pid.Kconfig added in
the commit e5cbe6a9e7 ("usb: cdc: Add unique PIDs for each sample")
with the motivation to have a separate ID for each sample supposedly
to be recognizable by the host.
The new USB support does not use the options, VID/PID is set
directly in the application. As a note, it is not necessary to have
unique PID for each sample, especially for the well known USB classes.
Replace the individual Kconfig options in the documentation
by a table with the references to the samples and PIDs.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
mcc.c does not include `conn_internal.h` so it does not
know the `bt_conn` struct, causing logging issues when
trying to log a `bt_conn` pointer.
Fixed by casting the `conn` pointers to `(void *)`.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This aligns the conditional compilation logic with the one used for the
prototype in net_pkt.h, avoids build errors due to a undefined reference
to net_pkt_print_frags.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Use LOG_MESSAGE_QUEUE_SIZE config instead of hardcoded value.
LOG_MESSAGE_QUEUE_SIZE default value has been changed to 512, so
it is now matching to the hardcoded value.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
The bwPollTimeout name is somewhat confusing as it refers to minimum
polling period. The bwPollTImeout is essentially a mechanism allowing
device to ratelimit DFU_GETSTATUS requests from host.
Setting bwPollTimeout to relatively high values effectively slows down
DFU download process. The slowdown is not observed if the time between
DFU_DNLOAD and DFU_GETSTATUS is enough for the device to process the
write. That is, the bwPollTimeout does not effect DFU download if the
first DFU_GETSTATUS after DFU_DNLOAD reports dfuDNLOAD-IDLE state.
Otherwise the host must wait bwPollTimeout ms before issuing next
DFU_GETSTATUS, which slows the communicaiton to not more than 1 download
block (CONFIG_USB_REQUEST_BUFFER_SIZE) every bwPollTimeout ms.
The bwPollTimeout ideally should report an estimate how much longer the
download operation will take. Zephyr does not have such estimate and
therefore defaults to using fixed value. Reduce default bwPollTimeout
from 256 to 8 ms to allow significantly faster DFU downloads on devices
where the time between DFU_DNLOAD and DFU_GETSTATUS is too short to
process download block at the expense of unnecessary bus traffic if
processing download block takes longer than 8 ms.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Using a STD C++ library requires a toolchain-provided C library with
associated STD C++ library. Instead of using a dependency on !MINIMAL_LIBC,
select REQUIRES_FULL_LIBC so that the build will select a viable C library
rather than failing.
This allows all of the C++ tests to be run as a part of a standard twister
run. I expect this will uncover regressions in some of those which haven't
been run recently.
Signed-off-by: Keith Packard <keithp@keithp.com>
Moves the zephyr group ID defines to the mgmt header file as it is
with other group IDs and moves the zephyr basic group command IDs
to the the same header-location style as other groups.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This aligns the naming of files in fs_mgmt so that files and
functions relating to hash/checksum are prefixed with fs_mgmt.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Pass result of usb_transfer() as return value to the user,
and allow user to react accordingly, e.g. release net_buf on error.
Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
One of the notification callback functions did not properly
get the `read_params` pointer, causing an invalid result of
CONTAINER_OF as it would use a NULL pointer.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Call the RPA expired callback on advertising sets even when they are
not enabled.
The RPA expired callback will now be called on advertising sets
when the BT_ADV_RPA_VALID flag is cleared for the set.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix RPA timeout expiration when BT_EXT_ADV has been enabled.
Always invalidate the device RPA on RPA timeout.
This RPA is used by the scan roles, and the advertiser that was started
using the bt_le_adv_start API.
Call the RPA expire callback only on advertising sets that are enabled
and not being limited by a timeout and not using the identity address.
On RPA timeout always invalidate the RPA of advertising sets that are
disabled.
Fixes: #51208Fixes: #51228Fixes: #51247
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Add shell support for RPA expire callback.
This prints a message when the callback is called on the specific
advertising set.
Add a command to control the return value of this callback for a
specific advertising set.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Add a test that validates fetching every property from the sbs gauge driver
results in no driver error codes being returned.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Add a sample sbs gauge driver with feature parity and basic tests
comparison to its sensor counter-part. Includes a simple stub test that is
extended upon.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
net_pkt_get_frag() and a few other functions did not specify the
allocated fragment length, incorrectly assuming that fixed-sized
buffers are always used.
In order to make the function work properly also with variable-sized
buffers, extend the function argument list with minimum expected
fragment length parameter. This allows to use net_buf_alloc_len()
allocator in variable buffer length configuration, as well as verify if
the fixed-sized buffer is large enough to satisfy the requirements
otherwise.
Update the existing codebase to provide the expected fragment length,
based on the context.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The "net mem" command handler did not take the variable buffer length
configuration, and failed to build in such case.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case variable buffer length feature was enabled, net_pkt code did
not build due to unconditional references to CONFIG_NET_BUF_DATA_SIZE,
which is not avaialable in this configuration.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case variable buffer length feature was enabled, the TCP stack did
not build due to unconditional references to CONFIG_NET_BUF_DATA_SIZE,
which is not avaialable in this configuration.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case Echo Request did not carry timestamp (i. e. requested payload
size was smaller than 4), there won't be a timestamp in the reply
either. Such replies should not be ignored. Instead, simply skip the
turnround time calculation if timestamp is missing.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add -s parameter to the net ping command, allowing to specify the
payload size for the Echo Request.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Let net_icmpv4_send_echo_request() and net_icmpv6_send_echo_request()
autogenerate Echo Request payload, in case data length is specified but
no data pointer provided. The autogenerated payload includes timestamp
(if payload size permits) so that the turnround time can be calculated.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
- Add CIS Create policy config choices
- Implemented CIS Central in ULL following proposed setup/commit flow
- Full support for HCI_LE_Set_CIG_Parameters_Test
- Extend ull_conn_iso_start and ull_conn_iso_ticker_cb to handle
central role
- Partial support for HCI_LE_Set_CIG_Parameters. TODOs:
* Drop suggested retransmissions if Max_Transmission_Latency is
exceeded
* Calculate ISO interval based on policy
Signed-off-by: Morten Priess <mtpr@oticon.com>
Fix issues with referencing invalid netbuf data and add missing
parameter. Removed returning of handle in setup functions, as handles
are not available until commit.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Move ull_peripheral_iso_start ull_peripheral_iso_ticker_cb to
ull_conn_iso, to share code between CIS peripheral and central.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Local procedure for CIS central establishment. Calls yet unimplemented
functions in ull_central. Changes are guarded by
CONFIG_BT_CTLR_CENTRAL_ISO.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Add missing fields in structure containing the arguments used by
the host commands handlers and change the order of parameters
in macro used for defining the handlers.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
This commit increases the stack size for thread handling the host
commands requests. It was required due to the stack being
corrupted using earlier default size. The thread priority is now
configurable using the Kconfig.
It also adds alignment to the tx_buffer since the npcx MCU requires it
to work correctly and removes clearing the buffer before use due to
the hard time requirements. Tests checking if buffers are cleared
are also removed.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Move the header file to corresponding directory which refers to
submodule name instead of root of drivers directory.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
The commit moves MCUmgr SMP transport documentation from
subsys/mgmt/mcumgr/lib to doc/services/device_mgmt.
Documentation have been rewritten for that purpose.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit reworks mgmt/mcumgr subsystem source code to remove
lib subdirectory and make it a little bit more flat.
It also moves all API interface files, which are supposed to be
visible by applications using MCUMgr, to interface sub-directories,
and exposes them with full paths; for example to include general
MCUMgr support, group registration and so on, user would now include:
<mgmt/mcumgr/mgmt/mgmt.h>
to additionally have control on File System group management
registration user would need:
<mgmt/mcumgr/mgmt/grp/fs_mgmt.h>
All internal headers have been removed from interface.
CMAkeLists.txt get significant rework and various MCUMgr subsystems
have been divided into separate sub-libraries.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Replace the BT_CTLR_ADVANCED_SCHEDULING_CENTRAL_CONN_SPACING
Kconfig with BT_CTLR_CENTRAL_SPACING to configure the
the spacing from the beginning of a central connection event
to beginning of the next central connection when supporting
multiple simulataneous central connections.
If the BT_CTLR_CENTRAL_SPACING in microseconds is smaller
then the required time reservation for a connection event,
for given maximum data length and PHY in use, then the
calculated time reservation will be used as the spacing
between consecution central connection events.
The change fixes an issue wherein use of old Kconfig with
higher values causes new central connections to be placed
in between already connected central role if there was
free time space available to fit the new connections time
reservation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When application uses multiple identities mesh stack keeps reacting
on connection events not related to the own identity (BT_ID_DEFAULT)
causing it to trigger additional advertising and this leads to errors.
Though not harmful, this also leads to mesh stack counting connections
wrongly and consuming internal resources.
This commit fixes the issue described above by checking the
connection id before proceeding further.
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Explicitly set all bits of used radio registers when
configuring radio events, removing the dependency on having
the power-on reset value and removing the need to ensuring
power-on reset values being set in the radio peripheral.
This will ensure the Controller has radio register value
correctly configured irrespective of changes across SoCs'
radio register power-on reset values.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This reverts changes introduced in commit
dd535f611d, as they broke the gsm_ppp
driver integration with PPP L2. Apparently, a more thorough
refactoring is needed to use the new interface management scheme with
PPP.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
strcpy copies string including terminating null character.
strlen returns length without terminating null symbol.
If oob string is 16 bytes length then strcpy will corrupt byte
after auth array.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The sample in the Provisioning protocol spec chapter
is in big endian. Static OOB value should append
zeroes on the little endian platforms.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Rename the reg_read and reg_write functions in the emul_sbs_gauge emulator
to be more unique symbols so as to support overriding this specific
function in future tests that make use of FFF. See #46817 which includes a
test for error reads as an example.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
The SBS Gauge emulator would set the I2C buffer message with a value from
the emulator's custom read function even on a read error instead of just
returning. This behavior may be improperly relied upon by future tests.
Return early on register read before setting the i2c message buffer value
in the emulator.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
To facilitate testing improper reads and writes on various registers,
enable the emul_sbs_gauge reg_read/write handlers to return custom exit
codes.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Rename BASS to BAP Scan Delegator and BASS Client
to BAP Broadcast Assistant. This is the first step towards
integrating the BASS with the rest of BAP.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In file `subsys/bluetooth/mesh/net.c`:
renamed `loopback` to `net_loopback`.
In file `subsys/bluetooth/host/settings.c`:
Renamed `set` to `set_setting` and `commit` to `commit_settings`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Removes the global cur_mcs_inst and replace it
with lookup functionality.
This fixes an issue with bt_mcc_discover_mcs not being able
to be called more than once, as well
as streamline the implementation significantly.
This is also the first step towards not only supporting
multipe MCS instances for a single device, but also a
step towards handling multiple devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
It was possible that on re-connect, the MCC implementation
would receive notifications when cur_mcs_inst was NULL.
This is partially caused by a bug in gatt.c, but can
and should also be handled in MCC.
This commit ensures that we do not compare handles
on notifications with a NULL instance.
This commit also ensures that subscribe_mcs_char_func
is not called outside the context of the discovery
procedure by setting the subscribe callback
to NULL.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add zbus message bus as a Zephyr subsystem. No message bus
or communication abstraction other than the usual (message queues,
mailboxes, etc.) enabled developers to implement event-driven systems in
Zephyr quickly. Zbus would fill that gap by providing the community with
a lightweight and flexible message bus. The implementation tries to be
closest as possible to the existing ones. We use the claim/finish
approach, and the API for publishing and reading channels are similar
in message queues. Zbus is about channels, messages, and observers.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
If adv stop was called form connected callback,
it would continue and unref the wrong conn object
if there where 2 connectable advertisers running,
but with only one 1 id configured.
Fixes#52196
Signed-off-by: Martin Tverdal <martin.tverdal@nordicsemi.no>
Fix advertising set's is_enabled flag to be reset when
connection complete is dequeued for connectable advertising
started using legacy advertising enable HCI commands. And
reset the is_enabled flag when advertising set terminated
is dequeued for connectable advertising enabled using
Extended Advertising HCI commands.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticks difference calculation to determine delayed
prepare callback. Without the use of masking by
ticker_ticks_diff_get, the diff value can be higher than
the supported 24-bit value. i.e. ticker_ticks_now_get()
rolls over in 24-bit value, whereas ticks_at_event is
free running value of 32-bits.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit adds support for compiling in support for several different
regions/frequencies and dynamically choosing which to use in run-time.
This commit introduces no API breakages - if a prj.conf contains only a
single region Kconfig, the new function lorawan_set_region() does not
need to be called.
Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
Add long control PDU size support, also the implementation
now allocates control PDU size restricted to the supported
biggest control PDU that is enabled in the application
build. Features that are covered based on the increasing
control PDU sizes are ClearText connections, Encrypted
Connections, Connection Parameter Request support and
Create CIS control Procedure (Connected Central ISO)
support.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
After merging #51809, a few things were spotted that needed tweaking.
Among them:
- Rename the folder from bt_crypto to crypto, since the prefix is
unnecesary
- Remove the include folder
- Remove the path from the global include paths
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Incorrectly hash_checksum_mgmt_handler_fn has been referenced
in documentation for hash_checksum_mgmt_list_cb, causing
documentation generation error, because parameter list does
not match.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The heap size for serial dump of gcov data is currently
defined by MALLOC_MAX_HEAP_SIZE, which cannot be
adjusted by kconfig. This commit adds a new kconfig
option, CONFIG_COVERAGE_GCOV_HEAP_SIZE, which retains
the behavior or MALLOC_MAX_HEAP_SIZE by default.
Signed-off-by: Jason Wright <jwright@synchron.com>
Rounded up struct smp_bt_user_data takes 8 bytes; this fixes
static assert failing with message:
CONFIG_MCUMGR_BUF_USER_DATA_SIZE not large enough to fit Bluetooth
user data
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Switches to the new event callback system for the os_mgmt
functionality and removes the old code.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Switches to the new event callback system for the img_mgmt
functionality and removes the old code.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Switches to the new event callback system for the fs_mgmt
functionality and removes the old code.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds an access denied error code that can be used to signal to the
mcumgr client that the requested access to a specific resource or
command/functionality has been denied.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Reworks the event callback system to use a linked list to allow for
chained handlers and support passing a status back to the handler to
indicate if the request should be rejected or allowed. This also
removes the old base callback functionality.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a new mcumgr command for returning information on all supported
hash/checksum types that the firmware supports.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This fixes issues with the Bluetooth SMP transport whereby deadlocks
could arise from connection references being held in long-lasting
mcumgr command processing functions.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This replaces an intermediatory structure with a different one which
allows command functions to access the full contents of the streamer
structure that would be otherwise unavailable. This is a foundation
for allowing asynchronous mcumgr messages from the server.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
-- Handle time calculations across the point at which the controller's
time information from the controller's clock will wrap (in the
microsecond range)
-- Use wrapped time in all ISO-AL time calculations
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Add to the cryptographic toolbox the h8 function, defined in the Bluetooth
Core Vol. 6, part E 1.1.1.
Also add test and SMP self test for this function. The data used for those
are from the Bluetooth Core.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Move functions defined in the Cryptographic toolbox of the Bluetooth
specification inside their own files in the following folder:
`zephyr/subsys/bluetooth/bt_crypto`. The functions were previously
implemented in `zephyr/subsys/bluetooth/host/smp.c`.
The cryptographic toolbox functions can now be accessed from outside of the
host.
In addition to that, tests for each cryptographic toolbox functions have
been added.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>