Commit graph

21541 commits

Author SHA1 Message Date
Damian Krolik
222e0fcd06 debug: coredump: support dumping stack top only
Add Kconfig option to dump only a portion of stack from the
current stack pointer to the stack end. This is enough to
let gdb reconstruct the stack trace and can significantly
reduce the dump size. This is crucial if the core dump needs
to be sent over radio.

Additionally, add another option to set the limit for the
dumped stack portion.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2025-05-12 19:19:25 +02:00
Seppo Takalo
252f8fefe0 net: lwm2m: Fix blockwise Ack NUM calculation
After the PR #85000 the calculation of NUM field of
Block 1 option on CoAP Ack packet started to advance
to next packet block.

We should not update the ctx->current field because it is
used for calculating the NUM field in response packet.
It should point to beginning of the payload,
so the response is correct.

Leshan server don't seem to care about this, but Coiote does.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-05-12 16:47:58 +02:00
Pavel Vasilyev
14b4e30cdf bluetooth: host: Deprecated BT_CONN_TX_MAX
After https://github.com/zephyrproject-rtos/zephyr/pull/72090,
`conn_tx_alloc` no longer blocks, and each buffer always has a
corresponding `bt_conn_tx` object. This eliminates the need to configure
the number of `bt_conn_tx` objects via `CONFIG_BT_CONN_TX_MAX`, since
every buffer now carries its own context even when no callback is used.

This commit deprecates `CONFIG_BT_CONN_TX_MAX` as it is no longer
necessary. Instead, `CONFIG_BT_BUF_ACL_TX_COUNT` is used to allocate
`bt_conn_tx` objects for outgoing ACL data. ZLL already uses
`CONFIG_BT_BUF_ACL_TX_COUNT` to configure the number of outgoing ACL
packets. With this change, modifying the packet count will automatically
adjust the number of corresponding contexts, preventing both context
starvatoin and underutilization.

This approach also aligns with ISO, where the number of `bt_conn_tx`
objects for outgoing ISOdata matches `CONFIG_BT_ISO_TX_BUF_COUNT`.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-05-12 14:54:26 +02:00
Pavel Vasilyev
ddeeecd0b4 bluetooth: host: Add a check for num of bt_conn_tx and ACL/ISO bufs
After https://github.com/zephyrproject-rtos/zephyr/pull/72090, each
packet to be sent (wether ACL or ISO data) has a corresponding
`bt_conn_tx` object, regardless of whether a callback is used.

This means that number of packets Host can send to Controller is limited
by the smaller of two values: ACL/ISO packets Controller can receive,
and the number of `bt_conn_tx` objects allocated by Host.

A mismatch between these numbers may lead to inefficient resource usage
on either Host or Controller side. If Host allocates fewer `bt_conn_tx`
objects than the number of buffers available on Controller for a given
data type, some Controller buffers may go unused. Conversely, if Host
allocates more `bt_conn_tx` objects than Controller can consume, the
excess objects remain unused.

This commit adds a check and issues a warning if the number of
`bt_conn_tx` objects is not aligned with the number of ACL/ISO buffers
reported by Controller via the LE Read Buffer Size v1 or v2 command.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-05-12 14:54:26 +02:00
Yangbo Lu
1ee51232de net: ptp: fix infinite loop in pkt frag
There was wrong implementation in pkt frag removing and inserting.
This was causing infinite loop in either net_buf_frag_last or
net_pkt_get_len. This happened only when the pkt frag removing
and inserting was executed too fast after sending pkt before
ethernet_send calling net_pkt_get_len.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-05-12 14:54:06 +02:00
Fin Maaß
ff5e031c20 net: conn_mgr: set to unstable
Set connection manager to unstable. It is now used
by multiple parts in zephyr and numerous samples.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-10 13:02:21 +02:00
Fin Maaß
bad506eb7a net: config: init: sntp: use connection manager
Add option to use the connection manager to
schedule a (re-) sync on connection and diabeling the
work, when there is no connection.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-10 13:02:21 +02:00
Fin Maaß
265eb71eef logging: backend: net: use connection mgr
Use connection manager to deactivate and activate
net log backend.
This removes the warnings about dropped packages
completly.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-10 13:02:21 +02:00
Fin Maaß
e7047059b1 logging: backend: net: avoid early enabling
Avoid early enabling of the syslog backend in
the the dhcpv4 options parser.

When CONFIG_NET_IPV4_ACD is enabled, the assigned ip address has
not been checked, when the other dhcpv4 options are parsed, this would
lead to the syslog backend being enabled before the src ip address
is valid, so we get lots of warnings about dropd packets, this fixes
it at least on start. We will still get the warnings, when the iface
goes down and then up later.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-10 13:02:21 +02:00
Fin Maaß
8ce499665b logging: backend: net: avoid automatic enabling
Avoid automatic enabling of the syslog backend by
the logging subsystem.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-10 13:02:21 +02:00
Anas Nashif
edc9142f50 tests: add handling for rx arch
empty define for this architecture use for testing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-09 21:08:57 +02:00
Robert Lubos
53f01fa37c net: ip: mld: Ensure MLD APIs work with offloaded interfaces
MLD APIs are commonly used across the codebase to configure IPv6
multicast addresses on network interfaces. Sending MLD reports however
works only for native interfaces as it uses low-level APIs. Therefore,
in order to make the APIs at least semi-functional for offloaded
interfaces as well (i.e. allow to configure multicast address on
the interface), return early in case interface is offloaded.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-09 18:00:14 +02:00
Robert Lubos
e0a1e910ac net: ip: igmp: Ensure IGMP APIs work with offloaded interfaces
IGMP APIs are commonly used across the codebase to configure IPv4
multicast addresses on network interfaces. Sending IGMP reports however
works only for native interfaces as it uses low-level APIs. Therefore,
in order to make the APIs at least semi-functional for offloaded
interfaces as well (i.e. allow to configure multicast address on
the interface), return early in case interface is offloaded.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-09 18:00:14 +02:00
Robert Lubos
4d01228193 net: mqtt_sn: Use zsock_inet_ntop instead of inet_ntop
Use zsock_inet_ntop() instead of inet_ntop() to avoid dependency to the
POSIX subsystem in the library.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-09 18:00:14 +02:00
Robert Lubos
d745689fe7 net: mqtt_sn: Verify result of transport initialization
The result of the transport init() function should be propagated to the
application, otherwise the initialization could fail silently.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-09 18:00:14 +02:00
Robert Lubos
a04e9fd0de net: mqtt_sn: Make sure multicast functionalities are enabled
UDP transport for the MQTT SN libraries depends on IGMP/MLD APIs
unconditionally (via respective setsockopt calls) and without them being
enabled transport initialization would fail. Therefore, ensure
respective multicast libraries are always enabled if MQTT SN UDP
transport is used.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-09 18:00:14 +02:00
Shrek Wang
e59fb26db8 net: tcp: Remove the 'goto next_state' in tcp_in()
Each incoming TCP packet has been completely handled in current
state. No need to do further process by 'goto next_state'.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-05-09 18:00:00 +02:00
Fin Maaß
a7ee49667d mgmt: hawkbit: add event for confirmed current image during init
add event for confirmed current image during initialization

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-09 14:01:08 +02:00
Vinayak Kariappa Chettimada
3c661a1765 Bluetooth: Controller: Fix LOW_LAT_ULL implementation for ISO support
Fix BT_CTLR_LOW_LAT_ULL implementation for enqueing ISO Rx.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-09 10:42:28 +02:00
Vytautas Virvičius
9a409d6b00 net: l2: ppp: Explicitly negotiate ACCM
Many cellular modems attempt to negotiate an ACCM value of 0x00000000.
While the PPP driver rejects this by default, it does not propose an
alternative. As a result, some modems default to using 0x00000000 after
LCP negotiation. Because the PPP driver expects all control characters
to be escaped, this causes issues during decoding. This change
negotiates an ACCM value of 0xffffffff to ensure compatibility with such
modems.

Signed-off-by: Vytautas Virvičius <vytautas@virvicius.dev>
2025-05-09 08:23:16 +02:00
Johan Hedberg
af77efb77e Bluetooth: Host: Remove unnecessary ifdef from cs.c
The building of cs.c based on the respective Kconfig option is already
taken care of CMakeLists.txt, so it's redundant to try to protect the code
through ifdefs in the c-file as well.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-05-08 15:56:35 +02:00
Robert Lubos
45a1cf7fcc net: dhcpv4: client: Do not generate new xid for Request message
According to RFC 2131, DHCP clients should use the same xid as
received in the Offer message when sending DHCP Requests. Therefore,
when generating DHCP Request message, the xid value should not be
incremented.

One vague topic is whether the xid value should be updated when
sending Requests from Renewing or Rebinding states, however RFC makes no
exception for those states, and other implementations (dhclient, lwip)
seem to reuse the same xid in such cases, so comply with this behavior.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-08 15:55:55 +02:00
Robert Lubos
9d54465559 net: dhcpv4: client: Handle Pad option
Pad option (option code 0) can be present in between other options for
alignment. The option has a fixed 1-byte length (i. e. no length field),
therefore it did not fall under the common processing code for
unrecognized options (which include the length field at the second
byte). Therefore, not processing this option explicitly could disturb
other options processing, as the parser would wrongly interpret the next
option code as the length field. This commit adds Pad option handling to
fix the issue.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-08 15:55:55 +02:00
Robert Lubos
f4408c088c net: dhcpv4: client: Prevent asserting on malformed message
In case the received DHCP message is malformed and contains invalid
message type, the code responsible for matching message type with a
string would assert. This shouldn't be the case that external conditions
(like receiving malformed packet) trigger asserts in the system.
Therefore modify that code, to return "invalid" string in such case
instead.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-08 15:55:55 +02:00
Fin Maaß
c4ff1dbc25 mgmt: hawkbit: Fix cancelAction string handling
Fix off-by-one error in cancelAction string handling.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-08 15:55:48 +02:00
Robert Lubos
493be790ac net: http: client: Fix the body callback processing
Response "data_len" field needs to be set with the size of the
received data before calling the parser as it's used inside the on_body
callback, this commit fixes it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-08 14:01:07 +02:00
Johan Hedberg
9ecca87281 Bluetooth: Host make the long workqueue stack size configurable
Add a prompt to the long workqueue stack size, so that it can be easily
fine-tuned by the application. The exact usage will depend on many factors,
such as the chosen crypto backend and target architecture, so it's not
possible to have "one size fits all" solutions based on the default values.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-05-08 14:01:00 +02:00
Yangbo Lu
07e1de381a net: ptp: adjust only frequency for continuous synchronization
Current clock synchronization was always stepping clock. This was
causing large offset, and discontiguous ptp hardware clock time.
For TSN hardware, discontiguous ptp hardware clock time was not
able to be used for other TSN protocols.

This patch is to convert to frequency adjustment with a basic
PI control algorithm.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-05-08 12:25:30 +02:00
Yangbo Lu
e9efff6e33 net: ptp: calculate link delay with right timestamps
At the starting of ptp syncrhonization, there may be not Sync frame
TX/RX timestamps in first time link delay calculation.
So, need a check for that in case of wrong link delay calculated.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-05-08 12:25:30 +02:00
Emil Gydesen
425f3f4b0a Bluetooth: Audio: Rename ctx type prohibited to none
The context type PROHIBITED has been removed from
the Bluetooth assigned numbers document. It is, however,
still used in some profiles to indicate either "No context
type supported" or "None available", and thus a rename
to "NONE" makes sense.

It is still treating similar to prohibited in some cases,
as it is not a valid context type in all cases.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-08 01:58:01 +02:00
Vinayak Kariappa Chettimada
fc14570585 Bluetooth: Controller: Fix Central CIS offset for dissimilar intervals
Fix Central CIS offset calculation for dissimilar ACL and
ISO intervals in use.

Mayfly execution of `mfy_cig_offset_get()` could be after
"LLL Prepare" or before depending on whether a previous radio
event is being preempted or not, respectively; the
`conn->lll.event_counter` may not be pre-incremented.
This race condition is fixed by the fact that we use a
constant instant delta value now.

Dissimilar ACL and ISO intervals may lead to ACL overlapping
or be too close to ISO event, causing preemption; under this
case ACLs "LLL Prepare" would run after `mfy_cig_offset_get`
causing incorrect calculation of CIS offset without the fix.

Remove redundant `instant` member in `ll_conn_iso_stream`
structure as a constant CIS Create instant delta is now
used.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-07 15:10:17 +02:00
Jamie McCrae
a7a3f06f0a mgmt: mcumgr: grp: os_mgmt: Fix Kconfig alignment
Fixes some elements that were indented twice

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-07 13:39:20 +02:00
Jamie McCrae
f39091376f mgmt: mcumgr: grp: os_mgmt: Support reboot without multithreading
Adds support for the OS mgmt reboot command when multithreading
is disabled

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-07 13:39:20 +02:00
Fin Maaß
029abb4165 mgmt: hawkbit: don't require DNS_RESOLVER
When the supplied server address is already an
ip address, CONFIG_DNS_RESOLVER is not required,
as zsock_getaddrinfo() can resolve literal addresses
without it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-07 13:32:39 +02:00
Fin Maaß
e59451a758 mgmt: hawkbit: also clear in the call of hawkbit_autohandler()
the k_event_clear in the work might be to late sometimes, when
hawkbit_autohandler_wait() is executed directly after
hawkbit_autohandler(). This leads to getting the events
of the former execution and also not waiting until the
current autohandler run is finished.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-07 11:44:59 +02:00
Valerio Setti
52dcb2593a Bluetooth: Host: remove useless select in BT_HOST_CRYPTO_PRNG
PSA Crypto API always allow psa_generate_random() to be called (i.e. there
is no PSA_WANT_xxx symbol that can be used to disable it). How random
numbers are generated internally is a library internal detail, but the
end user (Bluetooth) does not need to worry about this.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-05-07 10:30:45 +02:00
Olivier Lesage
86a6b29733 bluetooth: host: Increase default cmd buffer size to 255 if using CS
sizeof(struct bt_le_cs_write_cached_remote_fae_table) = 74,
so the default value (65) was already too small in some cases.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-05-07 10:29:59 +02:00
Johan Hedberg
4a31b8036d Bluetooth: Host: Remove conditional stack size for BT_SETTINGS
With BT_SETTINGS enabled, there doesn't seem to (anymore?) be any
substantial overhead in stack consumption:

 0x200020b8 BT RX WQ
        options: 0x0, priority: -8 timeout: -9223372036854775808
        state: pending, entry: 0x5ba69
        stack size 2240, unused 1072, usage 1168 / 2240 (52 %)

Let's just remove the conditional default and fall back to the
non-conditional one which is 1200.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-05-06 13:01:28 +02:00
Troels Nilsson
facdbdbd29 Bluetooth: Controller: Fix handling of odd SDU intervals in CIS central
Make sure iso_interval_us is in a multiple of 1.25 ms instead of directly
assigning it the value of SDU interval

Fixes EBQ failures in LL/CIS/CEN/BV-36-C and LL/CIS/CEN/BV-37-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
2025-05-06 12:00:15 +02:00
Shrek Wang
f2ef654155 net: tcp: Replace the FIN only case with FIN+ACK
According to TCP Spec. RFC793, ACK flag should be always set
after sequences of both sides are sync-ed except for RST seg-
ment. It is not necessary to send FIN only packet in the
test case, using FIN | ACK instead.
Similarly, change the tcp_out(conn, FIN | ACK) in CLOSE_WAIT.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-05-06 10:50:39 +02:00
Krzysztof Chruściński
8ad44471b9 pm: Include disabled states in search inside pm_state_get
pm_state_get() is used to get a PM state that can be forced.
Disabled states (not included in automatic state selection) can
also be forced thus they should be included in search inside
pm_state_get().

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-05-05 21:56:55 +02:00
Troels Nilsson
368beb9623 Bluetooth: Controller: Fix truncation by abs() call when using PAST
The abs() function only takes an int as input - use llabs() instead

Fixes EBQ failure in LL/CON/PER/BV-105-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
2025-05-05 14:25:22 +02:00
Arkadiusz Balys
596844a2cb openthread: Move OpenThread implementation from net to modules
Move OpenThread-related code from
zephyr/subsys/net/l2/openthread/openthread.c to
zephyr/modules/openthread/platform/openthread.c.

The primary goal of this refactor is to enable the use
of OpenThread as an independent module, without the necessity
of Zephyr's networking layer.

This change is particularly beneficial for simple applications
that have their own implementation of the IEEE802.15.4 driver
and do not require a networking layer. These applications can
now disable Zephyr's L2 and IEEE802.15.4 shim layers and
directly use the OpenThread module, saving valuable kilobytes
of memory.

In this approach if the CONFIG_NET_L2_OPENTHREAD
Kconfig option is set, Zephyr's L2 and IEEE802.15.4 layers
will be used, and everything will function as before.
The main difference is the Zephyr's L2 layer now uses
the OpenThread module, no longer implementing it.

While most of the functions in include/net/openthread.h
have been deprecated, they are still available for use to
maintain backwards compatibility.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2025-05-05 14:25:13 +02:00
Markus Lassila
10bd2de235 modem: backend: uart: Add hw-flow-control for UART
Add Asynchronous UART implementation, which does not drop data
when automatic hardware-flow-control is set in the device tree.

With automatic hardware flow control, the CTS pin will be
automatically deactivated when there are no more asynchronous
UART RX buffers available. After buffer space becomes available,
and UART RX is restarted, the CTS pin will be activated.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2025-05-05 14:24:49 +02:00
Fin Maaß
0d74f6239b logging: backend: net: use sizeof to check Kconfig
Use sizeof to check if the Kconfig value had been
set, to allow the compiler to optimize.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-05 12:21:00 +02:00
Fin Maaß
211c0e3819 net: config: init: remove second init of syslog
Doing another init of the log_backend_net in
the net config init could lead to the
server, set during runtime, being overwritten
by the Kconfig default.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-05 12:21:00 +02:00
Abderrahmane JARMOUNI
63cf0c803f logging: uart_backend: add uncached buffers support
When async UART is used & DCache is enabled, some SoCs, like STM32H7,
require UART buffers to be placed in nocache memory to avoid cache
coherence issues.

Fixes issue 87795

Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
2025-05-05 12:20:42 +02:00
Christoph Winklhofer
13054293ad tests: logging: Allow LOG_PRINTK from user space
The commit '3b29b9fa3b (tests: logging: restore userspace testing,
2025-04-18)' set CONFIG_LOG_PRINTK=n which brakes the build on the
platform 'ip_k66f'.

Without CONFIG_LOG_PRINTK=n (dependency from CONFIG_USERSPACE=y) some
tests in 'tests/subsys/logging/log_core_additional/logging.log_user'
would not build.

Remove this dependency so that LOG_PRINTK can also be used from user
space, which is possible since '77925656ab (logging: Fix runtime
message creation in user-mode thread, 2025-04-18)' and reset
CONFIG_LOG_PRINTK=y.

Fixes: #89067
Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-05-05 12:20:34 +02:00
Dominik Ermel
3d4b427245 storage/flash_map: Fix is_in_flash_area_bounds
Prevent possible overflow in is_in_flash_area_bounds while
validating offset and length of an operation.

Fixes #89349

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-05-05 10:57:51 +02:00
Robert Lubos
d60831810b net: websocket: Make use of any leftover data after HTTP processing
In case HTTP client read out more data from a socket that it processed
it will indicate there is leftover data in the receive buffer available.
Make use of it at the websocket level, so that no data is lost. As we
reuse the same receive buffer in this case, it's only needed to update
the count variable to indicate how many bytes are available.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-05 10:57:43 +02:00