Add support for STOP_SENDING frame. This is sent to tell
peer to stop sending data to the stream.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Try to send 8kb buffer multiple times, make sure that there
are dropped packets and verify that all the data is received
correctly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
There's no need for bt_dev.random_addr to be a bt_addr_le_t, since the type
is always implicitly random. Change it to bt_addr_t and make the necessary
updates to the host code as well as host unit tests.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Currently, TRACING_BACKEND_UART depends on UART_CONSOLE. This is overly
restrictive because the UART tracing backend relies entirely on the
generic UART driver APIs and does not utilize console subsystem.
Signed-off-by: Jedrzej Czykier <jczykier@antmicro.com>
This commit removes the initialization check on every sys_csrand_get() and
the lazy initialization of the psa crypto on the first call to
sys_csrand_get().
The psa initialization is assumed to be performed prior to the first
call to sys_csrand_get().
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
Ifdef the AAR/CCM/ECB DMA related code based on the HAL macro which tells
if the new EVDMA is present in the device, instead of particular devices,
so we do not need to ifdef on several devices as new devices are added
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
native_tap only queued TX timestamp callbacks for gPTP packets, which
left PTP SO_TIMESTAMPING socket traffic without TX timestamps.
Add host-clock packet timestamp updates in native_tap TX/RX paths, queue
TX timestamp callbacks when net_pkt_is_tx_timestamping() is set (while
preserving gPTP behavior without double-queueing), and propagate
SO_TIMESTAMPING TX/RX flags for AF_PACKET packets in net_context.
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Add Layer-2 (EtherType 0x88F7) transport support and the PTP stack
updates needed for L2 operation.
Use recvmsg() RX timestamping on IEEE 802.3 sockets and fall back to
recvfrom() when ancillary timestamp data is unavailable, retrying
recvmsg() later so L2 reception keeps working across runtime and driver
limitations. Register Delay_Req TX timestamp handling for both UDP and
L2 paths and suppress expected UDP parse warnings while L2 is enabled.
Also wake the PTP worker when pollfd or state-decision changes require
it, and clear pending Sync, Delay_Req, and foreign clock state when a
port is disabled so stale state is not carried across reopen or link
transitions.
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Timestamp callbacks can unregister themselves or other callbacks while
net_if_call_timestamp_cb() is iterating the callback list. That path
runs under the timestamp callback lock, so immediate unregister can
re-enter the same lock and stall the TX timestamp thread.
Handle unregister requests from the dispatch thread by marking callbacks
inactive, skip inactive entries during iteration, and prune them after
dispatch completes.
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Use NET_CMSG_SPACE() when checking ancillary buffer capacity and
account for aligned cmsg storage in msg_controllen.
This keeps recvmsg() control-data handling consistent with cmsghdr
layout and avoids under-reporting consumed control-buffer space.
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Implement AF_PACKET recvmsg() support and deliver ancillary
SO_TIMESTAMPING data to packet socket users.
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Store the first foreign Announce and compare it against the previous entry.
Fix the BTCA receiver-port tie-break to avoid false role decisions.
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Re-add __ASSERT_NO_MSG in bt_uuid_to_uuid() for invalid UUID types.
This was removed in commit 9906fdb to work around a pre-existing ASCS
memcpy bug that has since been fixed.
Add return value checking for all snprintk() calls in bt_uuid_to_str()
per Zephyr coding guidelines. Since the function returns void and uuid.c
has no logging, __ASSERT_NO_MSG is used to catch encoding errors in
debug builds while preserving the existing silent-truncation behavior.
Follow-up from: https://github.com/zephyrproject-rtos/zephyr/pull/103817
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
The valid_conn_cte_tx_params() function checked BT_DF_CTE_TYPE_AOD_1US
twice instead of checking both BT_DF_CTE_TYPE_AOD_1US and
BT_DF_CTE_TYPE_AOD_2US. This allowed AoD 2US to bypass the antenna
switch pattern validation in the host.
The controller also validates these parameters, so the impact is
limited to a missing defense-in-depth check in the host layer.
Signed-off-by: Andre Viegas <andreviegas@piscodeluz.org>
Assisted-by: Claude:claude-opus-4.6 ForgeQL
Add the EU868 region implementation for the native LoRaWAN backend.
Gate regions not yet implemented in the native backend behind depends on
!LORA_MODULE_BACKEND_NATIVE so they cannot be selected.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add a native LoRaWAN 1.0.x Class A implementation that talks directly to
the LoRa radio driver, replacing the Semtech loramac-node dependency.
The backend provides:
- OTAA join (Join Request / Join Accept)
- Unconfirmed and confirmed uplinks with Class A downlink reception
- AES-128 cryptography via PSA Crypto (CMAC for MIC, ECB for payload
and join-accept encryption)
- Region operations interface for channel plans, datarate tables,
RX window parameters, and duty cycle enforcement
- Asynchronous engine thread that serializes MAC operations
- Full downlink dispatch with deferred callbacks on the system
workqueue to avoid deadlocking the engine thread
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Enclose default LLEXT heap section placements with
!CONFIG_LLEXT_CUSTOM_HEAP_PLACEMENT. Users who want to
write a custom linker script can include files like
snippets-noinit.ld, common-noinit.ld or the SOC linker
scripts without including the default LLEXT heap
section placements.
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
Moved the TCP header validation in tcp_recv() before the connection
lookup to prevent processing malformed packets and improve efficiency.
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
Inverted the condition in tcp_input() to correctly process
valid packets and drop invalid ones.
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
Reduce scope of restriction that
CONFIG_LLEXT_HEAP_MEMBLK_BLOCK_SIZE be a multiple
of LLEXT_PAGE_SIZE to apply only when CONFIG_MMU
or CONFIG_MPU are enabled.
Referring to llext_copy_region in llext_mem.c, we
see that allocations only need to be sized / aligned
to LLEXT_PAGE_SIZE when MMU or MPU is enabled.
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
Add an optional function to connectivity bindings that communicates
whether the binding has the configuration it needs in order to attempt
a connection. This is then used by the connectivity API for
non-persistent interfaces to determine whether it makes sense for the
interface to be powered up.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Move header for IEEE 802.15.4-2020 constants from subsystem
location to common for usage by 15.4 radio device drivers.
Signed-off-by: David Boullie <David.Boullie@silabs.com>
shell_vfprintf can block on k_event_wait when the TX ring buffer is full.
Calling it from a non-yieldable context (ISR, spinlock, pre-kernel)
causes a deadlock.
Add a k_can_yield() check in shell_vfprintf as both an assert for debug
builds and a runtime guard that silently drops the output when called
from a context that cannot yield, preventing the deadlock regardless
of whether asserts are enabled.
Fixes: #103954
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
For a busy wait needed only for simulation we can use the Z_SPIN_DELAY
macro which is more compact and does nothing in real targets.
For the ecb test, we do not need to treat simulated HW differently than
real HW.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
For P2P connect set frequency default value as 0.
Let wpa_supplicant choose channel. User can override with -f option.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
When a client subscribes to Service Changed CCC before bonding
and privacy is enabled, the SC config is initially stored under
the peer's RPA. On reconnection with a new RPA, sc_restore()
looks up the config by identity address and fails to find it,
so the SC indication is never delivered.
Re-key the SC config entry from the RPA to the resolved identity
address in bt_gatt_identity_resolved(), matching the existing
re-keying logic for CCC and CF configs in the same callback.
If a separate entry already exists under the identity address,
merge the attribute handle ranges and remove the duplicate.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Co-authored-by: Einar Thorsrud <einar.thorsrud@nordicsemi.no>
Adds an assert to the `update_range` function in gatt.c to verify
that the start handle is not larger than the end handle.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Modify the behavior of update_recv_state_big_cleared to follow
what the current BASS test specification and PTS expects to pass
test cases related to bad broadcast codes. There are open
errata for this behavior to properly define it, but until then
we should follow what the qualification tests expect.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
At some point CONFIG_LOG_FRONTEND_STMESP_EARLY_BUF_SIZE default value
was set to 0 on cpuapp. It meant that log entries which happend before
STM and Coresight initialization were lost. Add buffer which is used
to store those logs.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Add input validation for PSK and SAE password length in wifi_ap_enable().
Invalid lengths could trigger driver-side assertions during AP startup.
Return -EINVAL when parameters are out of range instead of letting the
AP enable flow proceed.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Add validation to ensure the indicator index is within the valid range
of the ind_table array before accessing it in cind_handle_values().
Without this check, an out-of-bounds index could lead to buffer overrun
when the index is used to access hf->ind_table array elements later in
the function.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
To ensure correctness and to avoid any race conditions,
atomic_test_and_set_bit should be use instead of a atomic_test_bit
followed by an atomic_set_bit.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
add_bonded_addr_to_client_list returned after adding the address of
`info->addr` once, which mean that only the first svc_inst got updated
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Before config flags were introduced to `bt_keys`, the `keys_set`
allowed loading previously stored keys after disabling support for
Bluetooth LE legacy pairing or signing during DFU (only beginning of the
settings record was used after the DFU).
Introducing version field prevents from loading keys in this scenario.
Settings records that contain extra data are not migrated to the new
format during the settings load operation and eventually are cleared.
Change allows to automatically migrate `bt_keys` stored with extra data
to the new format in the most common scenario where both legacy pairing
and signing support are disabled. This allows to still properly load and
use the keys.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Improve error handling for L2CAP BR/EDR signaling buffer allocation
failures by introducing a fallback mechanism and proper cleanup paths.
Add l2cap_br_create_pdu() helper function that attempts to allocate
from the specified pool with a timeout, and falls back to the default
pool if allocation fails. This prevents system hangs when the BR/EDR
signaling buffer pool is exhausted.
Update all bt_l2cap_create_pdu() call sites to use the new helper with
appropriate timeouts (K_FOREVER for requests, specific timeouts for
responses). Add error handling to properly disconnect channels or clean
up resources when buffer allocation fails.
Introduce l2cap_br_chan_disconn() helper to centralize channel
disconnection logic, ensuring proper cleanup when disconnect requests
cannot be sent.
Change br_sig_pool user data size from hardcoded 8 bytes to
CONFIG_BT_CONN_TX_USER_DATA_SIZE for consistency with other buffer
pools.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
When an ISO channel is established, we now log all the
information we receive from the controller for that
specific channel.
This can be useful in debugging and determining certain
behaviors.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The HAL has now a function to set the each GRTC group interrupt mask
Let's use it, fixing this old FIXME.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Fixed issue where an aborted CAP commander procedure would
never get past bt_cap_common_proc_all_handled and thus never
call the callback with an error, e.g. if the remote CAP
Acceptor rejects a request.
The fix required a significant refactor of the broadcast
part of the CAP commander, as it was fundamentally flawed.
The biggest change is that the implementation now uses both
the receive state notification as well as the write responses
to determine completeneess. Additionally, it also handles
notifications not initiated from our write requests, i.e.
it is now more similar to an event based procedure rather
than a linear one. This also means that when the callbacks
for the start and stop procedures are now called, we have
receive the events (notifications) from the remote CAP
acceptors that they are actually synced (or not synced) to
the broadcasts.
Since the broadcast reception start and stop now waits
for the receive state to be updated, a change in the
Handover implementation was also done.
To test the solution 2 new test cases were added,
and the existing tests were modified to allow for the
new expected behavior.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the http client, the body of 5xx was skipped, leading to a parse error
in the http parser when it reaches the body.
Signed-off-by: Arthur Gay <arthur.gay@marshmallow.kids>