If there are no sockets in the system, then do not drop the
packet immediately as there can be other L2 network handlers
like gPTP in the system. This will also allow ICMP messages
to pass to local handler.
Fixes#34865
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Coverity detected that a zero divisor can be passed to
ll_create_connection() without parameter sanitization. Conditionally
check the connection creation parameters according to spec.
Fixes#35343.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
On sending write request we should check write response.
If data prepaired to be written by peer or offset are not equal
to the data and offset we sent, we shall send Execute Write
Request with Request Flag set to 0x00 (Cancel All Prepared Writes).
This was affecting GATT/CL/GAW/BI-32-C and GATT/CL/GAW/BI-37-C
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Fix the missing HCI event data len limit check when encoding
incomplete advertising data report.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Max data length has to be adjusted for subevent code, otherwise we'll
hit an assert when trying to add data to event due to insufficient
free space.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Enable the option to pause the fallback hardware watchdog if the MCU is
halted by a debugger.
This fixes issue #33509 where some boards with Nordic MCUs could not be
flashed anymore after using the task watchdog sample.
Signed-off-by: Martin Jäger <martin@libre.solar>
The resource description on the OMA LwM2M registry states that only the
first instance of a particular error should trigger creation of a new
error code instance.
Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
The hardware watchdog was always fed with channel ID 0. This is correct
in most cases, but we should still use the actual ID returned from
wdt_install_timeout.
Signed-off-by: Martin Jäger <martin@libre.solar>
As EVENT_OVERHEAD_START_US offset is used in ticks unit in
LLL, ULL scheduling using ticker should also use ticks unit
for EVENT_OVERHEAD_START_US when reducing the first
connection event preparation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Revert the strict preempt ticker start failure check.
Preempt ticker start can fail when enqueuing prepares into
already filled pipeline which has preempt ticker already
started for the first prepare that was added in the
pipeline.
Regression introduced in commit 5b75bdf589 ("Bluetooth:
controller: nRF5: Check preempt event on timeout").
Fixes#35476.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
From le_ext_adv_param_set we will occasionally attempt
to call bt_addr_copy where the `addr` and &adv->random_addr.a
are the same pointer. Doing a memcpy where source and destination
is the same pointer is undefined behavior and should not be
done.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The VCS client shell was never compiled before, and thus
the implementation had a few undetected errors.
This commit adds the VCS client to the shell CMakelists
as well as fixing the issues.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The common API functions in VCS had dead code in specific
configurations, causing coverity issues. Fixed by this
commit.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix side effect in assertion when checking a volatile
variable inside assert check.
Fixes#32904, #32923.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The send_reliable function was reused in multiple places as part of the
k_delayed_work changes for Bluetooth Mesh in #33782. This function
contains a line that resets the start timer, causing prov_retransmit to
continously move the goal post for when to give up sending.
Extract this line out of the send_reliable function, and put it along
with the other link.tx initialization in bearer_ctl_send and
prov_send_adv.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Change the return value from -ENOTCONN to -EINVAL as that
is a more appropriate return value for checking a NULL
pointer.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Change from -ENOTCONN to -EINVAL as that is a more appropriate
return value for checking a NULL pointer.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of return -ENOTCONN they will now return -EINVAL as
that is a more appropriate return value for checking if
the pointer is NULL.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When application calls TCP connect(), the call is blocked
by a semaphore which is then released when the connection
is established. Unfortunately the semaphore release was done
before the connection was marked as established. Depending
on the configuration options set, it is possible that after
the semaphore release, the thread that is waiting on connect()
is run immediately. Because of this, the connection bookeeping
still thought that the connection was not established even if
it was. A simple solution is to release the semaphore after
the connection is marked as established.
Fixes#35390
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit fixes a bug where outdated RPL entries might not be removed
properly from the persistent storage making those entries dead.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
According to Bluetooth core specification v5.2, if Host set
random address when any of scanning (passive or active), the
Controller shall return the error code Command Disallowed (0x0C).
Signed-off-by: Freddie Yang <freddie.yang325@outlook.com>
Allow time for the shell to successfully echo the reboot command input
before the reboot abruptly terminates it. n This can help external
systems that interact with the shell and require the reboot command's
echo to successfully complete to synchronise with the device.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/35325
Signed-off-by: Nick Ward <nick.ward@setec.com.au>
Call on_status if the Reason-Phrase is not provided.
This allows for the numeric status code to be set.
Also, ensure the numeric status code is always set
in on_status, not just if the specific callback is set.
Signed-off-by: Justin Morton <justin.morton@nordicsemi.no>
Without TX thread support in network stack USB device stack
blocks it self by usb_transfer_sync() which is
called in the same context as usb_set_interface() in sequence
of netusb_enable(), net_if_up(), net_l2_send().
Fixes: #35338
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit fixes a bug where incorrect pointer passed to publish_sent
in access.c caused bus fault.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The testsuite was always forcing minimal logging. This is problematic
as it does not allow user to see full logging string. Allow user to
override the minimal logging if needed, the default is still to
enable minimal logging.
[DL: Commit 7f08061f0c reverts this.
Since this is useful, let's re-apply this.]
Fixes#34696
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The network layer previously decided to use the friend credentials if
there was an established friendship. During the friendship setup phase,
the friendship is not considered established until the LPN receives the
first friend poll. Before this happens, the LPN should send a friend
poll message, encrypted with the friendship credentials. This wrongly
gets encrypted with the master credentials.
Change the decision point to whether the LPN has selected a friend,
which happens after the friend offer, and before the friend poll. This
will remain set for the duration of the friendship.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
This adds BT_MESH_SETTINGS_VA_PENDING to GENERIC_PENDING_BITS
as it should be stored by CONFIG_BT_MESH_STORE_TIMEOUT.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This bug was introduced in PR #31176, where setting's flags were
moved out from bt_mesh.flags to pending_flags.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This was already implemented for firmware update packages.
For other opaque resources it failed to determine the target resource
id, which is now stored in the block_context.
Signed-off-by: Jan Buenker <jan.buenker@grandcentrix.net>
Fix regression in PPIs use for nRF52805 SoC, which has
fewer of them. And the regression was introduced in
commit e603b9d59e ("Bluetooth: controller: Adjust PPI
used for nRF51x and nRF52x").
Fixes#35204.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Increase the default thread analyzer stack size. On ARM systems the
stack usage is higher with CONFIG_FPU enabled.
The default of 512 is not enough in this case and lead to stack
overflow.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When shell log backend was disabled fifo used only in
deferred mode was unconditionally flushed which lead to
errors in immediate mode where fifo was not present. On
the other hand, in case of LOG2_MODE_DEFERRED fifo (mpsc_pbuf)
was initialized in enable stage.
In order to clean things up, deferred v1 fifo flushing and
deferred v2 mpsc pbuf initialization were moved to fifo_reset
function which is called when shell log backend is enabled.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
OpenThread shell tries to execute commands without checking
if the shell has already been initialized. As a result, we
may hit an assertion in the OpenThread CLI code. It's
particularly painful in automated tests which spawn commands
very early in the firmware boot process.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>