Commit graph

24,075 commits

Author SHA1 Message Date
Jeppe Odgaard
4e87e9e9a2 debug: coredump: coredump_backend_flash: check data_read
process_stored_dump() uses data_read() without checking the return value.
The function then uses a potentially uninitialized hdr variable.

Check data_read() return value and return the value if negative.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2026-04-23 13:12:13 -04:00
Jordan Yates
f97bb71f9c modem: ppp: detect "NO CARRIER" event
DTE's can unconditionally emit a `NO CARRIER` event on the DLCI which
indicates that the channel has moved back into the command state. This
functionally means the PPP link is dead, as no more valid data will ever
be received on the channel.

Add the logic to detect this event in `modem_ppp`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-04-23 13:11:42 -04:00
Jordan Yates
c00c3a1a40 modem: ppp: reset frame state on attach
Reset the receive frame state on pipe attach, and re-attach the pipe
before each PPP test to ensure a clean state.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-04-23 13:11:42 -04:00
Daniel Leung
1673509a3c demand_paging: move under subsys/mem_mgmt
Move subsys/demand_paging/ to subsys/mem_mgmt/demand_paging/ to
better reflect that demand paging is a memory management feature.

Also replacing source with rsource in Kconfig so top location
no longer matters.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2026-04-23 13:11:23 -04:00
Martin Stumpf
b00f4a1e28 mcumgr: serial: fix tx frame size
The `max_input` variable gets reduced by 3 bytes to make room for the
size header in the first frame; it does not however get reset to its
previous value in the following frame, which permanently reduces
the frame size by three bytes.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2026-04-23 08:16:34 -04:00
Emil Gydesen
db877f469f Bluetooth: CAP: Commander: Remove debug LOG_ERRs
Some LOG_ERRs from debugging was accidentally merged.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-04-23 07:11:07 -04:00
Jordan Yates
6869768411 net: sockets: fix NET_SOCKETS_ENABLE_DTLS dependency
`MBEDTLS_SSL_PROTO_DTLS` depends on `MBEDTLS_SSL_PROTO_TLS1_2`, so if
we are selecting the former, we must also select the later.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-04-23 07:10:35 -04:00
Adam Szewczyk
620480f617 net: dns: resolve: avoid timeout-bound alloc in cancel helper
Cancellation can run on timeout paths where a context-based buffer
allocation timeout can expire immediately.

- allocate the temporary packed-name net_buf with K_FOREVER
- keep existing ENOMEM handling for pool exhaustion

Assisted-by: Codex:gpt-5.3-codex
Signed-off-by: Adam Szewczyk <a.szewczyk@cthings.co>
2026-04-23 07:09:52 -04:00
Adam Szewczyk
c924e5c47d net: sockets: getaddrinfo: map -EAGAIN to DNS_EAI_AGAIN
Treat resolver-side -EAGAIN as a temporary DNS condition and return
DNS_EAI_AGAIN instead of DNS_EAI_SYSTEM so callers can handle retries
consistently.

Assisted-by: Codex:gpt-5.3-Codex
Signed-off-by: Adam Szewczyk <a.szewczyk@cthings.co>
2026-04-23 07:09:52 -04:00
Adam Szewczyk
cd27da58ee net: sockets: getaddrinfo: cancel timed-out DNS query before retry
Cancel each timed-out DNS request before retrying and reset the local
semaphore state between attempts. This prevents stale delayed callbacks
from touching stack-backed getaddrinfo state after timeout progression.

Assisted-by: Codex:gpt-5.3-Codex
Signed-off-by: Adam Szewczyk <a.szewczyk@cthings.co>
2026-04-23 07:09:52 -04:00
Johan Hedberg
be40f4440a Bluetooth: Host: shell: Add error handling for scan command parsing
Handle errors resulting from string to integer conversions.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-23 07:07:51 -04:00
Johan Hedberg
fa9155c4fe Bluetooth: Host: shell: Fix scan timeout parameter behaviour
The scan parameter is in units of 10ms in the Zephyr API, however the same
value was being treated differently for active and passive scanning. For
passive scanning the value got passed to the timeout as 10ms units, however
with active scanning it was treated as seconds by passing it to the
K_SECONDS() macro. Fix this by treating it as 10ms units in both cases.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-23 07:07:51 -04:00
Johan Hedberg
01e73e67cf Bluetooth: Host: shell: Add scan interval and window options
Add --interval and --window options to the scan command.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-23 07:07:51 -04:00
Johan Hedberg
6a7c726903 Bluetooth: Host: shell: Use getopt for scan command
Convert the scan command parameters to use getopt. While we're at it, get
rid of the confusing "dups" "nodups" options which actually behaved in the
inverse to their names ("nodups" would give you duplicate results while
"dups" would not). The new parameter is called the same as in the Zephyr
API and HCI, namely --filter-dups.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-23 07:07:51 -04:00
Johan Hedberg
e7cd3fe50f Bluetooth: Host: shell: Allow specifying advertising interval
Add support for specifying the exact advertising interval for the
"advertise" shell command. The new support is done with the help of
getopt, and since this is the first user of it in the Bluetooth shell the
appropriate select statement is added in Kconfig.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-23 07:07:51 -04:00
Can Wang
31a3544f64 Bluetooth: shell: add MAP shell support
Add Message Access Profile (MAP) shell command support to the
Bluetooth shell module.

Add map.c to the CMakeLists.txt build configuration when
CONFIG_BT_MAP is enabled, allowing MAP shell commands to be
compiled into the shell module.

Enable MAP configuration options in the Bluetooth shell test
configuration, including both MCE (Messaging Client Equipment)
and MSE (Messaging Server Equipment) functionality.

This enables testing and demonstration of MAP profile features
through the Bluetooth shell interface.

Signed-off-by: Can Wang <can.wang@nxp.com>
2026-04-23 07:06:09 -04:00
Can Wang
e438048f88 Bluetooth: MAP: add Message Access Profile support
Add source files and Kconfig options for Bluetooth Message Access
Profile (MAP) support.

MAP enables remote access to messages stored on a Messaging Server
Equipment (MSE) device from a Messaging Client Equipment (MCE) device.
The profile supports browsing folder hierarchies, listing messages,
retrieving message content, sending messages, and receiving event
notifications.

Add Kconfig options to enable MAP profile with separate options for
MCE and MSE functions.

Add logging configuration for MAP module.

Signed-off-by: Can Wang <can.wang@nxp.com>
2026-04-23 07:06:09 -04:00
Håvard Reierstad
bba9438df5 Bluetooth: shell: consistent gatt vendor read
Remove casting of the attr->user_data for short vendor value and
instead directly use the defined `vnd_value`.

Use the same defined max length for the long_vnd functions, instead
of the sizeof operator on one of the arrays.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2026-04-22 19:19:11 +02:00
Guy Shilman
5a13238bbf CRC: Fix hardware crc16 using wrong poly
Fix issue with hardware `crc16()` calculation using the hardcoded value of
CRC16_POLY instead of the user's argument.

Signed-off-by: Guy Shilman <shilmanguy@gmail.com>
2026-04-22 10:05:06 +02:00
Cheng Chang
361c0f7667 Bluetooth: Classic: Add PBAP (Phone Book Access Profile) support
Add Phone Book Access Profile (PBAP) implementation for Bluetooth Classic,
supporting both Phone Book Client Equipment (PCE) and Phone Book Server
Equipment (PSE) roles.

PBAP enables remote access to phone book data stored on a device,
allowing clients to retrieve contact information, call history, and
other phonebook-related data.

Key features:
- PCE (client) and PSE (server) role support
- RFCOMM and L2CAP transport layer support
- Pull phone book, vCard listing, and vCard entry operations
- Set phone book navigation (up/down/root)
- Abort operation support
- OBEX authentication (challenge-response with MD5)
- Application parameters for filtering and formatting
- SDP service registration and discovery
- Single Response Mode (SRM) support for GOEP v2
- Configurable PSE features (download, browsing, database identifier,
  folder version counters, vCard selector, enhanced missed calls, etc.)
- Configurable PSE repositories (local phonebook, SIM, speed dial,
  favorites)

The implementation includes:
- Core PBAP protocol handling (subsys/bluetooth/host/classic/pbap.c)
- Public API header (include/zephyr/bluetooth/classic/pbap.h)
- Internal definitions (subsys/bluetooth/host/classic/pbap_internal.h)
- Shell commands for testing and demonstration
  (subsys/bluetooth/host/classic/shell/pbap.c)
- Comprehensive shell documentation with usage examples
  (doc/connectivity/bluetooth/shell/classic/pbap.rst)
- Kconfig options for feature and repository configuration
- Build system integration (CMakeLists.txt)
- Logging support

Authentication uses PSA Crypto API (MD5) for nonce generation and
response digest calculation.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2026-04-22 10:01:28 +02:00
Roman Leonov
12d918f38b usb: host: shell: use SHELL_HELP() macro
Use SHELL_HELP() macro in USB host shell support.

Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
2026-04-21 18:40:49 -04:00
Pragati Garg
0d8783ac0f net: posix: fix hostname config conflict with unique updates
Decouple NET_HOSTNAME_MAX_LEN from NET_HOSTNAME_DYNAMIC to resolve
Kconfig conflict when using POSIX networking with unique hostname
updates. This restores functionality that worked in Zephyr 3.6.

- Remove forced selection of NET_HOSTNAME_DYNAMIC from POSIX_NETWORKING
- Make NET_HOSTNAME_MAX_LEN available independently
- Add build assertions for hostname length validation
- Update test configurations for new dependency structure

Fixes: zephyrproject-rtos#95811
Signed-off-by: Pragati Garg <pragatigarg@eaton.com>
2026-04-21 18:39:36 -04:00
Jukka Rissanen
59dc905e80 net: quic: Allow user to delete a CA cert chain
Add ZSOCK_QUIC_SO_CERT_CHAIN_DEL socket option that can be used
to delete the CA cert chain from the connection socket.
Add a test to verify that the deletion works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
1add7f3613 net: quic: Use sec_tag_t types when user imports a CA cert chain
Change the code so that user does not set intermediate cert chain
directly by ZSOCK_QUIC_SO_CERT_CHAIN_ADD, but the setsockopt() is
given a sec_tag_t type value. Then when building the certificate
message, we resolve the actual cert from certificate storage using
the given security tag value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
cb2a94c56a net: quic: Add STOP_SENDING support
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>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
340b01b13e net: quic: Add STREAMS_BLOCKED handling
The STREAMS_BLOCKED handling was missing functionality to
send MAX_STREAMS back to peer.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
db59cf8e2a tests: net: quic: Add tests to send longer packets
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>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
753d0163e2 net: quic: Add support for loss detection and congestion control
The loss detection and congestion control are described in RFC 9002.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
0e2014fdb1 net: shell: quic: Add Quic statistics support
Show Quic statistics if enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
03543f9696 net: quic: Add statistics support
Collect Quic statistics if network statistics is enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
910f5dad8b net: quic: shell: Add Quic shell support
Add commands to net-shell to view Quic connections information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
ad05142895 tests: net: quic: Add tests
Initial tests for QUIC.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Jukka Rissanen
49b4ac35d3 net: quic: Initial commit
QUIC is described in RFC 9000. It is UDP based transport
used for example in HTTP/3.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-04-21 17:48:04 +01:00
Johan Hedberg
23099b621b Bluetooth: Host: Fix type of bt_dev.random_addr
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>
2026-04-21 17:45:36 +01:00
Johan Hedberg
e27274e39c Bluetooth: Host: Take advantage of bt_addr_le_copy_addr()
Use the new bt_addr_le_copy_addr() helper where appropriate.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-21 17:45:36 +01:00
Jedrzej Czykier
2ad8645dac tracing: relax TRACING_BACKEND_UART dependency to SERIAL
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>
2026-04-21 10:19:05 +01:00
Måns Ansgariusson
7fe09638c4 random: psa: Remove initialization check from sys_csrand_get()
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>
2026-04-20 17:53:09 -05:00
Alberto Escolar Piedras
5a328a1411 Bluetooth: Controller: nordic: ifdef EVDMA code on better macro
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>
2026-04-20 13:22:50 +02:00
Jamie McCrae
9da5c07615 mgmt: mcumgr: grp: img_mgmt: Fix non-progressive swap offset erase
Fixes not erasing the first sector when using swap using offset mode

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-20 13:22:14 +02:00
Philipp Steiner
a7cdc70c64 net: fix PTP TX timestamping on native_tap and AF_PACKET
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>
2026-04-20 13:22:07 +02:00
Philipp Steiner
35dec1cd90 net: shell: add net ptp status and per-port diagnostics command
Add a new `net ptp` shell command to inspect PTP runtime state from
the Zephyr shell.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-04-20 13:22:07 +02:00
Philipp Steiner
d5b4078389 net: ptp: add IEEE 802.3 transport support
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>
2026-04-20 13:22:07 +02:00
Philipp Steiner
43f5bc142f net: if: avoid deadlock in TX timestamp callback dispatch
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>
2026-04-20 13:22:07 +02:00
Philipp Steiner
01fe77b2ec net: sockets: fix inet recvmsg ancillary buffer accounting
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>
2026-04-20 13:22:07 +02:00
Philipp Steiner
e7ec73aa3c net: sockets: packet: add recvmsg timestamping support
Implement AF_PACKET recvmsg() support and deliver ancillary
SO_TIMESTAMPING data to packet socket users.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-04-20 13:22:07 +02:00
Philipp Steiner
c9bb31e67a net: ptp: fix foreign master handling and BTCA tie-break
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>
2026-04-20 13:22:07 +02:00
Kai Cheng
145bd3702c Bluetooth: UUID: add assertion and snprintk error handling
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>
2026-04-20 11:44:17 +02:00
Andre Viegas
d22c0d5243 Bluetooth: Host: Fix AoD 2US CTE type validation
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
2026-04-20 11:43:33 +02:00
Carlo Caione
3b6e080ea1 lorawan: native: add EU868 region support
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>
2026-04-20 11:43:15 +02:00
Carlo Caione
90f259cd05 lorawan: native: add native LoRaWAN backend
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>
2026-04-20 11:43:15 +02:00