Commit graph zephyr/subsys
Author SHA1 Message Date
Lyle Zhu
c5f649f471 bluetooth: classic: a2dp: fix IE length inconsistency issue
The A2DP code used a hardcoded `BT_A2DP_MAX_IE_LENGTH` of 8 bytes for
codec information elements. For the case that the received IE length
exceeds `BT_A2DP_MAX_IE_LENGTH`, the received data will be truncated
while the IE length is not reduced  accordingly. It leads to the IE
length is inconsistency with the codec information elements. It may
lead to problems such as data accessing outside of bounds.

Replace the hardcoded constant with a new Kconfig option
`CONFIG_BT_A2DP_CODEC_MAX_IE_LEN` (default 8 bytes) that allows users
to configure the maximum codec IE length based on their needs. The
valid range is 4-253 bytes, where 4 is the minimum for mandatory SBC
codec and 253 is the maximum allowed by the LOSC length field.

Add validation checks to reject codec IEs that exceed the configured
maximum length, preventing buffer overflows. Remove the previous silent
truncation behavior that could lead to incorrect codec configurations.

Add assertions in `bt_a2dp_set_config_cb()` and
`bt_a2dp_stream_config_set_param()` to catch invalid IE lengths during
development. Add parameter validation in `bt_a2dp_stream_config()` and
`bt_a2dp_stream_reconfig()` to reject invalid configurations at
runtime.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-08-03 08:46:18 -04:00
Robert Rozelle
7c88ec4252 net: mdns_responder: don't let DHCP-bound announce preempt probe
start_announce() (fired on NET_EVENT_IPV4_DHCP_BOUND) set do_announce =
true unconditionally, before the RFC 6762 probe (0-250ms scheduling
delay, then a 1.75-3s window) had a chance to complete. do_init_listener()
branches on do_announce to decide whether to call init_listener() at all
-- since DHCP binding always races ahead of the probe, init_listener()
never ran on any boot with CONFIG_NET_DHCPV4 + CONFIG_MDNS_RESPONDER_PROBE
both enabled.

Gate start_announce() on init_listener_done: the very first successful
init_listener() call already announces via its own trailing call to
announce_start(), so this DHCP-bound path is only needed for re-announces
after the listener is already up (lease renewal, etc), not the first boot.

Test: tests/net/lib/mdns_responder_probe/ reproduces the exact race
(net_if_ipv4_addr_add() immediately followed by a NET_EVENT_IPV4_DHCP_BOUND
notification, no delay in between, mirroring dhcpv4_handle_msg_ack()'s real
sequence) and confirms the responder is reachable afterward. Reverting this
fix reproduces the exact -ENOMEM-unrelated failure (responder never becomes
reachable).

Depends on the v4_svc/v6_svc probe-sizing fix in this branch's parent
commit: without it, CONFIG_MDNS_RESPONDER_PROBE fails independently of this
bug (probing itself can't complete), which would make this test fail for
an unrelated reason.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Robert Rozelle <rwrozelle@gmail.com>
2026-08-03 08:45:43 -04:00
Robert Rozelle
d33aa34200 net: mdns_responder: answer multi-question compressed DNS-SD queries
send_sd_response() always parsed the raw query bytes starting from the
message header, so it only ever matched the first Question in a packet.
avahi and other real-world clients batch several PTR questions into one
mDNS packet, so anything after the first was silently never answered.

Even fixing the offset wasn't enough: those later questions almost
always use DNS name compression pointers (RFC 1035 4.1.4) to reference
earlier questions' labels, and dns_sd_query_extract() has no
compression support at all.

Add dns_sd_query_extract_name(), which parses the already-decompressed,
dot-separated name that dns_unpack_query() produces for each question in
turn (dns_unpack_query() already follows compression pointers via
dns_unpack_name()). send_sd_response() now uses that instead of
re-parsing raw wire bytes from the start of the message, so every
question in a batched, compressed query gets a chance to match. Shared
label-validation logic between the old wire-format extractor and the new
text extractor is factored into a dns_sd_validate_and_assign() static
helper. dns_sd_query_extract() itself is kept (not removed) since it's
still directly exercised by tests/net/lib/dns_sd/.

Tests:
- tests/net/lib/dns_sd/: 6 new unit tests for dns_sd_query_extract_name()
  -- basic 3-label, 4-label with instance, too-few-labels, empty-label
  (consecutive dots), and two ENOBUFS variants (too many labels, a label
  that doesn't fit its buffer).
- tests/net/lib/mdns_responder/:
  test_multi_question_compressed_dns_sd_query sends a real 2-question
  wire-format packet, where question 2 uses a DNS name-compression
  pointer back into question 1's "local" label (mirroring real avahi
  traffic), and confirms both questions get separately answered.

Verified as genuine regression tests: reverting this change reproduces a
failure in exactly test_multi_question_compressed_dns_sd_query and no
other test.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Robert Rozelle <rwrozelle@gmail.com>
2026-08-03 08:45:33 -04:00
Kai Cheng
7e0e0ff7dc bluetooth: classic: shell: add HID Device commands
Add shell commands for interactive HID Device testing:
- hid_device register/unregister: register HID callbacks and SDP record
- hid_device connect/disconnect: manage HID association
- hid_device send: send mouse input reports (button, dx, dy, wheel)

The shell module uses HID report descriptor macros from
<zephyr/usb/class/hid.h> for a mouse with 8 buttons, X/Y axes,
and scroll wheel (Report ID 2).

Callbacks parse report_id from buf locally (driver passes raw buf).
Protocol mode tracked via set_protocol callback return value.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Assisted-by: Claude Opus 4.6 (1M context)
2026-08-03 08:44:11 -04:00
Kai Cheng
11b8543035 bluetooth: classic: implement HID Device connection and protocol
Implement the HID Device profile core:
- L2CAP server registration for CTRL (PSM 0x0011) and
  INTR (PSM 0x0013)
- Connection state machine
  (DISCONNECTED -> CTRL -> INTR -> CONNECTED)
- Control channel message dispatch (GET_REPORT, SET_REPORT,
  GET_PROTOCOL, SET_PROTOCOL, HID_CONTROL)
- Interrupt channel output report handling
- Handshake response generation based on handler return codes
- Virtual Cable Unplug, disconnecting once the PDU has been sent
- Buffer ownership: callee never frees caller-provided buf
- unregister returns -EBUSY if still connected

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Assisted-by: Claude Opus 4.6 (1M context)
2026-08-03 08:44:11 -04:00
Kai Cheng
2fbb1c1131 bluetooth: classic: add HID protocol definitions
Add internal header with HID protocol constants, message types,
handshake codes, header encoding macros, and session/device structures
per HID Profile v1.1.2.

Add HID-specific SDP attribute definitions (0x0200-0x0210) to the
public SDP header.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Assisted-by: Claude Opus 4.6 (1M context)
2026-08-03 08:44:11 -04:00
Anas Nashif
7b0fa68075 net: zperf: fix use of uninitialized periodic result
When a TCP upload is started with a report interval but a zero total
duration, "rounds" evaluates to 0, the upload loop never executes and
"periodic_result" is left uninitialized. Its packet_size member is then
copied into the final result.

Reported by the GCC static analyzer
(-Wanalyzer-use-of-uninitialized-value).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Assisted-by: Claude:claude-opus-5
2026-08-02 11:44:26 -04:00
Etienne Carriere
78022cbbbd testsuite: use diamond include for non-local header files
Use #include <> instead of #include "" to include a header file which path
is not relative to the directory path of the file emitting the #include
directive.

This change was made running scripts/check_quoted_includes.py script
proposed in https://github.com/zephyrproject-rtos/zephyr/pull/112135
with the Linux shell command below and manually selecting the applicable
changes:
$ find subsys/testsuite/ -type f -exec \
    ./scripts/check_quoted_includes.py -w {} \;

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-08-02 11:42:27 -04:00
Emil Gydesen
1831cf2b3c Bluetooth: BAP: SD: Fix init of mutex and k_work
The mutex may not have been initialized when the
disconnected callback was called which would attempt to use it,
if bt_bap_scan_delegator_register was not called first.

Changed to use SYS_INIT to initialize the mutex and k_work.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-07-31 20:07:52 -04:00
Emil Gydesen
874237910a Bluetooth: MCS: Fix init of mcs_inst.mutex
The mutex may not have been initialized when the
disconnected callback was called which would attempt to use it,
if bt_mcs_init was not called first.

Changed to use SYS_INIT to initialize the mutex.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-07-31 20:07:52 -04:00
Yasas Kahawala
a796c807c9 net: dns: Fix dispatcher forwarding with context when socket is shared
when the socket is shared with resolver and responder, the dns_dispatch()
forwards the arriving message to correct callback depending on whether it
is a query or response message but it was passing the wrong context
when it was forwarding to the paired callback.

Pass the paired context when calling the paired callback instead of the
base dispatcher.

Signed-off-by: Yasas Kahawala <yasasravinda@hotmail.com>
2026-07-31 14:59:03 -04:00
Ram Pingle
c9d1638414 usb: device: class: rndis: keep trailing byte of unaligned frame
rndis_bulk_out() treats any single 0x00 byte received on the bulk OUT
endpoint as a frame delimiter and skips it unconditionally. When the
total length of an RNDIS data frame is not a multiple of the bulk
endpoint packet size and the last USB packet carries a single 0x00
payload byte, that genuine payload byte is dropped.

Dropping the byte leaves the in-progress packet one byte short, so the
frame is never completed. The next transfer is then written into the
still-open packet, the RNDIS header of the following frame is
misparsed, and the receive path desynchronises (observed as repeated
"Error parsing RNDIS header" / "Too small packet len" errors).

Only treat a single 0x00 byte as a frame delimiter when no packet is
currently being assembled (rndis.in_pkt == NULL). While a packet is in
progress the byte is written normally, completing the frame and
keeping the receive stream in sync.

Assisted-by: GitHub Copilot: Claude Opus 4.8
Signed-off-by: Ram Pingle <RamPingle@eaton.com>
2026-07-31 14:58:36 -04:00
Emil Gydesen
b4a02e8a7f Bluetooth: Audio: Rename bt_bap_stream_ops fields to align with ASE states
Rename the `configured` and `qos_set` callbacks of
`struct bt_bap_stream_ops` to `codec_configured` and `qos_configured`
respectively, so that the names align with the ASE state machine names
defined by the ASCS specification.

All in-tree users (host implementation, shell, samples and tests) have
been updated accordingly, including the local callback function names
that mirror the operation names.

Assisted-by: Copilot:claude-opus-4.8
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-07-31 14:56:25 -04:00
Pieter De Gendt
cf1c5c9267 net: dhcpv4: bound INIT-REBOOT before falling back to discover
INIT-REBOOT and REQUESTING shared a single retransmit arm in
dhcpv4_manage_timers() capped at DHCPV4_MAX_NUMBER_OF_ATTEMPTS (3) with
4/8/16 s backoff, so an unanswered INIT-REBOOT took ~28 s to revert to
DISCOVER. On a network change the interface commonly re-enters
INIT-REBOOT for the previous lease, and many access points silently
drop the foreign-subnet REQUEST rather than NAKing it, leaving the
client stuck for the full schedule before it can bind on the new
network.

RFC2131 3.2 frames INIT-REBOOT as an optimistic abbreviated probe.
Give it its own tighter cap, configurable via
CONFIG_NET_DHCPV4_INIT_REBOOT_ATTEMPTS (default 1), and split it into a
dedicated arm so it falls back to DISCOVER quickly. Combined with the
attempts reset and the removal of the initial random delay, a network
change now recovers in a few seconds instead of 25-35 s. To turn the
optimistic probe off entirely, disable CONFIG_NET_DHCPV4_INIT_REBOOT.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-07-31 14:53:38 -04:00
Pieter De Gendt
93f04c30e0 net: dhcpv4: skip initial random delay in INIT-REBOOT
The RFC2131 4.4.1 random 1-10 second startup delay exists to
desynchronize the initial DHCPDISCOVER of many clients booting at once.
dhcpv4_start_internal() applied it unconditionally, including when
entering INIT-REBOOT. An INIT-REBOOT re-REQUEST of a previously leased
address is an optimistic fast probe (RFC2131 3.2) with no desync
concern, so the delay is pure dead time; on a network change it just
postpones the eventual fall-back to DISCOVER by up to 10 seconds.

Restrict the random delay to the INIT state so INIT-REBOOT sends its
first REQUEST immediately.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-07-31 14:53:38 -04:00
Pieter De Gendt
fe44da6f18 net: dhcpv4: reset attempts counter on (re)start
dhcpv4_start_internal() moves the client into INIT or INIT-REBOOT and
picks a fresh XID, but never resets the retransmit counter, unlike the
dhcpv4_enter_*() helpers. A normal DISCOVER/REQUEST/ACK cycle leaves
attempts at 1, and an aborted INIT-REBOOT can leave it at the cap, both
of which survive net_dhcpv4_stop()/net_dhcpv4_start(). On the next start
this makes the retransmission backoff begin at 8 s instead of 4 s, or
makes the client fall straight through to DISCOVER on the first timeout.

Reset attempts to zero when (re)entering INIT/INIT-REBOOT so every start
begins with the full, correct retransmission schedule.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-07-31 14:53:38 -04:00
Cristian Bulacu
dd08dc8606 openthread: border_router: skip forwarding policy for a Thread only device
A Border Router may also act as a Thread-only device when no AIL connection
is present. In that case, the packet forwarding logic is bypassed,
since only a single interface — the Thread interface — is active.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-07-31 14:53:30 -04:00
Etienne Carriere
f01beaed95 shell: use diamond include for non-local header files
Use #include <> instead of #include "" to include a header file which path
is not relative to the directory path of the file emitting the #include
directive.

This change was made running scripts/check_quoted_includes.py script
proposed in https://github.com/zephyrproject-rtos/zephyr/pull/112135
with the Linux shell command below and manually selecting the applicable
changes:
$ find subsys/shell/ -type f -exec \
    ./scripts/check_quoted_includes.py -w {} \;

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-31 14:52:03 -04:00
Krzysztof Chruściński
069d3a7652 shell: backends: uart: Fix case when needs to be re-enabled
If RX buffers are not provided on time it may be possible that device
enters disabling phase. Code was attempting to re-enable the UART
immediately when that is detected but it fails if UART is not yet
disabled. If providing next buffer fails then just release that
buffer and wait for UART_RX_DISABLED event. Re-enable UART from
that event.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-07-31 14:51:49 -04:00
Daniel Nejezchleb
17c1d2ea06 net: if: lookup ip addresses only in ifaces that are up
When assigning incoming packets to the proper interface
or selecting an interface for outgoing packets,
search only among interfaces that are up.

Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
2026-07-31 13:23:41 -04:00
Alberto Escolar Piedras
dfbb2a3a51 fs: native_mount: Add missing dependency
This driver needs the nsi_errno conversion component.
Let's make sure we build it by selecting it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-31 13:22:16 -04:00
Emil Gydesen
932f543360 Bluetooth: TBS: Add missing mutex for bt_tbs_set_signal_strength
The function accessed the instance without taking the mutex.
This also fixes the reporting time in the log from ticks to ms.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-07-31 13:21:06 -04:00
Fin Maaß
7b4c8ec552 net: ip: core: do iface autostart last
as the iface is in most cases not operational
at that point and we also have ifaces without
autostart, no net init part should require that
the iface is up and therefore we should do that
at the end.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-31 13:18:54 -04:00
Benjamin Cabé
ac8a6f976e posix: mqueue: skip used-count syscalls when no notification is set
send_message() called k_msgq_num_used_get() twice on every mq_send()
only to detect the empty->non-empty edge that fires a registered
notification. Gate both calls on a notification actually being
registered so the common no-notify send path avoids them.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-31 13:06:02 -04:00
Benjamin Cabé
2d1ac5c8b2 posix: fs: skip free-space scan for a failing stat()
stat() called fs_statvfs() before fs_stat(), so every lookup paid a
filesystem-wide free-space scan (O(fs size) on littlefs/FatFs) even for
a path that does not exist. The scan result is only used for the
block-size hint, so run fs_stat() first and return early on failure,
leaving the successful-stat output unchanged.

Also assert in the stat test that the block-size hint stays populated.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-31 13:05:53 -04:00
Phil Hindman
3dfe2a9743 shell: backends: Use atomic_set in tx_disable path
atomic_set is used to access tx_busy in the irq_write function (in order to
get atomic exchange behavior) so we should also access it atomically here
(even though we don't need atomic exchange behavior here).

Signed-off-by: Phil Hindman <phindman@xes-inc.com>
2026-07-31 13:04:48 -04:00
Sandro Scherer
2020e4c7d4 shell: fix history UB applying zero offset to null pointer
node is NULL if shell history is empty.
Applying a zero offset to NULL is undefined behavior.

Signed-off-by: Sandro Scherer <sandro.scherer@siemens.com>
2026-07-31 13:04:13 -04:00
Chingbin Li
e60464c5d6 shell: add thread id notice to help description of subcommand 'unwind'
In most usage scenarios, the thread id parameter is useful for unwind
subcommand. For example, use the 'kernel thread list' command to
locate the <thread id> of the target thread, then check the call trace
with 'kernel thread unwind <thread id>'.
At least, users should be reminded that this command accepts the
<thread id> parameter to check the call trace of any thread.

Signed-off-by: Chingbin Li <liqb365@163.com>
2026-07-31 13:03:52 -04:00
Etienne Carriere
8ad85c9cef tracing: use diamond include for non-local header files
Use #include <> instead of #include "" to include a header file which path
is not relative to the directory path of the file emitting the #include
directive.

This change was made running scripts/check_quoted_includes.py script
proposed in https://github.com/zephyrproject-rtos/zephyr/pull/112135
with the Linux shell command below and manually selecting the applicable
changes:
$ find subsys/tracing/ -type f -exec \
    ./scripts/check_quoted_includes.py -w {} \;

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-31 13:02:25 -04:00
Jonathan E. Peace
289b8a534f sd: sdio: reject CMD53 block count > 511 in block mode
cmd.arg's block-count field is 9 bits (bits [8:0]). In block mode
(SDIO CMD53 Block Mode = 1) the field encodes counts 1..511
directly; per spec count = 0 has special meaning ("transfer until
I/O-abort"), not 512 blocks, and 512 itself has no valid encoding.

The previous `cmd.arg |= ... | blocks` had no upper bound, so a
caller passing blocks = 512 (= 0x200) set bit 9 of arg -- the LSB
of the register-address field -- and silently corrupted the target
register. A naive 9-bit mask alone would swap that for a different
silent failure: blocks = 512 would encode as 0 in block mode and
the chip would interpret it as "transfer until aborted".

Reject blocks > 511 with -EINVAL instead. Byte mode (blocks == 0)
is unchanged: in that mode count = 0 correctly encodes 512 bytes.
Callers needing more than 511 blocks must issue multiple CMD53s.

Part of the rpi_zero_2w board enablement series (RFC #109880).
Related parallel work: #110379 (Pi Zero W / BCM2835 / ARMv6).

Signed-off-by: Jonathan E. Peace <jep@alphabetiq.com>
2026-07-31 13:01:05 -04:00
Flavio Ceolin
e61790f776 net: lwm2m: Check block context allocation before use
parse_write_op() stored the server selected block size into the block1
context right after calling init_block_ctx(), before inspecting its
return code. init_block_ctx() leaves the caller's pointer set to NULL
and returns -ENOMEM when the block1 context pool (default 3 entries) has
no free or timed out slot, so that store dereferences a NULL pointer.

Move the store below the guard, and validate the context pointer itself
instead of the return code, so the context is only touched once it is
known to be valid regardless of how the helpers report failure.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-30 21:28:54 -04:00
Fin Maaß
b0cb88a8bf net: ip: set checksum to 0 if checksum offloading is used
make sure that the checksum field is set to 0, when checksum offloading
is used. In tcp, icmpv4 and icmpv6 it is already done that way.

It is also already done at the openthread border router, if the ethernet
iface supports offloading.

Signed-off-by: Fin Maaß <info@finmaass.de>
2026-07-30 17:39:54 -04:00
Jamie McCrae
f7fc3e779a mgmt: mcumgr: transport: serial: Add minimum receive size
Adds a minimum check to ensure that received messages do hold
some data

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-07-30 17:39:20 -04:00
Mala Wolff
f939ffaa8f ptp: put announce interval into announce packages
caused clocks whose sync interval is shorter than its announce
interval to never qualify as a leader

Signed-off-by: Mala Wolff <mala@macker.lol>
2026-07-30 17:39:08 -04:00
Mike J. Chen
61d39743c3 logging: fix bug where links wouldn't be promptly activated
The log process thread is what activates multidomain log
links, but if all backends were already initialized,
it would enter a mode where it would block until new
local logs were ready to be processed, even if links
were not yet completed in activation. Change the logic
for computing the timeout used to block the processing
thread so that it stays in periodic polling mode if there
are still log links that haven't finished activating.

Signed-off-by: Mike J. Chen <mjchen@google.com>
Co-authored-by: Wojciech Sipak <wsipak@antmicro.com>
Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2026-07-30 17:36:59 -04:00
Carlo Kirchmeier
ec5131510b net: coap: bound coap_find_options() scan to the option region
coap_find_options() bounded its option scan with cpkt->max_len. That
field has two different meanings depending on how the packet was
produced: coap_packet_parse() sets max_len to the actual message
length, but coap_packet_init() sets it to the underlying buffer
capacity. For a packet that was built (rather than parsed), scanning
up to max_len therefore runs past the encoded options and into
uninitialized buffer memory, since a freshly built packet has no
payload marker to stop the walk.

Fixed this by using hdr_len + opt_len, and adding an explicit
"offset < end" loop guard.

Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier.ext@siemens.com>
2026-07-30 17:36:50 -04:00
Carlo Kirchmeier
59874aadb9 net: coap: Handle missing OSCORE support
Adjust coap server behaviour to handle missing OSCORE support
according to specification.

Co-authored-by: Martin Schröder <info@swedishembedded.com>
Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier.ext@siemens.com>
2026-07-30 17:36:50 -04:00
Carlo Kirchmeier
8d5a3779f1 net: coap: add OSCORE (RFC 8613) server-side support
Add RFC 8613 OSCORE support to CoAP server processing.

Introduce OSCORE option handling, public context init/free APIs,
and server integration for request verify/decrypt plus response
protection. Add per-service context provider support, OSCORE-required
service mode (reject unprotected requests with 4.01), and exchange
tracking for deferred response protection.

Add Kconfig/CMake wiring and OSCORE documentation updates.

Co-authored-by: Martin Schröder <info@swedishembedded.com>
Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier.ext@siemens.com>
2026-07-30 17:36:50 -04:00
Etienne Carriere
1ec9cf2a9c sensing: Include include/zephyr/sys/clock.h
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.

This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
      `grep -rsl "zephyr/sys_clock\.h" subsys/sensing/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-30 07:45:05 -05:00
Etienne Carriere
5c1148386b portability: Include include/zephyr/sys/clock.h
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.

This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
      `grep -rsl "zephyr/sys_clock\.h" subsys/portability/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-30 07:45:05 -05:00
Etienne Carriere
9299f1d616 pm: Include include/zephyr/sys/clock.h
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.

This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
      `grep -rsl "zephyr/sys_clock\.h" subsys/pm/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-30 07:45:05 -05:00
Etienne Carriere
24791a33fa net: Include include/zephyr/sys/clock.h
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.

This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
      `grep -rsl "zephyr/sys_clock\.h" subsys/net/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-30 07:45:05 -05:00
Etienne Carriere
b55b054536 logging: Include include/zephyr/sys/clock.h
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.

This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
      `grep -rsl "zephyr/sys_clock\.h" subsys/logging/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-30 07:45:05 -05:00
Etienne Carriere
fb45ac5f13 bluetooth: Include include/zephyr/sys/clock.h
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.

This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
      `grep -rsl "zephyr/sys_clock\.h" subsys/bluetooth/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-30 07:45:05 -05:00
Appana Durga Kedareswara rao
60957de935 debug: coredump: add SMP support for MEMORY_DUMP_THREADS mode
Remove the !SMP dependency from DEBUG_COREDUMP_MEMORY_DUMP_THREADS and
DEBUG_COREDUMP_THREADS_METADATA so THREADS mode is available on SMP
platforms.

On non-SMP builds DEBUG_THREAD_INFO is still selected, preserving
_kernel_thread_info_offsets for offline GDB thread enumeration. On SMP
THREAD_MONITOR is selected instead: DEBUG_THREAD_INFO is not SMP-safe as
thread_info.c exports K_CURR_THREAD reflecting only cpus[0].current, which
misleads live RTOS debugger plugins on multi-core systems. Document this
limitation in the DEBUG_THREAD_INFO Kconfig help text.

Hold z_thread_monitor_lock while walking _kernel.threads so the list is
stable against concurrent k_thread_create/exit on other CPUs. On
uniprocessor IRQs are already locked, making this a no-op.

Extend the ISR stack dump to all CONFIG_MP_MAX_NUM_CPUS cores instead of
only cpus[0], since a crash can occur in an interrupt handler on any core.

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
2026-07-30 09:49:33 +02:00
Fin Maaß
c735818afe net: ethernet: move net_lldp_set_lldpdu
move net_lldp_set_lldpdu into the
common ethernet_init.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-29 16:54:30 -07:00
Fin Maaß
1b7e49fc16 net: ethernet: fetch ethernet_hw_caps once in init
fetch ethernet_hw_caps via net_eth_get_hw_capabilities
only once in the ethernet_init.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-29 16:54:30 -07:00
Jukka Rissanen
ef370a57d0 net: sockets: Store async socket error in net_context
zsock_*_cb() stashed the asynchronous error code in net_context.user_data
via INT_TO_POINTER() and read it back with POINTER_TO_INT(). That field is
also used by the stack to carry the parent context pointer passed to the
accept callback, so a failed accept left a small integer where a pointer
was expected. A subsequent interface-down forwarded that stale integer to
zsock_accepted_cb(), which dereferenced it as the parent context,
causing a wild pointer access and kernel fatal error.

Store the pending error in a dedicated net_context.sock_error field
instead, leaving user_data untouched. sock_set_error() now takes the errno
value and sock_get_error() retrieves it, replacing the user_data punning
at all read and write sites.

Assisted-by: Claude:opus-4-8
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-29 08:18:13 -07:00
Ralph Rooding
20784b845b net: lib: coap: server: don't assert on failed retransmission send
coap_server_retransmit() logs a zsock_sendto() failure and then
unconditionally asserts that the full packet was sent. A failed send is
a legitimate runtime condition, e.g. -ENETDOWN when the network
interface went down while a confirmable message was awaiting ACK;
with CONFIG_ASSERT=y this results in a kernel panic (observed
on an STM32H743-based board right after "PHY (0) is down").

A guard is added so it keeps catching partial sends but tolerates
send errors; the pending entry stays queued and retransmission
resumes on the next cycle until the retry budget is exhausted.

Signed-off-by: Ralph Rooding <ralph@ralphrooding.com>
2026-07-29 08:16:56 -07:00
Ofir Shemesh
9bf307f2ec random: xoshiro128: reject all-zero seed from entropy driver
xoshiro128++ has a fixed point at state = {0,0,0,0} and outputs
zero forever if seeded that way. If an entropy driver reports
success with a zero buffer, sys_rand_get() is poisoned for the
rest of boot.

Accept the seed only if the entropy read succeeded AND the state
is non-zero. On rejection leave initialized=false so the next
sys_rand_get() retries the entropy source.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2026-07-29 08:16:37 -07:00