Commit graph zephyr/subsys
Author SHA1 Message Date
Anas Nashif
ef5b303dc8 net: coap: bound Uri-Query comparison loop in match_path_uri
match_path_uri() compares a resource path against the URI carried in a
Uri-Query option. That URI points straight into the received packet
buffer and is not NUL terminated, but the inner path character loop
advanced k for every path character without ever checking it against
len. A query such as "?href=/foob", aimed at an application that
registers a "foobar" resource, therefore walked past the end of the
option value, and past the end of the packet buffer when the option is
the last thing in the packet.

The over-read cannot change the result: returning true requires either
k == len or k + 1 == len, both in bounds, so bytes beyond the option
only ever steer the loop towards the next candidate path. The impact is
the undefined behaviour and the fault it may cause, not a matching
error or an information leak back to the requester.

Add a "k >= len" guard at the top of the inner loop. The check has to
stay inside the loop: hoisting it into a "plen > len - i" test in front
of the loop would also reject a trailing wildcard, so that "/ab*" would
stop matching a path such as "abcdefgh".

Extend test_match_path_uri with a URI built without a NUL terminator,
so that the over-read is trapped when the suite is run under a
sanitizer, and with a URI whose length is shorter than its buffer to
cover the guard on a path that does match.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-07-28 20:52:05 -04:00
Jamie McCrae
e73089c996 mgmt: mcumgr: transport: smp_raw_dummy: Fix resetting NULL buffer
Re-orders events so that reset of buffer only happens if the
allocation of the buffer was successful

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2026-07-28 18:12:06 -04:00
Jamie McCrae
d345e7810a mgmt: mcumgr: transport: smp_raw_dummy: Rename functions
Renames functions to have raw in the names, this helps when
debugging with both raw and raw dummy transports enabled, as
without the change the debugger will show the names as the same

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2026-07-28 18:11:58 -04:00
Aleksandr Senin
4a5c824298 net: ppp: accept PFC/ACFC compressed frames on receive
Add receive support for Protocol-Field-Compression and
Address-and-Control-Field-Compression.

ppp_l2.c accepts a 1-octet Protocol field: PPP protocol numbers have
bit 0 of the high octet clear, so an odd first byte is unambiguously a
compressed single octet; pull 1 vs 2 bytes accordingly.

modem_ppp.c: in the HDLC HDR_FF state a non-0xFF byte means the frame
omits the FF 03 header (ACFC); start the frame and treat the byte as
the first Protocol octet instead of dropping it. The first octet may
arrive HDLC-escaped (e.g. the 0x00 high octet of the IP protocol
0x0021, sent as 7D 20), so an escape in HDR_FF moves to the new
HDR_FF_UNESCAPE state which unescapes the octet before starting the
frame; an octet that unescapes to 0xFF is an escaped Address field and
falls back to normal FF 03 header processing.

The compressed forms are accepted unconditionally, independent of LCP
negotiation. RFC 1661 only requires accepting the compressed form once
the option has been negotiated, and forbids transmitting it otherwise;
transmit therefore always stays uncompressed. Unconditional accept is
needed for peers that compress unilaterally: a usbmon capture of the
Neoway N717 shows it sending PFC-compressed IP data frames
(FF 03 21 45 ...) even after pppd rejected the option, so negotiation
completes over full-form LCP/IPCP and the data frames are then
dropped. Linux pppd likewise accepts compressed frames regardless of
negotiation.

Signed-off-by: Aleksandr Senin <al@meshium.net>
2026-07-28 18:11:31 -04:00
Fin Maaß
17c320f507 net: ipv4: acd: remove net_ipv4_acd_init
remove net_ipv4_acd_init and replace it
with a build time init.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-28 18:11:04 -04:00
Robert Lubos
e8a449cc16 net: context: store the local endpoint address inline
Change net_context.local from a struct net_sockaddr_ptr, which only
held pointers into the interface's address storage, to an inline
address that owns a copy of the bound local address, like
net_context.remote.

The field is stored in a union that exposes both a struct net_sockaddr,
used for all accesses, and a struct net_sockaddr_storage alias. In
Zephyr the two types are identical in size and layout, so the union
costs nothing and simply makes the storage-typed view available without
forcing casts on every accessor.

The old multicast pointer aliased a net_if_mcast_addr slot that is
recycled when an interface goes down and back up. After such a cycle the
stored pointer silently repointed the bound group (e.g. ff02::fb ->
ff02::1), which broke the mDNS responder's ability to recover after
interface loss.

The AF_PACKET link-layer address is now copied inline as well. Since the
inline copy no longer auto-tracks the interface, net_context_recv()
re-reads the link address live from the interface (its length can change
at runtime, e.g. 802.15.4 switching between short and extended
addressing).

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-07-28 18:10:47 -04:00
Robert Lubos
94d4f582c7 net: context: track bound local address with a flag
Introduce a NET_CONTEXT_LOCAL_ADDR_SET flag and a matching
net_context_is_local_addr_set() helper to track whether a local address
has been bound to a network context, instead of relying on the local
address pointer in net_context.local being non-NULL.

The flag is set in net_context_bind() for each supported address family
(IPv6, IPv4, AF_PACKET and CAN) and is checked in bind_default(), the
port-reuse scan in check_used_port(), net_context_connect(),
recv_dgram(), net_tcp_accept(), zsock_getsockname() and the net shell,
replacing the previous pointer-is-non-NULL tests.

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-07-28 18:10:47 -04:00
Benjamin Cabé
ff3778cec7 net: pkt: Streamline the cursor operate loop
net_pkt_cursor_operate() re-derived the overwrite/append state of the
operation and the fragment limits several times for every processed
fragment, through pkt_cursor_advance() and pkt_cursor_update() which
each recompute them. Since packet payloads are split into many small
fragments (CONFIG_NET_BUF_DATA_SIZE is 128 bytes by default), this
bookkeeping runs a dozen times for a single MTU-sized read or write
and is pure overhead on every user-to-packet copy in the stack.

Hoist the loop-invariant overwrite/append state out of the loop,
compute the fragment limit once per fragment, and update the cursor
inline using the already computed values instead of re-deriving them
in pkt_cursor_update().

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-28 18:10:37 -04:00
Rui Sousa
50b5be71dd net: shell: Remove hard dependency on IPv4 IGMP
The network shell has no mandatory support for IPv4 IGMP.
Remove the hard dependency on IPv4 IGMP when CONFIG_NET_SHELL is enabled.

Applications that use IPv4 multicast group join/leave from the
network shell must now enable CONFIG_NET_IPV4_IGMP explicitly.

Signed-off-by: Rui Sousa <rui.sousa@nxp.com>
2026-07-28 18:09:48 -04:00
Eliott Speyser
b6d9fa6354 net: wifi: shell: Fix ap enable cmd help typo
Add a missing whitespace and fix frequency in ap enable cmd help.

Signed-off-by: Eliott Speyser <eliott.speyser@st.com>
2026-07-28 18:09:14 -04:00
Diogo Sousa
6c243342cf net: lwm2m: fix put_string to handle empty buffer
Handle the case where put_string() is called with an empty buffer.
This prevents malformed CoAP packets from being generated.

Signed-off-by: Diogo Sousa <sousadiogo7@gmail.com>
2026-07-28 12:31:35 -07:00
Swamidas Nampalli
bda1b6ac0d net: tcp: Fix RST ACK for FIN segments in net_tcp_reply_rst()
When replying with RST to an incoming segment without ACK, the ACK
field must be set to SEG.SEQ + SEG.LEN per RFC 9293. SEG.LEN includes
both SYN and FIN because they occupy sequence space.

net_tcp_reply_rst() already incremented ACK for SYN, but not for FIN.
For a FIN-only segment, this produced ACK=SEG.SEQ instead of the
required ACK=SEG.SEQ+1, making the RST non-compliant and potentially
ignored by strict TCP peers.

Add the missing FIN increment so RST ACK calculation matches the RFC.

Signed-off-by: Swamidas Nampalli <Swami.Das@silabs.com>
2026-07-28 11:35:58 +01:00
Flavio Ceolin
fc065f79a5 zbus: proxy_agent: fix OOB read logging channel name
The IPC backend receive callback logged msg->channel_name with a plain
%s on the recv_cb error path. That frame originates from a peer domain
and, precisely because recv_cb rejected it, channel_name[] is not
guaranteed to be NUL-terminated.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-28 11:35:05 +01:00
Hongquan Li
4f3afd3199 arch: expose arch_page_phys_get() in public arch_interface.h
Move the declaration of arch_page_phys_get() from the internal
kernel_arch_interface.h to the public arch_interface.h, under the
existing arch-mmu group, so that drivers and subsystems can query the
physical address of an already-mapped virtual page without depending
on private kernel headers.

The declaration stays unconditional, as it was in the internal header:
callers such as munmap() in subsys/portability/posix/options/mmap.c
reference the function even when CONFIG_MMU is disabled (guarded only
by a runtime IS_ENABLED() check), so hiding the declaration behind
CONFIG_MMU breaks the build on MMU-less platforms.

Clean up the existing users that resorted to including the internal
header or to extern declarations:

- subsys/portability/posix/options/mmap.c
- subsys/portability/posix/options/shm.c
- subsys/portability/cmsis_rtos_v1/cmsis_thread.c

Fixes #113314

Signed-off-by: Hongquan Li <hongquan.li@processmission.com>
2026-07-28 11:33:29 +01:00
Yasas Kahawala
ef3e9115ec net: ipv4: Fix on-link routing to search all interfaces
ipv4_route_packet() passes a NULL iface to net_if_ipv4_addr_onlink(),
which per its documented contract must then search all interfaces for
the best matching subnet (as the IPv6 variant does). The IPv4
implementation instead returned false whenever the iface was NULL and
otherwise only ever inspected the single interface passed in, so the
on-link routing branch was effectively dead: destinations reachable
on-link but without a routing-table entry were dropped. This shows up
when NAT is enabled and the packet is routed across interfaces.

net_route_ipv4_get_info() relies on the same NULL "search all
interfaces" behavior to short-circuit on-link destinations so they are
delivered directly instead of via the default gateway, and was broken
for the same reason.

Align net_if_ipv4_addr_onlink() with the IPv6 implementation and its
documentation: iterate over all interfaces when no specific interface is
requested, restrict to a single interface only when one is provided, and
tolerate a NULL iface pointer (net_route_ipv4_get_info() calls it that
way).

Assisted-by: Claude:opus-4.8
Signed-off-by: Yasas Kahawala <yasasravinda@hotmail.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-28 11:32:11 +01:00
Benjamin Cabé
7ffb0b8bef net: pkt: Optimize pulls from the start of a fragment
Avoid memmove() when net_pkt_pull() removes data from the start of a
fragment. Advance the data pointer instead, making the operation O(1).

Document that pull and compaction do not preserve packet storage
layout.

Assisted-by: Claude:fable-5
Assisted-by: Codex:sol-5.6
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-28 11:31:59 +01:00
Benjamin Cabé
3d4c6177d2 net: ieee802154: Serialize unfragmented packet chains
A net_buf fragment is a storage detail and must not become an implicit
MAC frame boundary. When 6LoWPAN fragmentation is not required,
ieee802154_send() currently sends one frame per net_buf.

Linearize the complete packet chain into the existing MTU-sized frame
buffer and transmit it once. Validate the total frame length before
transmission, and update the 6LoWPAN test to model an unfragmented
packet as one wire frame.

Assisted-by: Codex:sol-5.6
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-28 11:31:59 +01:00
Jordan Yates
15a0e00114 modem: pipe: backends: switch to transmit_chain
Switch the in-tree modem pipe backends to natively support the
`transmit_chain` API call.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-07-28 11:31:47 +01:00
Jordan Yates
100fed67d3 modem: chat: use modem_pipe_transmit_chain
The modem chat module typically wants to send a command and a delimiter
per request. As the pipe API now supports sending multiple buffers in a
single call, use that API.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-07-28 11:31:47 +01:00
Jordan Yates
1d1d90113f modem: pipe: extension function for chained data buffers
Add an optional extension function for pipe backends to support sending
multiple data buffers in a single call. The primary use case for this
change is the modem chat module, which typically is sending both a
command buffer and a delimiter buffer. Merging both of these into a
single API call improves the usage efficiency of the comms medium, as
transaction setup costs are not zero.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-07-28 11:31:47 +01:00
Adrien Ricciardi
209d82ece8 shell: Increase argc count for CAN shell
The "send" command of the CAN shell allows to send also CAN FD frames,
which can contain up to 64 bytes of data.

Increase the shell argc count to be able to send a fully complete CAN FD
frame with all the payload.

The exact count of argc is determined by the following command, which
uses extended ID, enables CAN FD and bit rate switch, and specify the
maximum payload size :

can send can0 -e -f -b 12345678 00 01 02 03 04 05 06 07 08 09 10 11 12 13
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2026-07-28 11:29:19 +01:00
Jukka Rissanen
8869aa7dd5 net: dns: Log deduped resolver dispatcher registration
When registering a resolver socket, the dispatcher may reject it with
-EALREADY because it already has a registration for the same local
port. The resolver treats this as benign and skips it, but if two
distinct resolver sockets end up sharing a local port (for example when
a bound ephemeral port is not resolved and both look like port 0), the
later socket is never dispatched and replies from that server are
silently dropped.

Emit a debug message in that path so such a misconfiguration is
diagnosable instead of failing silently.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-28 11:23:51 +01:00
Jordan Yates
9cc8b3a371 net: lib: dns: dispatcher: fix ephemeral port usage
Store the OS assigned port in the DNS context so that multiple
dispatcher registrations do not treat all sockets as port 0.

Assisted-by: GPT-5.5
Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-07-28 11:23:51 +01:00
Jukka Rissanen
af02755bf4 net: dns: Bind reply acceptance to a queried server
The resolver sockets are created with zsock_socket() and are never
connect()ed, so the kernel does not filter datagrams by source. Replies
are matched to a pending query only by the 16-bit DNS id and the query
hash. With server fallback now keeping several server sockets open and
extending the time a query slot stays active, any open server socket
could be used to inject a forged reply that merely matches that id and
hash, widening the off-path spoofing window.

Track which configured server delivered each reply and drop it unless
that server was actually queried for the matching slot, using the new
per-query "sent" bitset. Late replies from a server we did query (for
example after a timeout fallback) are still accepted; multicast mDNS and
LLMNR responders, which legitimately answer from multiple hosts, are
exempt. dispatcher_cb now also bounds the computed server index before
indexing the server array.

dns_validate_msg() / dns_read() gain a recv_server_idx argument; passing
-1 disables the check, which the dns_packet unit tests use as they call
dns_validate_msg() directly without a server socket.

Add dns_resolve regression tests for both server-selection modes. In
sequential mode a reply on a not-yet-queried server is injected; in
query-all mode one server is removed from the eligible set and a reply
is injected on it. Both assert the reply is dropped while a reply from a
queried server still completes the query. Both tests fail without this
change and pass with it.

Tested with twister on native_sim: tests/net/lib/dns_resolve (all
scenarios) and tests/net/lib/dns_packet (303/303 cases pass).

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-28 11:23:51 +01:00
Jukka Rissanen
20e49c374e net: dns: Make pointer checks explicit
Cleanup old code and convert pointer null checks to be explicit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-28 11:23:51 +01:00
Jukka Rissanen
979a2dc737 net: dns: Avoid querying all servers for multicast lookups
Treat .local names as mDNS queries and single-label names as LLMNR
queries when deciding how to send resolver requests.

This keeps multicast lookups to a single send even when
CONFIG_DNS_RESOLVER_QUERY_ALL_AVAILABLE_SERVERS is enabled, while
preserving normal unicast DNS parallel sends across configured DNS
servers.

Update the LLMNR Kconfig help to describe the actual behavior and add
tests covering mDNS single-send, LLMNR single-send, and normal DNS
parallel sends with LLMNR enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-28 11:23:51 +01:00
Jukka Rissanen
b433371253 net: dns: Fall back to alternate servers
Track per-query DNS server state so unicast lookups can advance to the
next configured server when one times out or returns a failure.

Keep query-all behavior unchanged by still accepting the first
successful response when CONFIG_DNS_RESOLVER_QUERY_ALL_AVAILABLE_SERVERS
is enabled.

Scale the per-query server tracking with DNS_RESOLVER_MAX_POLL and make
the default additional buffer count follow DNS_RESOLVER_MAX_SERVERS so
the resolver has enough buffers for concurrent server connections.

This improves getaddrinfo() robustness when one configured DNS server is
down, unresponsive, or replies without usable answers.

Assisted-by: Copilot:gpt-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-28 11:23:51 +01:00
Egill Sigurdur
7afc67b99e sd: cast relative card address before shifting to fix undefined behavior
The relative card address is a 16-bit value. If bit 15 is set,
`relative_addr << 16U` promotes to a signed int before the shift,
which overflows and would be trapped by the undefined behavior sanitizer.

Signed-off-by: Egill Sigurdur <egill@egill.xyz>
2026-07-28 11:23:33 +01:00
Egill Sigurdur
209383274e sd: sdmmc: use unsigned shift to fix undefined behavior
The signed `((mode & 0x1) << 31)` is undefined behavior on
32 bit targets, and UBSAN would trap it.

Signed-off-by: Egill Sigurdur <egill@egill.xyz>
2026-07-28 11:23:33 +01:00
Alberto Escolar Piedras
a81da3641d net: sockets: Fix comment
Add missing not

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-27 11:45:17 -07:00
Alberto Escolar Piedras
7492f015ae net: sockets: Avoid busy waiting at the end of timeout in sendto()
With timeouts that do not divide evenly by the tick, because of flooring
when converting to ticks, there is a left over time in which the sendto
function would k_poll with a 0 timeout, which would return
immediately, and result in k_poll being called right again.
Effectively busy wait looping until the left time is indeed 0.

Let's avoid this busy waiting by rounding up/ceiling the numberof ms to
wait.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-27 11:45:17 -07:00
Alberto Escolar Piedras
60f89c8a00 net: sockets: tls: Avoid busy wait looping at end of with timeout
With timeouts that do not divide evenly by the tick, because of flooring
when converting to ticks, there is a left over time in which the send/recv
functions would zsock_poll with a 0 timeout, which would return
immediately, and result in zsock_poll being called right again.
Effectively busy wait looping until the timeout is indeed 0.

Let's avoid this busy waiting by rounding up/ceiling the numberof ms to
wait.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-27 11:45:17 -07:00
Fin Maaß
4343116dec net: ip: context: remove net_context_init
remove net_context_init and replace it
with a build time init.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-27 11:44:43 -07:00
Jukka Rissanen
dc1477ebf2 net: mdns_responder: Check iface null before use
Make sure iface pointer is not null before checking network
interface flags.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-27 11:37:07 -07:00
Jukka Rissanen
6c64738a03 net: mdns: Add runtime per-interface responder control
Building on the build-time interface policy, add a runtime API so the
application can turn the mDNS responder on or off for a specific network
interface after boot:

  int mdns_responder_enable_iface(struct net_if *iface);
  int mdns_responder_disable_iface(struct net_if *iface);

The functions are gated by the new
CONFIG_MDNS_RESPONDER_RUNTIME_IFACE_CONTROL option; when it is not set,
inline stubs return -ENOTSUP. A per-interface runtime override takes
precedence over the build-time policy, so an interface excluded by the
policy can still be enabled once its hardware is ready, and an interface
the policy would enable can be turned off.

The same mdns_iface_is_enabled() predicate now consults the runtime
state first and falls back to the policy. Changing the state rebuilds
the listeners: the responder tears down its listener sockets and leaves
the mDNS multicast groups, then re-runs the existing setup path which
recreates sockets and rejoins the groups only on the interfaces that are
still enabled. This reuses init_listener() (and pre_init_listener() when
probing is enabled) rather than duplicating the per-interface setup, and
is serialized with a mutex. Rebuilds are deferred until the initial
listener setup has run.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-27 11:37:07 -07:00
Jukka Rissanen
7592cf729a net: mdns: Add per-interface responder policy
By default the mDNS responder attaches to every network interface in
the system. On multi-interface devices this is not always desirable:
some interfaces have hardware that is not ready when the responder
initializes (leading to boot-time socket allocation failures), and
secondary interfaces often have no need for local service discovery
and should not spend a socket and multicast membership on it.

Add a build-time interface policy so the application can restrict
where the responder operates:

  CONFIG_MDNS_RESPONDER_IFACE_POLICY = ALL (default) | ALLOWLIST |
                                       DENYLIST
  CONFIG_MDNS_RESPONDER_IFACE_LIST   = comma separated interface names

Interface names are matched instead of interface indexes because the
indexes can change with configuration. The non-default policies select
NET_INTERFACE_NAME so name lookup is always available.

A single mdns_iface_is_enabled() predicate consults the policy and is
checked at every point that binds the responder to an interface:
listener socket creation, the IGMP/MLD multicast joins, the probe
pre-init contexts, and the interface/address management event handlers.
Disabled interfaces therefore never get a socket, never join the mDNS
groups, and never schedule probing or recovery rejoins. The default
ALL policy keeps the previous behavior.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-27 11:37:07 -07:00
Mathieu Choplain
ad9dd33694 settings: use autogenerated Kconfig variable for compatible
Instead of manually defining a variable for the compatible's name, use
the one that gets autogenerated upon build.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-07-27 14:43:22 +02:00
Mathieu Choplain
fe5d52c3a7 secure_storage: its_store: use autogenerated Kconfig variable
Instead of manually defining a variable for the compatible's name, use
the one that gets autogenerated upon build.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-07-27 14:43:22 +02:00
Fin Maaß
7eb38c9411 net: ethernet: arp: remove arp_cache_initialized
Starting from commit 7710704 ("net: core: Initialize ARP during network
initialization once only"), the net_arp_init() is called once during
net_post_init. This means we don't need to set the init flag any more.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-27 14:41:56 +02:00
Fin Maaß
01dc85e7fc net: ethernet: arp: use NET_MGMT_REGISTER_EVENT_HANDLER
use NET_MGMT_REGISTER_EVENT_HANDLER,
so we no longer need to init that part during
runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-27 14:41:56 +02:00
Fin Maaß
c4590b767d net: ethernet: arp: use static init
use static init defines to init them during build,
so we don't have to init them during
runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-27 14:41:56 +02:00
Fin Maaß
e83bc7f26a net: ipv4_autoconf: use NET_MGMT_REGISTER_EVENT_HANDLER
use NET_MGMT_REGISTER_EVENT_HANDLER
and then remove the no longer needed init
function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-27 14:41:56 +02:00
Flavio Ceolin
a1fb7e3c69 Bluetooth: controller: combine OR'd CTE type checks
(cte_types & A) || (cte_types & B) is equivalent to
cte_types & (A | B). Collapse the BT_HCI_LE_AOD_CTE_RSP_1US / _2US test
into a single masked check. No change in behavior.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
069bab2e04 Bluetooth: host: keys: combine OR'd key flag checks
(keys->flags & A) || (keys->flags & B) is equivalent to
keys->flags & (A | B). Collapse the BT_KEYS_OOB / BT_KEYS_SC test into a
single masked check.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Alejandro Lara Raigada
5de69e078a logging: frontend: stmesp: Use CONFIG_LOG_FRONTEND_STMESP_TURBO_LOG_BASE
Replace hardcoded 0x8000 base address values with
the CONFIG_LOG_FRONTEND_STMESP_TURBO_LOG_BASE
configuration parameter. This parameter was previously
defined but never used. Using it makes
the code more configurable and allows the base address
to be adjusted via kconfig without
modifying source code.

Signed-off-by: Alejandro Lara Raigada <Alejandro.Lararaigada@analog.com>
2026-07-24 12:40:30 -07:00
Alberto Escolar Piedras
a408be9067 shell: telnet: Initialize addr to avoid unitialized use warning
Without optimizations the compiler does not follow how addr may be used,
only that it passed to zsoc_accept. And warns that it may be used
unitialized. Let's initialize it to zero to silence this warning.

If optimizations are used, the compiler should anyhow drop the
initialization.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-24 12:39:28 -07:00
Łukasz Stępnicki
0b065e4dc0 task_wdt: make hardware watchdog pause-on-debug configurable
Add CONFIG_TASK_WDT_HW_FALLBACK_PAUSE_HALTED_BY_DBG Kconfig option to
control whether the hardware fallback watchdog is paused when the system
is halted by the debugger. The option is enabled by default to preserve
the previous behavior.

Previously, WDT_OPT_PAUSE_HALTED_BY_DBG was unconditionally passed to
wdt_setup(), which could cause issues on hardware watchdogs that do not
support this option. The flag is now conditionally compiled in, guarded
by the new Kconfig symbol.

Signed-off-by: Łukasz Stępnicki <lukasz.stepnicki@nordicsemi.no>
2026-07-24 14:10:49 +02:00
Tim Lin
591aebf3a7 mgmt: ec_host_cmd: shi_ite: Switch pinctrl states during device PM
Apply the default pinctrl state during PM_DEVICE_ACTION_RESUME to restore
normal SHI operation.
Apply the sleep pinctrl state during PM_DEVICE_ACTION_SUSPEND to disable
the SHI interface pins and prevent leakage.

This lets board/shim code control the pin state purely via
pm_device_runtime_get()/put().

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2026-07-24 14:10:12 +02:00
Jukka Rissanen
ea55c1a457 net: quic: Bound-check ClientHello extension writes
build_client_hello() only verified that the output buffer was at least
256 bytes before starting to serialize the ClientHello. The fixed
prologue fits in that budget, but the variable-length extensions
(key_share, ALPN, quic_transport_parameters and the pre_shared_key
block) as well as the fixed extensions that follow a large SNI can still
run past the end of the buffer, corrupting adjacent memory.

Add a bounds check in front of every remaining extension write so the
function returns -ENOBUFS instead of overflowing when the caller's
buffer is too small. The checks mirror the existing SNI guard: compute
the number of bytes about to be written and compare against buf_size.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-24 09:44:52 +02:00
Jukka Rissanen
01c6b05e2c net: quic: Map TLS handshake failures to crypto alerts
TLS handshake failures in the CRYPTO frame path surfaced as a generic
FRAME_ENCODING_ERROR (or no CONNECTION_CLOSE at all), giving a standard
QUIC peer no useful reason for the failure.

Map the errno returned by the handshake/certificate processing to the
matching TLS alert in a 0x0100 + alert CONNECTION_CLOSE (RFC 9001
Section 4.8): bad_certificate, decrypt_error, no_application_protocol,
handshake_failure, internal_error and decode_error. -EPROTO (CRYPTO
overlap / prohibited KeyUpdate) stays a transport PROTOCOL_VIOLATION and
-ENOMEM stays CRYPTO_BUFFER_EXCEEDED.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-07-24 09:44:52 +02:00