Commit graph

24,075 commits

Author SHA1 Message Date
Ederson de Souza
823c519db2 subsys/llext: Fail if section name index is outside strings area
Avoid unintended out of bounds accesses.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-20 11:10:51 +02:00
Ederson de Souza
2bc84dc6d6 subsys/llext: Fail if symbol name index is outside strings area
Avoid unintended out of bounds accesses.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-20 11:10:51 +02:00
Ederson de Souza
3f6734034a subsys/llext: Fail if stated symbol size doesn't fit elf_sym_t
As it avoid unintended overflows.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-20 11:10:51 +02:00
Adrien Ricciardi
8fd797e95a task_wdt: Add dummy implementation
The introduced CONFIG_TASK_WDT_DUMMY Kconfig symbol allows to easily
disable the Task Watchdog by providing a dummy implementation.

The Task Watchdog can fire when a board is halted on a breakpoint during
a debugging session, so this new feature can turn useful in this case.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2025-09-19 12:47:23 -04:00
Bjarki Arge Andreasen
5438462a6a pm: device: runtime: Only select EVENTS if PM_DEVICE_RUNTIME_ASYNC
The k_event event is only used if CONFIG_PM_DEVICE_RUNTIME_ASYNC is
selected, but EVENTS is selected, and the k_event included in the
struct pm_device if CONFIG_PM_DEVICE_RUNTIME is selected.

Correct to only include event and EVENTS if
CONFIG_PM_DEVICE_RUNTIME_ASYNC is selected. This saves us 1
struct event per PM DEVICE.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-09-19 16:33:06 +02:00
Jeppe Odgaard
6e7268d21b mgmt/mcumgr: add missing designator to ZCBOR_MAP_DECODE_KEY_DECODER
Add missing `.key` designator.

This also fixes a compile error:
> error: either all initializer clauses should be designated or none of
them should be

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-09-19 08:37:19 -04:00
Jordan Yates
aa08e0df20 testsuite: coverage: convert dump method to choice
To support future coverage dump methods (semihosting) move
`COVERAGE_DUMP` inside a choice symbol.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-19 08:34:32 -04:00
Cristian Bulacu
cdf5811791 net: dns: DNS resolver packet forwarding
This aims to implement a packet forwarding mechanism between
DNS resolver and applications that install a callback, letting
DNS resolver know that received UDP packet is also required by an
application.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-19 08:34:06 -04:00
Pavel Vasilyev
52862dc658 bluetooth: host: move bt_gatt_authorization_cb_register to gatt.c
This function logically belongs to gatt.c as it is GATT API.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-09-19 08:33:29 -04:00
Chaitanya Tata
19449e4396 wifi: treewide: Adjust defaults for dual mode usage
In case STA + AP mode is enabled, then adjust the defaults to accomodate
the second interface.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-09-19 08:27:55 -04:00
Bjarki Arge Andreasen
34c51c5ab4 pm: device: runtime: add PM_DEVICE_RUNTIME_DEFAULT_ENABLE
Many SoCs which use PM_DEVICE_RUNTIME need every device in the system
to have PM_DEVICE_RUNTIME enabled to function. Currently, this is only
possible by adding zephyr,pm-device-runtime-auto; to every node in
every devicetree which could potentially implement device power
management. This is very error prone since its easy to miss a node,
especially if users apply overlays, where users need to know and
remember to apply or reapply this property.

This commit adds a Kconfig, disabled by default, which automatically
treats every device as if it had the zephyr,pm-device-runtime-auto
property added to every node.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-09-19 08:06:09 +02:00
Robert Lubos
13a228381b net: tcp: Remove duplicate headers and function declarations
TCP somehow ended up with two internal headers with duplicate set of
internal function declarations. As tcp.h looks like a subset of the
tcp_internal.h header, combine the two headers into a single
tcp_internal.h and remove tcp.h. There were some differences in doxygen
API descriptions, so I've used the description that better described the
actual function purpose.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-09-18 13:50:46 -04:00
Robert Lubos
3d85e8f0ac net: tcp: Implement TCP connection backlog
Implement TCP connection backlog for TCP server. The backlog parameter
is already specified by the listen() socket API, however it was never
implemented in Zephyr. It can be useful to limit the number of incoming
connections on the server side, and thus limit the connection flood and
resource shortage.

The backlog is implemented as a atomic counter inside the TCP context.
The counter is initialized on the listen() call (and thus no connection
can be accepted before listen() is called), and then decremented
whenever new connection is initiated. When the application accepts
the incoming connection, it should call the net_tcp_conn_accepted()
API (done automatically for sockets) to inform the TCP layer that the
backlog can be incremented. The backlog value is also incremented back
if the connection is released before the connection was passed to the
application.

For tracking the parent (listening) socket, the 'accepted_conn' pointer
on the client context has been reused. Note, that the pointer used to be
cleared before the accept_cb() call before, to prevent consecutive calls
to the callback, however this was not really needed - the TCP state is
changed anyway, and the accept_cb() is only used in TCP_SYN_RECEIVED
state. The pointer is no cleared when the application accepts the
connection (or the client or the associated parent context is closed).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-09-18 13:50:46 -04:00
Marcel Wappler
9401406e6a net: lwm2m: finalize CBOR output on -ENOMEM instead of aborting
When encoding cached LwM2M 1.1 resources into SenML CBOR, the encoder
currently aborts with -ENOMEM if the number of records (minus
some CBOR delimiter elements) exceeds CONFIG_LWM2M_RW_SENML_CBOR_RECORDS.
This discards all serialized data and prevents any payload from
being sent, leaving the client stuck and caches filling up.

This patch changes the behavior: if some records were already
serialized before the buffer shortage, the CBOR output is finalized
(end marker added) and the partial payload is returned. This allows
the client to send useful data, and the upper layers can react by
reducing batch size.

Impact:
- Preserves forward progress instead of canceling the message
- Avoids cache lock-up
- No changes to the API or success path behavior

Signed-off-by: Marcel Wappler <marcel.wappler@decentlab.com>
2025-09-18 13:50:13 -04:00
Yongxu Wang
4121adff1c pm: introduce pm_cpu_shell interface
Introduce a shell for specific cpu core about PM control,
this aligns with existing design flow where the policy decides
the state based on next event timing, locks and latency constraints,
and the system naturally enters low power through the idle thread.

New shell commands under `cpu`:
  -  cpu states			: List supported CPU power states (from devicetree)
  -  cpu available		: For each state/substate, show if available
  -  cpu lock			: Lock specific low power mode
  -  cpu unlock			: Unlock specific low power mode
  -  cpu idle ms		: Sleep the current thread to let idle run PM

Signed-off-by: Yongxu Wang <yongxu.wang@nxp.com>
2025-09-18 13:48:30 -04:00
Yongxu Wang
8767cec875 pm: states: add enum-string conversion helpers
Add two helper functions to convert power management states between
enum and string:

- pm_state_to_string()
- pm_state_from_string()

Signed-off-by: Yongxu Wang <yongxu.wang@nxp.com>
2025-09-18 13:48:30 -04:00
Cristian Bulacu
c953517245 net: l2: openthread: Implement packet forwarding rules.
Inject packets from AIL to Thread network and vice versa taking into
account packet forwarding security safeguards and multicast forwarding.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-18 15:42:30 +01:00
Jukka Rissanen
221aca4bb9 net: if: Fix assert when checking lladdr existence
As the linkaddr->addr is no longer a pointer, the original
assert check is not working as it should. So use the length
of the linkaddr to verify that it is > 0.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-09-17 19:10:31 -04:00
Cristian Bulacu
2928670381 net: l2: openthread: Parse Border Router messages in correct context.
This commit adds a work item designated for Border Router message
parsing. A generic message structure has been proposed.

If CONFIG_NET_IPV4 is enabled, border router services will start only
after an IPV4 address has been assigned on the backbone interface.
If border router is initialized before DHCPV4 client has been assigned
an address, initial mDNS IPV4 packets will be dropped, because a source
address cannot be retrieved from that specific backbone interface.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-17 16:37:49 +02:00
Michael Zimmermann
5bba1edb6e mqtt_sn: process_ping: fix infinite loop
When next_ping == now, the code scheduled the workqueue for the current
time. On native_sim, this meant that the system workqueue thread was stuck
in an infinite loop because it kept processing the MQTT work over and over
again and the current timestamp could not advance anymore.

I didn't investigate why the yield inside the workqueue didn't help or why
native_sim can't advance time when one of the threads is stuck, but
changing the condition to >= inside mqtt_sn solves this issue.

I discovered this while running zephyr.exe through strace for up to 60
minutes. I guess that the performance overhead makes it more likely for the
workqueue handler to be run while next_ping == now, but I didn't verify
that, because it takes a long time to trigger the bug.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-09-17 16:32:49 +02:00
Mark Wang
70c965d33d bluetooth: l2cap: accept the default flush timeout (0xFFFF) in conf_rsp
Some headsets reply conf_rsp with flush timeout (0xFFFF) even conf_req
don't configure the flush timeout, stack should accept it.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-17 11:16:03 +01:00
Mark Wang
811c5eb64b bluetooth: l2cap: support the classic l2cap rx flush timeout
add one Kconfig `BT_L2CAP_RX_FLUSH_TO` to configure the minimum L2CAP RX
flush timeout accepted during processing peer's l2cap flush timeout
configuration.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-17 11:16:03 +01:00
Cheng Chang
31f36fdbb8 bluetooth: host: l2cap: fix issue that can't get chan by psm
when role is server and try to get chan by psm in application, it
works fail because chan do not store psm.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-09-17 10:07:12 +02:00
Fin Maaß
76c1bc02e1 sd: evaluate constants first
evaluate constants first, so the
compiler can optimize it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-09-17 08:45:15 +02:00
Lyle Zhu
49157ea8fc Bluetooth: SDP: Check tail room of allocated buffer
In partial resolved notification case, there is a case that the tail
room of new allocated buffer is not bigger than the tail room of the
current receiving buffer. Since, the new allocated buffer has the same
size with the current receiving buffer, it means a complete SDP record
cannot fit into the allocated buffer. In this way, the following SDP
discovery should be stopped.

In partial resolved notification case, if the tail room of the new
allocated buffer is not more the tail room of the current receiving
buffer, reports the error `-ENOMEM` and stop the following SDP
discovery.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-09-16 09:56:13 +02:00
Lyle Zhu
624407840f Bluetooth: SDP: Partial resolved if no space for next SDP SSA discover
The minimum receiving buffer size is 0x0007. The following SDP
discovery should not be started if the space of the receiving buffer
is less than 0x0007.

If there is no more space of the receiving buffer for the next SDP SSA
discovery, try to notify the upper layer with the partial resolved.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-09-16 09:56:13 +02:00
Lyle Zhu
22c14df4dc Bluetooth: Classic: SDP: Check max attr byte count for req and rsp
In the SDP specification, the `MaximumAttributeByteCount` of SA and
SSA should be in range 0x0007-0xffff. But in the current
implementation, this value is not checked both SDP server and client
sides.

Check the `MaximumAttributeByteCount` when receiving the SA or SSA
request on SDP server side.

Check the tail room of the receiving buffer before sending the SA or
SSA request on SDP client side.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-09-16 09:56:13 +02:00
Dmitrii Sharshakov
82e4fd84f4 jwt: fix signature length for JWT_SIGN_RSA_LEGACY
Fix the reference to the Kconfig item.

Fixes #73329

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-09-16 09:53:44 +02:00
Tom Burdick
e8c676be47 rtio: More useful callback OPs
Callbacks now take a result parameter which may, if the callback was
linkd to by a previous submissions, have the result code from the last
submission.

Additionally the userdata is now const by default making it easier to
use the device pointer as the userdata which is very common.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-09-16 09:53:14 +02:00
Kai Cheng
3e03a658b0 Bluetooth: DID: add did profile
add did profile codes

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2025-09-16 09:52:53 +02:00
Emil Gydesen
64ea5334e4 Bluetooth: BAP: SD: Remove address lookups
Remove lookups in the Scan Delegator that relates to
the advertiser address. The reason for this, is that the
address is not considered a unique value for receive states,
since the address may change over time in the case of (N)RPAs.
Instead we shall rely exclusively on the address type, the sid
and the broadcast ID.

The implementation of the Scan Delegator and Broadcast Sink
has been updated to not use addresses for lookups anymore,
and there has been a minor API modification to set the
PA sync state as part of bt_bap_scan_delegator_add_src
as the higher layers are better suited to handle the
PA Sync state.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-15 19:45:23 -04:00
Yangbo Lu
590d9d1c6f net: dsa: support PTP timestamping in netc tag driver
Supported PTP timestamping in netc tag driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Yangbo Lu
15dc8d78f2 net: pkt: support common usage of control block
Supported common usage of control block for any layer.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Yangbo Lu
997edb4e13 net: dsa: add PTP solution in core driver
Added PTP solution in core driver. Now only gPTP was supported.

- ethernet_api like get_capabilities and get_ptp_clock
  were supported in port driver.

- For TX timestamp, added new dsa_api port_txtstamp for device
  to handle. Device driver might put pkt in queue, and reported
  timestamp after completing transmitting on hardware.

- For RX timestamp, the timestamp could be given to pkt in tag
  driver or device driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Yangbo Lu
eabc1b38bf net: dsa: support tagger data and connecting device to tag protocol
Supported tagger data and connecting device to tag protocol, so that some
device specific work could be handled.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Yangbo Lu
ea6bdfe890 net: dsa: move dsa_tag_netc.h to public include directory
Moved dsa_tag_netc.h to public include directory for devices
reusing.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Mark Wang
67f246477f bluetooth: a2dp: save the reconfig to stream
The reconfig's configuration is not saved to stream, fix it.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-15 14:45:20 +02:00
Mark Wang
0963a8c2de bluetooth: a2dp: add bt_a2dp_stream_create_pdu
use bt_a2dp_stream_create_pdu to create the stream pdu net buf, then
application can use the buf->len to check whether the buf's size exceeds
the l2cap mtu.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-15 14:45:10 +02:00
Victor Brzeski
de0d8b9655 usb: device_next: cdc_acm: switch irq_lock to spinlock
Change the irq_lock to a spinlock to be more semantically
correct.

Signed-off-by: Victor Brzeski <vbrzeski@gmail.com>
2025-09-15 12:08:53 +02:00
Make Shi
b47f5fd88c Bluetooth: AVRCP: Dropping the connection when error response failure
Disconnect the L2CAP connection when fails on sending an error response
(unit info, subunit info, or passthrough).

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
d57cce993e Bluetooth: shell: Add support for AVRCP TG passthrough
Add a callback function in shell and a new command for AVRCP TG
passthrough support

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
0835fdca08 Bluetooth: AVRCP: Implement Pass Through command reception on TG
Add a new callback to support the situation when a Pass Through command
is received, and add an API to respond to the Pass Through command.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
33406d50c8 Bluetooth: Shell: AVRCP: support subunit info request and response
Add avrcp_subunit_info_req callback function in shell and a command to set
the subunit info response.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
ae5a380659 Bluetooth: AVRCP: Implement subunit message reception on the AVRCP TG
Add a new callback to support the situation when a subunit info command
is received, and add an API to respond to the subunit info command.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
21ed38526d Bluetooth: AVCTP: support fragmented packet transmission and reception
- Implemented fragmented packet handling for AVCTP protocol
- Refactored AVCTP header structure to support multiple packet types
- Enhanced AVCTP send logic with packet segmentation support
- Updated AVRCP integration to support new AVCTP fragmented flow

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Hoang Nguyen
1f6dd19462 arch: arm64: cortex_a: Add CPU load for Cortex-A
- Add calls to sys_trace_idle_exit before leaving idle state
  to track CPU load
- Extend CPU_LOAD to CPU_CORTEX_A in Kconfig

Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-09-13 18:14:59 -04:00
Jukka Rissanen
909710b598 net: context: Make sure TCP allocation is not leaked
If we have allocated a TCP connection, and if after that
we get an error like EADDRINUSE, then we must de-allocate
the TCP connection otherwise there is a buffer leak.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-09-13 18:13:21 -04:00
Georgios Vasilakis
53b2802fff net: websocket: Allow using PSA APIs to calculate SHA1
The websocket used mbedtls functions to calculate the
SHA1 needed. Update the code to use PSA crypto calls instead
when the configuration CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT
is enabled.

This can be useful for applications which use TF-M
since it only provides PSA crypto APIs.

Also check the error code from the mbedtls_sha1
call since it can fail and it was not checked before.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2025-09-12 18:31:04 +02:00
Yangbo Lu
5aaf69e145 net: ethernet: make inclusion relation clear for DSA and Ethernet headers
DSA is part of Ethernet and will utilize more Ethernet definitions for
more features support. So, it's proper to let DSA header include
Ethernet header with moving some DSA definiton from DSA header to
Ethernet header and adding DSA header including in c files using DSA
definition.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-12 13:19:41 +02:00
Yangbo Lu
0501be8090 net: ethernet: use void pointer for dsa switch context
In ethernet_context structure, it just needs a void pointer
for dsa switch context.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-12 13:19:41 +02:00