Commit graph

7,343 commits

Author SHA1 Message Date
Robert Lubos
2f6c075166 Revert "net: lwm2m: finalize CBOR output on -ENOMEM instead of aborting"
This reverts commit 9401406e6a.

This patch was reverted due to regressions reported in #109814 (cached
timeseries data loss).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-29 22:10:39 +02:00
Valerio Setti
c15cba4e7a modules: mbedtls: rename mbedTLS library and documentation usage
Having an interface library named "mbedTLS" and the real library named
"mbedtls" (as provided by the Mbed TLS module) is misleading.
This commit replaces:
- mbedTLS -> mbedtls_iface for the CMake library. "mbedTLS" is still
             available as alias to "mbedtls_iface" for backward
             compatibility, but this should be removed in the future.
- mbedTLS -> Mbed TLS in comments and documentation.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-05-27 15:16:06 +01:00
Robert Lubos
ba241c02eb net: lwm2m: Fix uninitialized arrays in sm_send_registration()
Fix uninitialized variable use reported by Valgrind. Could be a false
positive, as those arrays are filled in lwm2m_engine_get_binding() and
lwm2m_engine_get_queue_mode(), but as binding and queue buffers are
small just initialize them with 0's to satisfy Valgrind.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-25 13:43:58 +02:00
Fin Maaß
5b19748621 net: dns: fix fypo
It should be `too big` instead of
`to big`.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-22 21:57:28 +02:00
Fin Maaß
e6ecdd445d net: lib: http: shell: cast .* to int
For use of .* we need to cast it to an int, on 64 bit platforms
a size_t is bigger than an int.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-22 21:57:28 +02:00
Fin Maaß
3ba75f9339 net: ftp: use correct length sub-specifier
use correct length sub-specifier when
printing a size_t.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-22 21:57:28 +02:00
Fin Maaß
0e637b5ab0 net: midi2: use correct length sub-specifier
use correct length sub-specifier when
printing a size_t.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-22 21:57:28 +02:00
Fin Maaß
177b8d04e0 net: mqtt: use correct length sub-specifier
use correct length sub-specifier when
printing a size_t.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-22 21:57:28 +02:00
Fin Maaß
fa95677f93 net: dns: use correct length sub-specifier
use correct length sub-specifier when
printing a size_t.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-22 21:57:28 +02:00
Kapil Bhatt
15f19e7ea1 wifi: shell: Fix domain suffix parshing in connect command
In wifi connect command, domain suffix option "x" is missing in getopt.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2026-05-22 21:56:06 +02:00
Ricardo Tafas
65c3ff1541 net: dhcpv4_server: adding support to RFC8910 to DHCPv4 server.
Add optional DHCP option 114 (Captive-Portal Identity, RFC 8910) to the
Zephyr DHCPv4 server. When enabled, the server includes the option in
Offer and Acknowledgment messages when the client requests it via DHCP
option 55 (Parameter Request List), so clients can discover a captive
portal URI on isolated networks (e.g. SoftAP provisioning).

Introduce CONFIG_NET_DHCPV4_SERVER_OPTION_CAPTIVE_PORTAL to gate the
feature and CONFIG_NET_DHCPV4_SERVER_OPTION_CAPTIVE_PORTAL_URI for an
optional URI override. If the override string is empty, the server
builds http://<IPv4-on-DHCP-interface>/generate_204 from the address
stored in the server context when the server starts (ctx->server_addr).

Tested by building an application with
CONFIG_NET_DHCPV4_SERVER_OPTION_CAPTIVE_PORTAL=y and confirming DHCP
Offer/ACK include option 114 when listed in the client's parameter
request list on a SoftAP network.

Signed-off-by: Ricardo Tafas <ricardo.tafas@espressif.com>
2026-05-21 17:02:57 -04:00
Jukka Rissanen
4dd1b9e470 net: route: Add additional checks for missing interface
Make sure network packet contains the network interface pointer
when IP packet is routed. Add tests that verify that interface
is always checked in routing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
a06736ae47 net: if: Check VPN capability bits properly
The original VPN capability bit check was too strict and would
fail if the virtual interface had more capabilities configured.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
77d91cb773 net: route: Constify IP address function parameter
The IP address parameter in the following functions
was changed to be "const struct net_in..."

net_route_ipv4_lookup()
net_route_ipv4_get_info()
net_route_ipv4_packet()
net_route_ipv6_lookup()
net_route_ipv6_get_info()
net_route_ipv6_packet()
net_ipv6_nbr_lookup()

This will make sure that the IP address cannot be changed by the
function.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
40ded8a8eb net: ip: Clarify route and forwarding Kconfig
Make the per-family unicast route-table options user visible and
separate them more clearly from packet forwarding.

Expose NET_IPV4_ROUTE and NET_IPV6_ROUTE as the route-table support
symbols used for static routes, shell route commands, and host-side
route selection. Rename NET_IPV4_ROUTING and NET_IPV6_ROUTING to
NET_IPV4_FORWARDING and NET_IPV6_FORWARDING so the forwarding options
describe router behavior only.

Keep the old routing symbols as deprecated compatibility aliases,
move orig_iface packet metadata behind an internal helper symbol, and
update route test configs to select the route-table options
explicitly. Also add migration-guide notes so out-of-tree users know
how the old and new symbols map.

Assisted-by: Copilot:GPT-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
cf0e781591 net: ipv4: Allow explicit default routes
Allow IPv4 route entries to use 0.0.0.0/0 as an explicit default
route. The route core already supports prefix length 0, but the
IPv4-specific add path rejected the unspecified address outright.

Keep rejecting unspecified IPv4 route destinations for all non-zero
prefix lengths, and only accept 0.0.0.0 when the prefix length is 0.

Add regression coverage to verify that an explicit IPv4 default
route can be added, looked up, and returned through route info with
the configured nexthop.

Assisted-by: Copilot:GPT-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
ee2aa22332 net: shell: Extend route check for WireGuard routes
Enhance "net route check" so it does more than print the selected
egress interface for WireGuard VPN routes. When the resolved route
uses a WireGuard interface, also report whether the destination is
covered by the peer's AllowedIP list and whether the peer currently
has usable session state for transmission.

This makes the command much more useful when debugging VPN routing,
as it now explains why traffic selected for a WireGuard interface may
still not be sendable.

Also handle on-link routes without a nexthop explicitly in the route
output instead of assuming a nexthop address is always present.

Assisted-by: Copilot:GPT-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
6b1a5e72a3 net: wireguard: Enforce AllowedIP on egress
WireGuard already validates inbound inner packets against the peer's
AllowedIP list, but outgoing inner packets were accepted without
checking whether the destination belonged to that peer.

Add a shared AllowedIP match helper and use it for both directions.
Ingress still validates the decrypted packet source address, and
egress now validates the inner destination address before starting a
handshake or encrypting the packet.

Keep empty keepalive packets exempt from the check so normal session
maintenance traffic still works.

Assisted-by: Copilot:GPT-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
83c0670157 net: shell: route: Add check command to show the used route
Add "net route check <destination>" command that will show
how the routing will be done.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
5384460392 net: ipv6: Use configured prefix in VPN source matching
When IPv6 routing is disabled, net_if_ipv6_get_best_match()
applies a VPN-specific filter to avoid selecting the virtual
interface for unrelated destinations. That filter assumed a /64
prefix for every VPN address.

Replace the hard-coded /64 with the configured IPv6 prefix of the
candidate source address. If no matching prefix is configured, only
then assume /64 prefix length.

This keeps the no-routing VPN heuristic intact without rejecting
valid non-/64 setups or relying on an implicit subnet size.

Assisted-by: Copilot:GPT-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
c81524ac5c net: ipv6: Allow VPN routes without ND neighbor entries
Treat VPN virtual interfaces as non-ND links in the IPv6 route
transmit path.

Routed IPv6 traffic on WireGuard-style interfaces could fail even
with a valid route, because the route code still required an IPv6
neighbor-cache entry for the configured nexthop. That assumption is
wrong for VPN interfaces that do not use normal L2 neighbor
discovery.

Assisted-by: Copilot:GPT-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
353a28a732 net: shell: events: Add IPv4 route add/del print support
Show IPv4 route add and delete information when those network
management events are triggered.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
42bafa21c8 net: ipv6: Honor routes in local source selection
Make locally originated IPv6 traffic consult route state
before falling back to the default interface.

Local source/interface selection could previously choose the default
interface before checking explicit host or prefix routes. That let
configured gateway paths win over more specific routes on another
interface, which breaks VPN and similar multi-interface setups.

Add route-aware helpers in net_if.c and use them in IPv6
source/interface selection paths. The IPv6 path checks
neighbor state before route and default-router fallback so local
selection stays aligned with actual egress routing.

Assisted-by: Copilot:GPT-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
c9b8847e58 net: ipv4: Honor routes in local source/interface selection
Teach local IPv4 source/interface selection to consult the IPv4
route table before falling back to the default interface.

Locally originated traffic such as shell ping selected its outgoing
interface via net_if_ipv4_select_src_iface(). When no source address
matched the destination subnet, the code fell back to the default
interface immediately. This bypassed explicit IPv4 routes on other
interfaces, so traffic could be sent through default interface even
when a host route existed on another interface.

Add a helper that resolves the route-selected interface first and use
it in both net_if_ipv4_select_src_iface_addr() and
net_if_ipv4_select_src_addr(). This keeps source address selection
aligned with the actual routed egress interface.

Assisted-by: Copilot:GPT-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
2420c9bd9d net: iface: Only have special VPN check if routing is disabled
If routing is disabled, then do extra check with VPN connection
so that the system will work like before.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Jukka Rissanen
b5f857984e net: shell: route: Skip ifaces that do not have IP config
If a network interface does not have IP address configuration
in it, then it cannot be used for IP routing so skip those
interfaces when viewing the routing information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-21 06:32:22 -04:00
Cristian Bulacu
da0a429085 net: dns: Allow DNS queries to be sent to multiple DNS servers
This commit introduces a new option that enables querying all available
DNS servers simultaneously.
When enabled, DNS queries will be sent to all available DNS servers
concurrently rather than just the first server. The first valid response
received will be used and returned to the application.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-05-20 14:12:33 +02:00
Tim Pambor
baca7b10a8 net: arp: fix wrong destination MAC address for pending packets
When a ARP reply is received, the destination MAC address
in net_pkt was set from the destination address in the
ethernet header, but the pending packet does not have a
ethernet header yet. This caused the destination MAC to
be set to the first bytes of the IP header.

Set the destination MAC address from the updated ARP
entry.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-05-20 14:11:32 +02:00
Jukka Rissanen
1f3bbab11b tests: net: http_server: Cover HTTP/3 request header capture
Enable request header capture in the HTTP/3 test target and add
regression coverage for captured headers on QUIC request streams.

Add one test for a GET request and one for a POST request so the
suite verifies both immediate delivery and the deferred first DATA
callback path used by body-carrying HTTP/3 requests.

Assisted-by: Copilot:gpt-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-20 10:57:44 +02:00
Jukka Rissanen
99218a3c5a net: http: Capture request headers for HTTP/3
Feed decoded QPACK request headers into the existing header capture
path so HTTP/3 exposes captured headers the same way as HTTP/1 and HTTP/2.

Keep the capture state per HTTP/3 stream and restore it with the
rest of the stream state. This avoids concurrent request streams
overwriting each other's captured headers and keeps header-only and
body-carrying requests working correctly.

Dynamic HTTP/3 handlers now receive captured headers on the first
application callback, including requests that do not deliver the
body until a later DATA frame.

Assisted-by: Copilot:gpt-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-20 10:57:44 +02:00
Flavio Ceolin
aa317825a5 net: sockets/tls: valide buffer in peer_connection_id_value_get
mbedtls_ssl_get_peer_cid() always writes MBEDTLS_SSL_CID_OUT_LEN_MAX
bytes into the destination buffer regardless of the actual CID length.
tls_opt_dtls_peer_connection_id_value_get() passed the caller-supplied
optval directly without checking it was large enough, allowing an OOB
write of up to 31 bytes past the buffer end.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-05-19 17:49:47 -04:00
Nicolas Pitre
90d1963745 sys: util: move lowercase min/max/clamp to a new minmax.h
Since commit 37717b229f ("sys: util: rename Z_MIN Z_MAX Z_CLAMP to min
max and clamp"), <zephyr/sys/util.h> unconditionally defines function-
like macros named `min`, `max`, and `clamp` in the global namespace (in
C mode). util.h gets pulled in transitively by very broad headers,
including the POSIX layer's <pthread.h>, so any third-party C code that
uses these names as ordinary identifiers (e.g. XNNPACK's static `clamp`
helper and its public `clamp` struct field) fails to build as soon as
<pthread.h> is included.

Following the approach used by Linux, move the lowercase `min`, `max`,
`min3`, `max3`, and `clamp` macros (and their helpers) into a new
<zephyr/sys/minmax.h> header that has to be included explicitly by
source files that want them. util.h keeps the uppercase MIN/MAX/CLAMP,
so most code is unaffected; only the (much smaller) set of files that
actually use the lowercase variants needs to pick up the new include.

Fixes #107853.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-05-19 17:49:24 -04:00
Jukka Rissanen
5c60b811f9 net: http: Fix linking issues with clang
There is a linking failure if using clang and no optimizations

subsys/net/lib/http/http_server_core.c:1060:
   (.text.handle_listen_pollin+0x159):
   undefined reference to `accept_h3_connection'
subsys/net/lib/http/http_server_core.c:1101:
   (.text.handle_listen_pollin+0x425):
   undefined reference to `h3_open_uni_streams'

When CONFIG_NO_OPTIMIZATIONS=y was set.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-19 17:48:58 -04:00
Yangbo Lu
f77b86dfdd net: gptp: define public APIs to access gptp port number
Defined public APIs to access gptp port number.
- gptp_get_port_number
- gptp_set_port_number

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-19 14:59:12 +01:00
Yangbo Lu
25e7e284d8 net: gptp: fix ethernet_context->port definition
The member port of ethernet_context and the related APIs
net_eth_get_ptp_port/net_eth_set_ptp_port were actually
gPTP specific. The purpose was to store gPTP port number.

Let's rename port to gptp_port and define it under
CONFIG_NET_GPTP instead of CONFIG_NET_L2_PTP. And use
uint16_t for gPTP port number per IEEE 1588 standard.
This is very clear.

Dropped the APIs from ethernet, and would define public
gptp_get_port_number and gptp_set_port_number in gptp
stack instead.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-19 14:59:12 +01:00
Yangbo Lu
7366325360 net: gptp: convert to use GPTP_PORT_INDEX
GPTP_PORT_INDEX was defined but not used.
Improved it and converted to use it.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-19 14:59:12 +01:00
Yangbo Lu
4f07c53a6b net: gptp: fix gPTP port number checking
There was some misunderstanding of current GPTP_PORT_END definition.
GPTP_PORT_END was not the last gPTP port, but (GPTP_PORT_END - 1) was.
There were some wrong checking. For example,

for (port = GPTP_PORT_START; port <= GPTP_PORT_END; port++)

This patch is to make GPTP_PORT_END as the last gPTP port number to
avoid misunderstanding, and also to fix related checking.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-19 14:59:12 +01:00
Yangbo Lu
22c501a24f net: gptp: fix gPTP port number getting
Even for non-gPTP interface, current code was always getting
1 as gPTP port number, which is GPTP_PORT_START.

int port = net_eth_get_ptp_port(iface) + 1;

This patch is to fix this by directly setting gPTP port number
into ethernet_context.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-19 14:59:12 +01:00
Robert Lubos
335ae86b5f net: iface: Skip multicast group clearing/rejoining if MLD is disabled
The multicast group join flag clearing on iface down, and then rejoining
on iface up was added so that MLD reports are sent on the interface when
it goes back up. This should not be the case though for interfaces with
disabled MLD.

Currently this was only partially handled, and with a wrong flag
(NET_IF_IPV6_NO_ND), i.e. the join flag was cleared on the iface down,
but it was not reenabled on iface up, if NET_IF_IPV6_NO_ND was set
(which is the case for OpenThread).

Therefore clean up the flag usage, use NET_IF_IPV6_NO_MLD to decide
whether to clear/rejoin the mcast group join flag, and use
NET_IF_IPV6_NO_ND specifically to decide whether to add multicast
addresses needed for Neighbor Discovery to the interface on iface up.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-19 11:57:23 +01:00
Maochen Wang
742b0e79ce net: l2: wifi: Add Kconfig option to control automatic DHCPv4 start
Add a new Kconfig option WIFI_STA_AUTO_DHCPV4 to allow applications
to control whether DHCPv4 client should be automatically started by
the Wi-Fi driver or supplicant after STA connection is established.
This addresses the use case where applications need to switch between
static IP addressing and DHCP, or prefer to manually control when
the DHCP client starts.
When CONFIG_WIFI_STA_AUTO_DHCPV4=n, the application layer becomes
responsible for either manually starting the DHCPv4 client or
configuring a static IPv4 address after Wi-Fi connection is established.
The option defaults to 'y' to maintain backward compatibility with
existing behavior.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2026-05-19 09:43:57 +02:00
Jukka Rissanen
13b520b287 net: shell: cm: Update the helper text
Unify the helper text with other network shell commands so that
we can save some flash memory.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-19 09:41:06 +02:00
Tim Pambor
ca3476979a net: shell: quic: Fix -Wformat warning on 64-bit platforms
Use the PRIu64 macro from inttypes.h to format the stream ID,
which is of type uint64_t. This change resolves the -Wformat
warning on 64-bit platforms:

format '%llu' expects argument of type 'long long unsigned int',
but argument 6 has type 'uint64_t' {aka 'long unsigned int'}

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-05-17 10:42:28 +02:00
Petr Hlineny
b8d5f52be9 net: l2: ppp: lcp: do not pass through DEAD on transient down
When LCP receives a Configure-Request while in OPENED state
(peer-initiated renegotiation, RFC 1661 §4.2), the FSM core invokes
the LCP down callback (lcp_down). The previous implementation
called ppp_link_down(), which unconditionally set the PPP phase
to PPP_DEAD before lcp_down restored PPP_ESTABLISH. The
intermediate PPP_DEAD fired NET_EVENT_PPP_PHASE_DEAD; net_mgmt
subscribers (notably the modem cellular driver) treated it as link
loss and tore the carrier down even though LCP would have
renegotiated cleanly on its own.

ppp_change_phase() already detected the resulting NETWORK -> DEAD
transition as invalid via validate_phase_transition() but only
logged it.

Inline ppp_link_down() into lcp_down() and skip the intermediate
PPP_DEAD write: pick the final phase directly based on whether the
carrier is still up and LCP is still enabled. The end state matches
the previous implementation in every case; only the spurious DEAD
event between the two phase changes is removed.

ppp_link_down() had only this one caller and is therefore removed
from link.c along with its prototype in ppp_internal.h.

Also extend validate_phase_transition()'s rules table to cover the
transitions reachable through the new lcp_down:

  - AUTH / NETWORK / RUNNING -> ESTABLISH: reachable when LCP
    renegotiates and no NCP was OPENED at the time, so
    ppp_network_all_down() does not transit the phase further.

  - TERMINATE -> ESTABLISH: reachable when LCP renegotiates while
    at least one NCP was OPENED. ppp_network_all_down() then
    invokes the NCP cb.down callbacks, which through
    ppp_network_down() decrement network_protos_up to zero and
    write PPP_TERMINATE. The final change_phase(PPP_ESTABLISH) in
    lcp_down is then observed as TERMINATE -> ESTABLISH.

  - AUTH / NETWORK / RUNNING -> DEAD: reachable when carrier is
    lost or LCP is disabled with no NCP OPENED. (When at least one
    NCP was OPENED the path goes via TERMINATE -> DEAD which was
    already valid; the rule is added defensively for the no-NCP
    case where no intermediate TERMINATE write occurs.)

Empirically observed and verified on a Quectel BG770S over 3GPP
CMUX: after the initial LCP completes and IPCP starts, the modem
occasionally sends a fresh LCP Configure-Request mid-session;
without this fix the cellular driver tore the connection down on
the spurious PHASE_DEAD event.

Signed-off-by: Petr Hlineny <development@hlineny.cz>
Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 23:27:05 +02:00
Paulo Santos
a04de416ad net: dns: add NET_EVENT_DNS_SERVERS_RECONFIGURED
dns_resolve_reconfigure() skips NET_EVENT_DNS_SERVER_ADD when the new
server set is identical to the existing one, to avoid cancelling
in-flight queries on DHCP retransmit and IPv6 RA. The event is therefore
a per-slot delta, not a configuration-refresh signal: consumers that
wait on it as a "DNS is now configured" indicator after a network event
miss every reconfigure that re-applies the same servers.

Add NET_EVENT_DNS_SERVERS_RECONFIGURED, raised on every successful
reconfigure including the deduplicated case.

Signed-off-by: Paulo Santos <paulo.santos-ext@hexagon.com>
2026-05-15 12:36:23 -05:00
Robert Lubos
55be451592 net: lwm2m: Add include guard in lwm2m_pull_context.h
Include guard was missing in lwm2m_pull_context.h internal header.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-15 12:34:45 -05:00
Robert Lubos
b96deb12ad net: lwm2m: Align URI size in FW object with FW pull helper
Use the same size for the URI buffer in the FW object implementation as
in the FW pull download helper module. That way, if the server writes
too long URI to handle in the FW pull mode, it'll get an error response
immediately instead of failing at firmware download start.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-15 12:34:45 -05:00
Robert Lubos
99a164df5c net: lwm2m: Verify URI string length before use in FW pull mode
Verify the URI length provided to lwm2m_pull_context_start_transfer()
before use, otherwise in case the URI string is longer than the buffer,
only part of it was copied w/o NULL terminator, which could lead to
out-of-bound reads and other undefined behavior.

As the string length is now validated, just use strcpy() instead of
memcpy(), no need to copy the whole buffer.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-15 12:34:45 -05:00
Philipp Steiner
24d6070990 tests: net: ptp: validate RX timestamp cmsg length
Return an error when an SO_TIMESTAMPING control message is present but
too short to contain struct net_ptp_time. Keep the existing fallback
behavior for receive paths where no timestamp control message is present.

This makes malformed timestamp ancillary data explicit instead of hiding
it behind the missing-timestamp fallback path, and adds L2/IPv4 regression
coverage for both malformed and absent timestamp control messages.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-05-15 12:31:42 -05:00
Fin Maaß
d692931947 cmake: qemu: move qemu network interface selection
move qemu network interface selection, because it fits better in
cmake/emu/qemu.cmake than in cmake/modules/kernel.cmake.
It is also put at the end because for usb network cards, the usb bus
must be created before the network interface can be added. Also true
for other network cards on buses. Currently we don't have usb network
cards in zephyr, but it is better to be prepared for that.

Also use the separate netdev and device option.
The combined command line option didn't work for "usb-net" for example.
For the riscv qemu the -nic option is broken acording to the qemu issue
(https://gitlab.com/qemu-project/qemu/-/work_items/691), so we need to
use the -netdev and -device options.

Because of the change to -netdev and -device options, we need a new
Kconfig option to specify the extra arguments for the network device,
so we add NET_QEMU_DEVICE_EXTRA_ARGS option.
this can be used to customise the network device, like the mac address,
or more device specific options like setting f.e. the addresss/slot of
a pci card.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-15 12:29:28 -05:00
Tim Pambor
8a49fe4862 net: shell: route: fix sometimes uninitialized warning
Init route to NULL to avoid sometimes uninitialized warning
reported by clang.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-05-15 15:20:13 +02:00