There were two dereference after NULL check and logical dead code.
Fixes#22434Fixes#22443Fixes#22435
Coverity-CID: 207978
Coverity-CID: 207977
Coverity-CID: 207964
Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
Add Kconfig option TRACING_TEST which can be used to
customize tracing packet format (currently supporting
string format and data format) for testing purpose.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Add TRACING_ISR Kconfig to help high latency backend working well.
Currently the ISR tracing hook function is put at the begining and
ending of ISR wrapper, when there is ISR needed in the tracing path
(especially tracing backend), it will cause tracing buffer easily
be exhausted if async tracing method enabled. Also it will increase
system latency if all the ISRs are traced. So add TRACING_ISR to
enable/disable ISR tracing here. Later a filter out mechanism based
on irq number will be added.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
First, this commit adds user interface in tracing_format.h which
can trace both string format and data format packet.
Second, it adds method both for asynchronous and synchronous way.
For asynchronous method, tracing packet will be buffered in tracing
buffer first, tracing thread will output the stream data with the
help of tracing backend when tracing thread get scheduled.
Third, it adds UART and USB tracing backend for asynchronous
tracing method, and adds POSIX tracing backend for synchronous
tracing way.
Also it can receive command from host to dynamically enable and
disable tracing to have host capture tracing data conveniently.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
When is NET_SOCKETS_SOCKOPT_TLS set, it should set TLS_CREDENTIALS
even when NET_NATIVE=n, so that platforms that use socket offloading
can continue to set TLS credentials.
We are now setting this via 'imply' instead of 'select', so that
prj.conf can opt out if necessary.
Fixes#22390
Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
Refactor the handling of network nodes and their keys into a separate
Mesh Configuration Database (CDB). This, not only creates a separation
of the local node and the other nodes, but also makes it possible to
implement functions to manage the whole, or at least parts of the mesh
network.
Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
This API will be deprecated in favor of the new API that clearly
specifies whether it works on logical or physical levels.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Converts the sdhc spi driver to the new gpio api. Updates device trees
for the olimexino_stm32 and nrf52840_blip boards to set appropriate
active high/low polarity for the spi chip select pin.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Converts the usdhc driver to the new gpio api. Updates the
device tree for the mimxrt1050_evk board to set appropriate active
high/low polarity for the power and card detect pins.
Note that the driver doesn't actually support interrupts yet. It
initializes a gpio callback for the card detect pin, but never actually
enables the gpio interrupt. This incomplete behavior is left as-is,
since the purpose of this patch is only to convert the driver to the new
gpio api, not to add new features.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Some compilers can't resolve the conditional if/else/else construction
in ull_conn event_len_prep function, and fail with an 'uninitialized
variables' error. The change has no functional impact.
Signed-off-by: Morten Priess <mtpr@oticon.com>
For USB audio class interface may have alternate interfaces.
Those alternates may have different endpoint configurations.
When Standard Request SET_INTERFACE is served it choses between
alternate interfaces and configuring associated endpoints.
When switching between alternate interfaces, endpoints
associated with them must be disabled/enabled accordingly.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
BT_CTLR_SETTINGS should not depend on BT_SETTINGS as this will prevent
using settings system in the controller in a controller only build.
(BT_SETTINGS depends on BT_HCI_HOST)
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
The contentes of the function has been reduced with use of
sys_slist_append instead of sys_slist_insert.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit adds a new option CONFIG_BT_SMP_USB_HCI_CTLR_WORKAROUND
to support USB HCI controllers that sometimes send out-of-order HCI
events and ACL Data due to using different USB endpoints.
Enabling this option will make the master role not require the
encryption-change event to be received before accepting
key-distribution data.
It opens up for a potential vulnerability as the master cannot detect
if the keys are distributed over an encrypted link.
Fixes: #22086
Signed-off-by: François Delawarde <fnde@oticon.com>
Directed advertising timeout was dropped in the host due to
not being able to find a pending connection. Host used the
role parameter from the error event parameters which has
been earlier zero-ed out.
Regression introduced in commit a0349689ff ("Bluetooth:
host: Fix conn object assigned to wrong connection")
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When starting a non-connectable advertiser and an active scanner is also
using NRPA address then this use-case should be supported. A new
advertiser that is non-connectable should have a fresh NRPA address
every time it is started, so we must refresh the NRPA used by the active
scanner.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When advertiser is disabled we should update the random address for both
passive and active scanner back to an NRPA. But this command will fail
because the if the scanner is an active scanner, we must disable and
re-enabled the active scanner after setting the random address.
This behavior should not be there when scanner is configured to scan
with identity address.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Document why a privacy-disabled scanner will not notify about directed
advertising reports. This is the default behaviour of the
privacy-disabled scanner. In order to receive the reports the option
BT_SCAN_WITH_IDENTITY must be enabled.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Prevent the advertiser from overwriting the passive scanners identity
address when the scanner has been configured to scan using the identity.
In this case the LE Set Random Address command would not prevent the
address from being overwritten. So instead we explicitly stop it in the
host.
Also fix original code function not working at all since the first
if statement was should had a bad check. Resulting in it always
returning success.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Drop directed advertiser reports when the passive scanner should have
been using the NRPA address. The advertiser has overwritten the NRPA
with it's identity address instead and a peer is sending directed
advertiser packets to it.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When privacy is disabled by default the scanner still protects it's
identity with the use of NRPA addresses. We should not set the identity
address for the passive scanner unless the Kconfig option to scan with
the identity has been enabled.
This makes passive scanner behave the same way as an active scanner
since none of them will report directed advertising reports towards
the scanners identity.
This also enables the advertiser to switch out the random address which
is needed for the Bluetooth Mesh LPN case.
Fixes#22088.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Show current power management state in the list of devices, which is
helpful during PM debugging.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Function to put devices in lower power mode were all implemented in the
same way. Deduplicate code there by implementing single function to
handle all cases.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
There is no point to specify number of core devices explicitly, as it
can be done by compiler with ARRAY_SIZE() macro.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
We need a slightly bigger stack to be able to successfully pass the
logging test. Fix the stack size and enable back the test.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This construction was causing errors with recent gccs. If you look
carefully, it's generating the sequence:
simcall
mov a2, a2
mov a3, a3
...which is nonsensical. And now gcc is complaining about it with:
subsys/logging/log_backend_xtensa_sim.c:44:2:
error: invalid hard register usage between output operands
Just emit a single simcall instruction and let the assembly
constraints do their job.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Add pairing support callback to print remote pairing features when this
option is enabled.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Similar to pairing_confirm this callback is called each
time a peer requests pairing, but for all types of
pairings, except SSP. The pairing req/rsp information is
passed as a parameter so the application can decide
wheter to accept or reject the pairing.
Fixes: #21036
Signed-off-by: Martin Rieva <mrrv@demant.com>
In a combined build where bt_rand functions is implemented in the host
the RPA module should not use the bluetooth rand function since the RPA
module is common for host and controller.
Having the controller call the the host only to go through HCI back into
the controller would not be a good idea.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix infinite recursion in host-based bt_rand function. This would call
HCI LE Random Number command, which would in turn call bt_rand, causing
an infinite recursion.
bt_rand -> prng_reseed -> BT_HCI_OP_LE_RAND -> le_rand -> bt_rand
To solve this issue the controller should avoid doing calls into the
host, so all calls to bt_rand in the controller should be replaced with
a call to a controller function.
Fixes#22202
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Instead of using a custom offloading interface, users can use
`NET_SOCKET_REGISTER` macro to register custom socket API provider. This
solution removes a limitation, that only one offloaded interface can be
registered and that it cannot be used together with native IP stack.
The only exception remainig are DNS releated operations -
`getaddrinfo`/`freeaddrinfo`, which, when offloaded, have to be
registered specifically.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fix LE Create Connection command giving out of range parameters to the
controller, this came back as 0x30 (Out of Range Parameters) status code
on the command from the controller.
This appears to be the min and max CE parameters in the command.
Revert back memset from 137f704064
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix problem where application was notified about a new connection being
established, but no connection has actually been made.
This occurred because the LE Create Connection command failed directly
from the API, in which case the state transition thinks the err is valid
and always notifies the application.
Introduced by:
6c1f52dff7 for bt_conn_create_le
e9eebf0c40 for bt_conn_create_auto_le.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix an issue where a slot in the key pool was considered free when
either the address was cleared or no keys were written in the entry
(enc_size == 0). This caused a problem with simultaneous pairing
attempts that would be assigned the same entry.
This patch makes it so a a slot is considered free even when keys are
not yet present in the entry, and makes sure the address is cleared in
case of pairing failure or timeout so to mark the slot as free.
Signed-off-by: François Delawarde <fnde@oticon.com>
SW based privacy is an implementation detail in the zephyr link layers.
Therefore it should not be visible when selecting an out-of-tree
controller.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Since a peer MIC failure closes the event, it does not allow a terminate
acknowledge. For that reason a peer MIC fail for central role must force
a conn_cleanup.
Signed-off-by: Morten Priess <mtpr@oticon.com>