Commit graph zephyr/subsys
Author SHA1 Message Date
Tomi Fontanilles
e02ccae566 net: wireguard: link to mbedTLS when builtin version is used
Without this we can have scenarios where PSA Crypto headers are not
found under certain configurations.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2026-04-27 14:21:14 +02:00
Jamie McCrae
6f363ec6f7 mgmt: mcumgr: transport: Fix resetting invalid buffer
Fixes an issue whereby the buffer was not checked to be valid
before resetting it

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-27 14:20:21 +02:00
Lyle Zhu
4de2676eb7 bluetooth: classic: avrcp: Move initialization to callback registration
Move the AVRCP cover art initialization from bt_avrcp_init() to
bt_avrcp_tg_register_cb(). This ensures that cover art is initialized
only when the target callback is registered, aligning with the
initialization flow of other AVRCP target features.

Additionally, add a check in bt_avrcp_tg_cover_art_init() to prevent
re-initialization if the PSM is already set, returning success if
cover art is already initialized.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-04-27 14:15:45 +02:00
Emil Gydesen
01ad11b5f7 Bluetooth: BAP: Require security before discovery
The bt_bap_unicast_client_discover and
bt_bap_broadcast_assistant_discover functions now require security
to have already been done before any operations are done.

The BAP require a specific security level and properties,
and checking the security earlier will prevent any unncessary
operations if the expected security requirement cannot be met.

Additionally, ensuring that there is an appropriate pairing with
the provided connection, ensures that we can rely on CONFIG_BT_MAX_PAIR
for soem arrays in the future.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-04-25 08:21:49 +02:00
Ederson de Souza
593d63c897 subsys/pmci/mctp: New Kconfig CONFIG_MCTP_MAX_MESSAGE_SIZE
Newer version of libmctp allocates a buffer to reassembly messages that
has `MCTP_MAX_MESSAGE_SIZE` size. By default, this size is 64Kb, which
may be too big for Zephyr applications.

This patch adds CONFIG_MCTP_MAX_MESSAGE_SIZE - default 1024 - to allow
Zephyr applications to tune the value used by libmctp.

Also update CONFIG_MCTP_HEAP_SIZE to note it needs to be big enough to
hold CONFIG_MCTP_MAX_MESSAGE_SIZE, on top of other allocations.

Assisted-by: GitHubCopilot:claude-sonnet-4.6
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2026-04-25 08:21:06 +02:00
Ederson de Souza
f31fb53d42 pmci: mctp: Update mctp_set_alloc_ops
Newer version on libmctp has a different signature for
`mctp_set_alloc_ops`:

    mctp_set_alloc_ops(alloc, free, msg_alloc, msg_free)

This patch updates mctp_memory.c to provide the new wrappers for
msg_alloc and msg_free and use new signature for `mctp_set_alloc_ops`.

While at it, remove old usages of `mctp_set_alloc_ops` that existed in
the samples: `mctp_memory.c` should take care of everything.

Finally, libmctp doesn't deallocate packets sent to its RX bus: it's now
for the caller to do so. So this patch also adds the corresponding
`mctp_pktbuf_free` calls.

Assisted-by: GitHubCopilot:claude-sonnet-4.6
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2026-04-25 08:21:06 +02:00
Jordan Yates
18f005b347 portability: cmsis_rtos: select POLL not depends on
Move the `depends on POLL` Kconfig depenedency to `select POLL`. Mixing
`select` and `depends on` with the same symbol is the primary cause of
Kconfig dependency loops, and every other `POLL` "dependency" uses
`select`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-04-25 08:19:28 +02:00
Fin Maaß
c2de1feb28 net: ethernet: bridge: set iface in data during build
set iface in data during build. So we don't have to set it later in
the iface init. Due to the fact that we already set the id of the data
structure during build, it is already in the data section of the linker
and not the bss section, so that it doesn't increase the size of the
binary. At the same time we save some code and instructions to set the
iface in the data structure during init.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-24 15:32:55 -04:00
Fin Maaß
abf3172e41 net: ethernet: bridge: remove is_init
the iface init only happens once,
no need to protect it from happening again.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-24 15:32:55 -04:00
Jay Beavers
255bccc1ba usb: device_next: cdc_ncm: Check usbd_ep_enqueue() return value
The cdc_ncm_send() function ignores the return value from
usbd_ep_enqueue(). If the enqueue fails, the code proceeds to block
forever on k_sem_take() waiting for a completion callback that will
never arrive, causing a deadlock.

This was discovered by comparing the CDC-NCM implementation with
CDC-ECM, which correctly checks the return value:

    ret = usbd_ep_enqueue(c_data, buf);
    if (ret) {
        LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
        net_buf_unref(buf);
        return ret;
    }

The NCM driver was missing this error handling, leading to potential
hangs if usbd_ep_enqueue() fails for any reason (e.g., endpoint not
ready, USB disconnected, buffer issues).

Fix by checking the return value and properly cleaning up (freeing
the buffer) before returning the error code to the caller.

Signed-off-by: Jay Beavers <jay@tolttechnologies.com>
2026-04-24 10:29:15 -04:00
Cristian Bulacu
5287851640 net: openthread: border_router: Fix multicast forwarding on ethernet
Add call to 'net_if_mcast_monitor' to inform ENET layer to join or leave
a multicast group.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-04-24 10:28:15 -04:00
Andrea Gilardoni
1149d843df net: ethernet: differentiate ethernet from wifi if
Definining the functions counterpart for cabled ethernet to operate on
the list of interfaces and differentiate them from the 802.11 based ones

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
2026-04-24 10:28:06 -04:00
Cristian Bulacu
217a5ac0ca net: dns: Enhance DNS packet forwarding mechanism
There are situations where internal DNS resolver will reject the packet,
and in this case, query index is not calculated.
This may break forwarding mechanism;
If DNS packet forwarding is enabled, and internal validation fails, some
checks are done and an attempt to calculate query index is performed, so
the packet can be forwarded and used.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-04-24 13:02:39 +02:00
Henrik Brix Andersen
4c8760ca81 modules: canopennode: remove support for the optional CANopenNode module
Remove in-tree support for the optional CANopenNode module. This will be
provided as an external module instead, as there are no bindings from
Zephyr towards this module.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-04-24 12:59:39 +02:00
Emil Gydesen
a0a513667b Bluetooth: BAP/CAP: Make qos param const
Make the qos parameter of the BAP can CAP APIs const,
as they are now only used as one-time parameters, and not stored.
This also means that any uses of this can place the qos
parameter in the stack, rather than static memory.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-04-24 12:58:57 +02:00
Emil Gydesen
be842dfd31 Bluetooth: BAP: Make bt_bap_stream.qos const
The pointer represent the qos configuration
for a stream based on the ASE or broadcast configuration,
and serves as a read-only value. Changing it to `const` makes
this more clear.

Some minor changes were done to existing code to help
support this change.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-04-24 12:58:57 +02:00
Emil Gydesen
52f25c903f Bluetooth: BAP: Fix issues with qos pointers
In some cases the stream->qos pointer pointed to the
qos argument, and sometimes it pointed to the ep->qos.

Now all qos arguments are copied to ep->qos, and
stream->qos always points to stream->ep.qos.

Some modules had some refactoring done to properly store
the QoS. The unicast client had some additional checks
done or redone, and some now-unused code removed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-04-24 12:58:57 +02:00
Steven Friedman
1405595e0f net: http: remove hardcoded localhost hostname
Remove the hardcoded setsockopt(TLS_HOSTNAME, "localhost") which
prevents server-side peer certificate verification from working: the
hostname check compares "localhost" against the client cert's CN/SAN,
which will never match a real client certificate.

Signed-off-by: Steven Friedman <friedman@ionq.co>
2026-04-24 10:56:14 +02:00
Gaetan Perrot
1cb9840462 bluetooth: shell: bt: unify bt_conn_get_info error handling
Standardize error handling for bt_conn_get_info()
across the Bluetooth shell.

- Use a local 'err' variable instead of inline calls
- Check for (err != 0) consistently
- Include error code in all error messages
- Improve log messages for better debugging context

This ensures consistent behavior and more
informative diagnostics when retrieving connection
information fails.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-04-24 10:55:21 +02:00
Gaetan Perrot
b919d61559 bluetooth: shell: bt: report bt_conn_get_info() error code
Use shell_error() instead of shell_print() when
bt_conn_get_info() fails and include the returned
error code in the log.

This makes failures easier to diagnose.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-04-24 10:55:21 +02:00
Gaetan Perrot
680a38a366 bluetooth: shell: bt: fix unchecked return value in disconnected
Coverity (CID 525133) reported that the return
value of bt_conn_get_info() was not checked in
disconnected(), which could lead to use of
uninitialized data.

Fix this by validating the return value before
using the connection info structure.

If retrieving the information fails, fall back to
using the generic connection type to preserve the
existing behavior.

This prevents undefined behavior while maintaining
the original logic.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-04-24 10:55:21 +02:00
Gaetan Perrot
8020b4c594 bluetooth: shell: bt: fix unchecked return value of bt_conn_get_info
Coverity (CID 333394) reported that the return
value of bt_conn_get_info() was not checked in
remote_info_available(), which could lead to use
of uninitialized data.

Fix this by checking the return value and aborting
early in case of error, ensuring that the
connection info structure is valid before use.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-04-24 10:55:21 +02:00
Fin Maaß
17fafb4933 net: vlan: simplify name assignment for detached interfaces
net_virtual_set_name already makes sure,
that the string ends with 0, therefore
we can directly provide the constant string.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-23 18:24:12 -04:00
Fin Maaß
130969990f net: vlan: change bit-fields to regular bool
because these 2 bools are after a uint16_t, that itself is after
a pointer, there should be space for 16 bit, so we can have the
bools regular instead of bit-fields.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-23 18:24:12 -04:00
Fin Maaß
6932a89a8e net: vlan: remove init_done
the iface init only happens once,
no need to protect it from happening again.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-23 18:24:12 -04:00
Fin Maaß
be4d1f460a net: vlan: set iface in data during build
Set iface in data during build. This simplifies the code and
reduces code size.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-23 18:24:12 -04:00
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