Commit graph

6,767 commits

Author SHA1 Message Date
Cristian Bulacu
c341838502 net: ip: route: Add support to search mcast route by iface
This commit adds the possibility to check for a multicast route on a
given interface

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-10-31 20:01:55 -04:00
Jukka Rissanen
60f83dca7d net: Do not access possibly freed net_pkt
As the net_pkt might have already been sent by net_if_try_send_data()
function, the pkt might already contain garbage data. So do not try
to access if after that send call but remember the used iface and family
and use them to update the statistics.

The issue was seen with qemu_x86_64 and qemu_cortex_a53 when CONFIG_SMP
was enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-31 22:41:07 +02:00
Jukka Rissanen
73315dd73d net: shell: stats: Fix undefined function call
If CONFIG_NET_STATISTICS_PER_INTERFACE is not set, then the
net_shell_print_statistics_all() function was not found and
the compilation was failing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-31 10:33:47 -04:00
Simon Walz
fd780ae34e net: lwm2m: fix missing name entries for time-serialized resource instances
The LwM2M SENML JSON/CBOR decoder expects a name entry for every
time-serialized record. While this was already the case for resources,
resource instances were missing their corresponding name entries. This
change ensures consistency by adding name entries for resource instances
as well.

Signed-off-by: Simon Walz <simon.walz@autosen.com>
2025-10-29 20:18:30 +02:00
Jukka Rissanen
a02414a9bc net: zperf: Use %zd when printing size_t variable
Wrong printf format was using for size_t variable which caused
compiler warning and a failure.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-29 13:47:21 +02:00
Anas Nashif
303af992e5 style: fix 'if (' usage in cmake files
Replace with 'if(' and 'else(' per the cmake style guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-29 11:44:13 +02:00
Cristian Bulacu
ecb5db6c92 samples: net: openthread: border_router: Fix packet forwarding bug
This commit fixes an issue introduced in #97531. Multicast routes added
by application are now set to have a prefix length of 16 bits instead of
128. This will allow multicast routing to all IPv6 addresses from those
groups.

For the OpenThread multicast listener callback, route length will be set
to 128 bits, as a MLD event is expected when an address is subscribed.
Route lookup has been removed since one will always be found as the
application registers multicast routes with same scope, but with a
smaller prefix length.

Fixed issue regarding packet forwarding and BBR state. Previously, code
was covering only the case wehn BBR was secondary and packet was
received from backbone interface. A secondary BBR should not forward a
multicast packet from OT interface to backbone interface and vice versa.

Improved unicast forwarding function to return from the beginning if the
packet has a multicast destination.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-10-29 10:32:42 +02:00
Pan Gao
40256a919d net: l2: wifi: Fix btwt_setup command parameter count
command btwt_setup maximum support max 12 optional parameters.

Signed-off-by: Pan Gao <pan.gao@nxp.com>
2025-10-28 11:50:02 +02:00
Jukka Rissanen
ec3bcd3930 net: tcp: Close all connections when interface goes down
If the network interface goes down, close all TCP connections
that are bound to that interface. The reasoning here is that we
need a way to remove IP address from the interface and it might
not be possible if there is a TCP socket that is bound to that address.
If the interface comes back on, we might get the same IP address in
which case the socket closure was not really needed but it is not
possible to know in advance.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-27 07:32:28 -04:00
Jukka Rissanen
1f5c285279 net: tcp: Allow immediate connection tear down
If the network interface goes down, then we do not have any time
to tear down TCP connection gracefully because there is no more
a connection to send data to. In this case the TCP connection is
forcefully closed without going into FIN_WAIT_1 state.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-27 07:32:28 -04:00
Valerio Setti
fa911df90c modules: mbedtls: rename MBEDTLS_DTLS
Align Kconfig name to the Mbed TLS build symbol.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-10-24 13:27:59 -04:00
Valerio Setti
f960db846c modules: mbedtls: rename MBEDTLS_TLS_VERSION_1_2
Align Kconfig name to the Mbed TLS build symbol.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-10-24 13:27:59 -04:00
Valerio Setti
e1117f18fc modules: mbedtls: rename MBEDTLS_MD
Align Kconfig name to the Mbed TLS build symbol.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-10-24 13:27:59 -04:00
Pieter De Gendt
d43b48daf5 net: l2: wifi: mgmt: Fix auto-connect with multiple saved credentials
Using the Wi-Fi credentials system, we need to stop connecting with stored
credentials once a connection has been successful.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-24 13:19:21 -04:00
Valerio Setti
9c13bfd5d7 net: ip: ipv6: replace legacy crypto with PSA API
Zephyr's long term goal for crypto support is to use only PSA API. This
commit replaces usages of MD with proper PSA API for HMAC.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-10-23 18:02:56 +02:00
Jordan Yates
51b424e2f0 tests: modem: ppp: test custom ACCM's
Test the wrapping functions with custom asynchronous command character
maps.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-23 08:02:28 +02:00
Jordan Yates
fbb84c7c0c net: l2: ppp: lcp: accept ASYNC_CTRL_CHAR_MAP option
Accept the `ASYNC_CTRL_CHAR_MAP` option in configuration messages from
the peer. The map is reset to the default value each time the interface
comes up.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-23 08:02:28 +02:00
Jordan Yates
13d35288bd net: l2: ppp: expose the peer ACCM
Expose the currently configured value for the PPP peers Asynchronous
Control Character Map through a public function.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-23 08:02:28 +02:00
Michael Zimmermann
4b2cbe8d4d net: mqtt_sn: fix returning address from zsock_recvfrom
The fix in 1264a923f3 was incomplete, because
it doesn't initialize the variable. To quote from opengroup [1]:
address_len
    Either a null pointer, if address is a null pointer, or a pointer to a
    socklen_t object which on input specifies the length of the supplied
    sockaddr structure, and on output specifies the length of the stored
    address.

This caused the returned address to be incomplete, because it got truncated
depending on what addrlen_local got initialized with implicitly. This broke
talking to discovered MQTT-SN gateways.

I intend to implement integration tests for the MQTT-SN UDP transport to
prevent such issues in future, but that will be done in a separate PR.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-10-22 18:05:41 -04:00
Cla Mattia Galliard
80d00b5ec1 net: tc-mapping: Fix SKIP_FOR_HIGH_PRIO
Adjust the way the SKIP option worked. Before this patch, a constant
priority offset was considered "high priority" this had the effect, that
the threads assigned to work on the priority were effectively usesless.
To fix it, consider this immediate handling as a pseudo-queue and compute
the tc-thead-mapping based on the effective count (+1 if skipping is
enabled). This makes it so that all threads are usefull and the
high-priority skip-path is considered as a pseudo tc-thread.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-10-22 18:33:43 +03:00
Cla Mattia Galliard
27effdb727 net: tc_mapping: Use preprocessor
Avoid token pasting and use preprocessor more for additional flexibility.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-10-22 18:33:43 +03:00
Cristian Bulacu
5cd223bc4b net: l2: openthread: openthread_border_router: Update address events
This commit refactored IPV6 and IPV4 address events. Events have been
defined independently for each installed callback.
Previously, IPV6 address event was not triggered due to a mix of IPV4
and IPV6 flags.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-10-22 18:32:49 +03:00
Robert Lubos
f7e51d7b5c net: sockets: tls: Remove leftover todo comment
Logs were added, but the todo comment about this was overlooked,
remove it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-10-21 22:51:49 +03:00
Alberto Escolar Piedras
499aa995f6 net: lib: shell: dns: Fix field precission specifier type
Explicitly cast down the string width to int, as otherwise it is
size_t which may have a bigger size.

Avoids the following build error:

subsys/net/lib/shell/dns.c:496:67: error: field precision specifier
‘.*’ expects argument of type ‘int’, but argument 4 has type ‘size_t’
{aka ‘long unsigned int’}

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-10-21 12:21:37 -04:00
Cla Mattia Galliard
f3b6d77ad4 net: shell: filter: Update table
Adjust table to print newly available information.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-10-21 17:25:56 +03:00
Cla Mattia Galliard
4e3024b110 net: tc: allow to spread threads by more then 1 priority level
Allow to spread tc threads by more then one priority level and cleanup the
computation of the priority.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-10-21 17:25:56 +03:00
Cla Mattia Galliard
8d38e720a4 net: pkt_filter: Filters to modify priority to incoming packets
To enable quality-of-service (QoS) applications, allow filters to modify
the priority of an incoming packet. This allows that processing can be
done on tc-queue-threads with different priorities.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-10-21 17:25:56 +03:00
Jukka Rissanen
dbe59a5faf net: sockets: tls: Add ZVFS_OPEN_ADD_SIZE_TLS to count TLS sockets
Make sure that the CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS will
reflect the number of required file descriptors in the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-21 17:22:03 +03:00
Jukka Rissanen
bc44a27b26 net: context: Make sure to allocate enough sockets
The number of net_context now determines the minimum amount
of network sockets that are to be allocated.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-21 17:22:03 +03:00
Jukka Rissanen
1cfdf7c8d1 lib: Introduce a way to set minimum file descriptors count
Instead of user trying to figure out what is the amount of file /
socket descriptors in the system, let the various subsystems etc.
specify their need using a Kconfig option. The build system will
then add these smaller values together and set a suitable file
descriptor count in the system.

This works the same way as the heap size calculation introduced
in commit 3fbf12487c

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-10-21 17:22:03 +03:00
Robert Lubos
139ebb3128 net: sockets: tls: Validate credentials when registering on a socket
So far the TLS/DTLS credentials would only be validated upon first use,
i. e. when TLS/DTLS handshake was initiated. This could lead to some
confusion, especially when trying to understand the reason of the
handshake failure, as it wasn't clear whether the handshake failed due
to peer sending bad certificate or due to local configuration issues.

This commit attempts to improve this, by pre-validating the credentials
as soon as they are configured on a socket with TLS_SEC_TAG_LIST socket
option. That way, in case bad credentials are configured on a socket, or
more commonly, mbed TLS is misconfigured to handle certain credential
type, it will be caught early during socket configuration, instead of
during the handshake.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-10-20 11:26:26 -04:00
Robert Lubos
98e0ddecc0 net: lib: sntp: Fix transmit timestamp
Fix the transmit timestamp value sent in SNTP queries:

 * Use sys clock as a time source instead of the uptime,
 * As NTP epoch is different from Unix epoch (starts in 1900), adjust
   the seconds value with appropriate offset,
 * Finally, adjust the fraction calculation to the nanoseconds value
   from struct timespec. Do the math in 64-bit to avoid overflows and do
   the division at the end for more accurate results.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-10-20 11:58:59 +02:00
Felix Kolbe
689a0277f0 net: coap: Correct parameter constness in func signature
fix(coap_link_format): Correct parameter constness in func signature

For function coap_link_format:coap_well_known_core_get_len()
the request parameter is declared to be a pointer-to-const,
but the const is missing for one of the two function definitions,
that are chosen via CONFIG_COAP_WELL_KNOWN_BLOCK_WISE.

With this fix the code also compiles when enabling
CONFIG_COAP_WELL_KNOWN_BLOCK_WISE.

Signed-off-by: Felix Kolbe <felix.kolbe@gmail.com>
2025-10-20 11:52:39 +02:00
Jeppe Odgaard
25d5c73b0a net: config: sntp: optionally set rtc
Set RTC when an SNTP response is received if enabled via Kconfig option.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-10-17 17:02:55 +03:00
Pieter De Gendt
1da7a115cc net: l2: wifi: shell: Add bgscan command
Add a shell command to configure the background scanning.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-17 11:15:37 +02:00
Pieter De Gendt
93c4dbd2e0 modules: hostap: Support bgscan
Add configuration options for background scanning (bgscan) in
wpa_supplicant.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-17 11:15:37 +02:00
Qiang Zhao
56098d60b4 drivers: dsa_nxp_imx_netc: add Qbv capability
add Qbv capability for dsa_nxp_imx_netc

Signed-off-by: Qiang Zhao <qiang.zhao@nxp.com>
2025-10-16 22:34:41 -04:00
Qiang Zhao
d4928e8419 net: shell: Add Qbv shell
Added Qbv shell subcommand to net command.
Supported enable, set_config, set_time and get_info functions.

Signed-off-by: Qiang Zhao <qiang.zhao@nxp.com>
2025-10-16 22:34:41 -04:00
Qiang Zhao
16d6c46a0f net: ethernet: add NET_QBV Kconfig
Add NET_QBV in Kconfig, Qbv is Enhancements for Scheduled Traffic (EST),
one feature of TSN. The PTP clock provides the time reference for Qbv

Signed-off-by: Qiang Zhao <qiang.zhao@nxp.com>
2025-10-16 22:34:41 -04:00
Qiang Zhao
a12c664b53 net: dsa: add set/get_config support
Supported set/get_config API.

Signed-off-by: Qiang Zhao <qiang.zhao@nxp.com>
2025-10-16 22:34:41 -04:00
Cristian Bulacu
a2b554c699 net: l2: openthread: Improve Border Router packet forwarding logic
There are some cases when OpenThread opens a sockets and doesn't choose
as default it's internal interface, this leading to usage of
platform UDP module which will then send back the packet to the
OpenThread interface. In this case, the packet should not be treated as
originated from backbone interface.

Backbone router multicast listener callback functionality is improved.
A route with a prefix length of 128 is set
and a multicast address is added for each listener registration.
OpenThread interface joins that multicast address group.

Enabled forwarding capabilities for Backbone interface.
A border router should be able to perform default packet forwarding for
destination addresses with a multicast scope greater than admin-local.
In order to achieve this, multicast routes have been added to those
addreses. [https://datatracker.ietf.org/doc/rfc7346/]

For Border Router application, `ip6_addr_cb` is not installed.
otIp6SubscribeMulticastAddress call would re-register an IPV6 multicast
address which might have been registered by an OpenThread node using
`ipmadd add` command and even if that node performed `ipmaddr del`,
the address was still present in multicast listener table. This also
led to a missing MLDv2 message with that specific multicast IPV6
address.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-10-16 17:10:51 +03:00
Julien Vermillard
9ee47f2856 net: lwm2m: add cache filtering
Introduce `lwm2m_set_cache_filter()` so applications can drop cached
samples before they reach the LwM2M SEND path.

Fixes #91590

Signed-off-by: Julien Vermillard <julien@clunkymachines.com>
2025-10-16 17:10:24 +03:00
Jordan Yates
e655c0ed1a net: ip: conn_mgr_connectivity usage calls
Add interface usage notifications to the `NET_NATIVE` code paths.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-15 15:39:25 +03:00
Jordan Yates
b92a43d7c0 net: conn_mgr_connectivity: idle timeouts
Implement idle timeouts, primarily in the common connectivity library,
with individual interfaces notifying the library when the interface has
been used.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-15 15:39:25 +03:00
Jordan Yates
e3a7bb30bd net: conn_mgr_connectivity: idle timeout parameter
Add an interface idle timeout parameter to the connectivity
binding structure. This will be used to track idle timeouts for
interfaces.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-15 15:39:25 +03:00
Jordan Yates
65b616f6d8 net: conn_mgr: connectivity: replace !binding
Replace all `!binding` checks with `binding == NULL` for MISRA
compliance.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-15 15:39:25 +03:00
Michael Zimmermann
f2bed4d6af net: mqtt_sn: Add support for publishing with QOS=-1
This doesn't try to optimize memory usage for QOS=-1 publications, because
it's easier to use existing structs and allocators instead of adding new
ones with less fields.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-10-15 15:35:58 +03:00
Michael Zimmermann
be0adf76b5 net: mqtt_sn: add support for short topics
The publish and subscribe APIs allocate topics implicitly, but don't
support allocating predefined or short topics. Additionally, we don't want
to force using short topics in case the passed topic is 2 bytes long, in
case the user doesn't want that (e.g. because the server doesn't support
it).

So instead, we add a new API which works similar to
mqtt_sn_predefine_topic, which allows allocating a short topic before using
any of these APIs.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-10-15 15:35:58 +03:00
Michael Zimmermann
e82b8cb150 net: mqtt_sn: never clear predefined and short topics
- These are independent from connections since they are always valid.
- Implicitly created topics(e.g. from publish or subscribe) can't be
  deleted either, so that doesn't make things worse compared to those.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-10-15 15:35:58 +03:00
Charles Hardin
7158f33c2b net: dns: extend the service resolver command line for ptr, srv, addr
The address resoution from RFC6763 is generally a PTR, SRV, TXT, and
an A or AAAA. Records, so this change is mainly to start drawing a
clear functional change between the DNS query shell and the DNS
service shell that should be more of a "avahi-browse" or "dns-sd"
functional style.

So, this is not a very robust implementation since it is a chain of
queries when the goal should be to get additional records from the
message itself but those changes can be added iteratively.

Basic point of this change is to show the procedure for the "browse"

- PTR service resolution
- SRV query from the result of the PTR
- AAAA (or A) from the result of the SRV

TXT records are ignored for now but should be added into this as
additional record support is extended.

Signed-off-by: Charles Hardin <ckhardin@gmail.com>
2025-10-15 12:05:14 +03:00