Commit graph

22,555 commits

Author SHA1 Message Date
Bjarki Arge Andreasen
825dea6832 shell: exchange k_mutex for k_sem
The mutex is being used as a simple binary semaphore. It is not
recursed so we don't need to track thread ownership nor lock count.

Exchange the mutex for a binary semaphore to save resources and
speed up shell.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-07-24 17:00:07 +01:00
Josuah Demangeon
366c64eca0 usb: uvc: respect setup->wLength in responses
Due to the alignment and granularity requirements of memory allocation,
setup->wLength is shorter than the allocated buffer size.
This lead to responses larger than what the host requested, which it
rejected. Fix it by using the minimum between the allocated size, the
struct size, and the wLength requested.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-07-24 16:58:20 +01:00
Josuah Demangeon
ed9327dec2 usb: uvc: allow the host to use short probe/commit messages
Some OSes like MacOS use shorter UVC 1.1 probe/commit messages even when
UVC 1.5 is supported, without bUsage, bBitDepthLuma, bmSettings,
bMaxNumberOfRefFramesPlus1, bmRateControlModes bmLayoutPerStream.
Accept messages of arbitrary size to safely be processed, ignoring all
missing fields, improving standard compliance.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-07-24 16:58:20 +01:00
Robert Lubos
6bfeb4fe45 net: lwm2m: senml_cbor: Verify data len before calling memcpy
Check if there actually is data to copy before calling memcpy() to
prevent potentially calling memcpy() with NULL value pointer.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-24 16:58:05 +01:00
Robert Lubos
779d8521a8 net: lwm2m: oma_tlv: Fix UBSAN warnings about signed integers
* Simplify the logic of the get_number() function to address the corner
  cases reported by UBSAN regarding byte-swapping signed integer values.

  The existing logic was actually only valid for little-endian systems,
  as it expected that the bytes written from the packet buffer will be
  stored at the beginning of the int64_t memory, plus the actual
  byte-swapping with signed integer casts inside was hard to follow.
  Switch to a plain uint8_t buffer for integer readout, and use
  dedicated system function to convert the big-endian data in the buffer
  into unsigned integer in the system endianness, followed by the final
  cast to a signed value.

* Add explicit cast to uint32_t in put_objlnk() to prevent warning about
  not-fitting integer after byte shift, and update the result type to
  uint32_t as well.

* Switch to buffer with sys_put_be16/32/64 when writing integers due to
  similar warnings about byte-swapping signed values.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-24 16:58:05 +01:00
Robert Lubos
a09fae571e net: lwm2m: plain_text: Check for int64_t overflow when parsing integer
Verify if the integer value being parsed does not overflow int64_t type
and report an error in such cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-24 16:58:05 +01:00
Robert Lubos
d9395d8502 net: lwm2m: json: Check for int64_t overflow when parsing integer
Verify if the integer value being parsed does not overflow int64_t type
and report an error in such cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-24 16:58:05 +01:00
Robert Lubos
c1aa7f57c2 net: lwm2m: registry: Validate value pointer before use
Check if value pointer is not NULL before passing it to memcmp() inside
lwm2m_engine_set(). As the function actually expects that the value
pointer can be NULL in case resource value is cleared (there is a test
case for such behavior), validate that len value is actually 0 if NULL
value is provided, to avoid unexpected behavior in other parts of the
function.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-24 16:58:05 +01:00
Cristian Bulacu
f020633603 net: l2: openthread: Initial Border Router support.
Added initial border router code sample.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-07-24 16:56:42 +01:00
Cristian Bulacu
b0bcb68171 net: ip: Kconfig: Re-enable routing support between interfaces support
As packets need to be forwarded between Wi-Fi/Eth interface and
OpenThread interface, routing support has to be re-enabled and
configurable through prj.conf file.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-07-24 16:56:42 +01:00
Anas Nashif
fec22fd85b crypto: remove deprecated tinycrypt
Remove tinycrypt, it was deprecated in 4.0.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-24 02:48:32 -04:00
Joakim Andersson
0fde156b9c fs: shell: Fix FS shell using fixed storage_partition name instead of DT
Fix FS shell using fixed 'storage_partition' nodelabel instead of
accessing the DT defined partition from the zephyr,fstab,littlefs
node partition property.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2025-07-24 02:48:22 -04:00
Van Petrosyan
692a9ae372 modem: pipelink: silence warning in modem_pipelink_is_connected
Initialize local variable `connected` to false to suppress the GCC warning.

Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
2025-07-24 02:45:22 -04:00
Bjarki Arge Andreasen
638bf6b03d modem: cmux: Decouple modem cmux and cellular driver
The modem modules cmux module is currently directly coupled to the
presence of specific modems, rather than being selected by drivers
for whatever hardware wants to request the default MTU of 127 bytes.

This commit the makes the device drivers (for now, modem_cellular)
select the symbol, thus decoupling the modem modules from the
presence of any specific device.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-07-23 17:31:22 +01:00
Jakub Michalski
77834f2069 fs: implement zephyr fs api for virtiofs
This commit implements zephyr filesystem operations for virtiofs

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2025-07-23 12:20:22 -04:00
Jakub Michalski
02b18136e2 fs: add virtiofs operations
This commit adds virtiofs functions implementing fuse operations required
to enable zephyr filesystem support

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
2025-07-23 12:20:22 -04:00
Jakub Michalski
b28483a3fe fs: add fuse primitives
This commit adds fuse structures, requests and functions to fill them

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
2025-07-23 12:20:22 -04:00
Guennadi Liakhovetski
c99605126c llext: only invalidate instruction cache where needed
When preparing LLEXT ELF sections only invalidate instruction cache
of executable sections. Also skip the step on platforms, managing
cache at the application level.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-07-23 09:32:34 +02:00
Bjarki Arge Andreasen
a39285b720 shell: exchange k_poll for k_event
The shell subsystem currently uses k_poll for signalling. However,
k_poll is only used for simple event signals, results are not used.

Replacing the k_poll with k_event greatly simplifies the code, and
saves 4 struct k_poll_signal and 4 struct k_poll_event (one of which
was entirely unused) while costing a single struct k_event, for
every shell instance. It also allows us to not select POLL,
as we are using the simpler EVENTS instead.

A quick test build of the shell test suite on an nrf54l15 produces
the following build info:

using EVENTS:

           FLASH:       71592 B      1428 KB      4.90%
             RAM:        9872 B       188 KB      5.13%
        IDT_LIST:          0 GB        32 KB      0.00%

using POLL

           FLASH:       75524 B      1428 KB      5.16%
             RAM:       11224 B       188 KB      5.83%
        IDT_LIST:          0 GB        32 KB      0.00%

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-07-22 19:34:02 -04:00
Robert Lubos
d3ba674a51 net: lwm2m: Handle RESET replies for separate response
Separate CON responses do no have a reply callback registered (as no
response is expected), however are still registered for retransmission
on the pending list. Therefore, we not only need to check for empty
ACKs for such case but for RESET packets as well. However, this cannot
be done before "reply" processing, as some of the reply handlers
(notifications namely) check for RESET replies.

Therefore, add a final check for the RESET response after the existing
"reply" logic. In such case, just remove the pending response packet
from the retransmission queue, and release resources.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-22 19:30:40 -04:00
Robert Lubos
cf28b5aa65 net: lwm2m: Clear acknowledged flag before sending separate response
When using a separate response mechanism in LwM2M client, the
acknowledged flag is used to notify the engine that the request has been
acknowledged already with an empty ack and a separate CON response
should be sent. The same flag however is used by the retransmission
mechanism, to check if the CON request sent by the client has been
acknowledged by the peer.

As separate responses use the flag both ways, it has to be cleared
before sending the separate CON reply. Otherwise, the retransmission
logic assumes the reply has already been acknowledged and skips the
retransmission.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-22 19:30:40 -04:00
Vinayak Kariappa Chettimada
ede31d39f0 Bluetooth: Controller: Fix assertion using BT_CTLR_LOW_LAT_ULL_DONE
BT_CTLR_LOW_LAT_ULL_DONE is used to reduce CPU usage in LLL
context by delegating the done event dequeue to ULL_HIGH
context.

Building a HCI Controller with BT_CTLR_LOW_LAT_ULL_DONE had
assertion when used with BlueZ stack.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-07-21 13:04:44 -04:00
Vinayak Kariappa Chettimada
cebaad33b1 Bluetooth: Controller: Fix missing ticker force reset on being lazy
Fix missing ticker force reset when the ticker expiry was
skipped or rescheduled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-07-21 13:04:36 -04:00
Vinayak Kariappa Chettimada
0ad4d86354 Bluetooth: Controller: Fix flash sync start from starving connection
Fix flash sync start from repeatedly forcing connection
event be skipped. Space new flash operation to be placed
in the past so that it does not force itself on to an
overlapping connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-07-21 13:04:36 -04:00
Guennadi Liakhovetski
226747a1c8 gdb: fix compilation failures
Compilation fails with an "index outside of array bounds" error:

In function 'find_memory_region',
    inlined from 'gdb_mem_can_read' at \
zephyr/subsys/debug/gdbstub/gdbstub.c:93:7:
zephyr/subsys/debug/gdbstub/gdbstub.c:65:21: warning: array subscript \
idx is outside array bounds of 'const struct gdb_mem_region[0]' \
[-Warray-bounds]
   65 |                 r = &gdb_mem_region_array[idx];
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
zephyr/subsys/debug/gdbstub/gdbstub.c: In function 'gdb_mem_can_read':
zephyr/subsys/debug/gdbstub/gdbstub.c:42:36: note: while referencing \
'gdb_mem_region_array'
   42 | __weak const struct gdb_mem_region gdb_mem_region_array[0];
      |

Use a single element array to fix the problem.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-07-21 13:03:30 -04:00
Luis Ubieda
a000acf85b gnss: rtk: Add basic integration
Incorporate the basic RTK API as well as a basic client integration
(serial) as a way to receive and publish the RTK data.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-21 09:19:14 -04:00
Anas Nashif
e6cfbda666 latmon: guard kconfigs to avoid leaks
Guard all kconfig options to avoid kconfig leakage when latmon is not
enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-21 07:51:07 -04:00
Jamie McCrae
7627367024 settings: Add retention backend
Adds a retention backend for settings

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-21 07:23:29 -04:00
Cheng Chang
c9651c6710 Bluetooth: host: a2dp: Fix stream recv callback not be checked
Now when role is sink and source sends data, stream recv callback is
not registered, apps works fail. so stream recv callback should be
checked.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-07-21 07:23:15 -04:00
Robert Lubos
388a283d88 net: tcp: Fix declaration after label warning with clang
clang reports a warning about a label followed by a variable
declaration:

  label followed by a declaration is a C23 extension

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-21 06:57:14 -04:00
Robert Lubos
90bba475f5 net: tcp: Fix unaligned access warning with clang
Fix one leftover unaligned access warning generated by clang:

  warning: taking address of packed member 'th_seq' of class or
  structure 'tcphdr' may result in an unaligned pointer value

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-21 06:57:14 -04:00
Jorge Ramirez-Ortiz
8c0c4bdace net: latmon: Add latency monitor service
Latmon service to interface with Xenomai's Latmus.

Link: https://evlproject.org/core/benchmarks/#latmus-gpio-response-time

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
2025-07-20 12:27:30 -04:00
Nirav Agrawal
b59d8d56bf bluetooth: bap_unicast_client: fix PTS BAP/UCL/SCC/BV-103-C failure
- In bap_unicast_client, it was assumed that ASE is binded with CIS
 handler during sending "received_stop_ready" to unicast_server.
- In case where unicast_client has not started the stream with
 "receiver_start_ready" att command to server, but wants to disable
 ASE which was Enabled previously (but not stream!) causes failure
 since there is no cis_create has happened and linked to ASE.
- In BAP_TS, "BAP/UCL/SCC/BV-103-C" has a same test conditions where
 client first enables the ASE, disable the ASE, and expecting
 "receiver_stop_ready" att command from client to server followed by
 server notification to enter its ASE in QoS_configured state.
- Removed this condition checks to send expected att command to
 server from Enabling ASE state to Disable ASE.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-07-20 12:24:43 -04:00
Jamie McCrae
5ef8a576bf settings: Only use mutexes when multithreading is enabled
Allows usage of settings when multithreading is disabled

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-19 15:50:23 -04:00
Shrek Wang
c68359ff32 net: tcp: Add support for partially valid data recv
Based on TCP Spec., if the incoming packet seqnum is old but with
new data (seqnum + len > conn->ack), that part of valid data should
be accepted. Now Zephyr doesn't support it.
This patch will add support to such scenario.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-07-19 15:47:57 -04:00
Vinayak Kariappa Chettimada
e3e410aeed Bluetooth: Controller: Fix LLCP event_counter value used during prepare
Fix LLCP to use event_counter value used during prepare to
compare instant to be the value as when in prepare and not
incorrectly use a stale value (when two radio events
overlap).

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-07-19 15:47:45 -04:00
Jamie McCrae
87b1bb8916 dfu: img_util: Upload to slot0 if not running from slot0
Fixes an issue for MCUboot DFU whereby images would always be
uploaded to slot1 instead of slot0 meaning that updates would
never take effect, but retains uploading to slot1 if the
application is running from slot0

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-19 15:45:53 -04:00
Jukka Rissanen
e4a1905245 net: Add alignment support for net_buf data length alloc
The alignment value tells the amount of alignment of buffer length
when allocating net_buf data for sending. By default there is no
special alignment. This is needed for example with Nordic Wi-Fi
chip that uses SPI driver that expects 4 byte alignment for the
length of the data that is being sent.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-07-19 15:37:01 -04:00
Jordan Yates
5c0521c585 conn_mgr: make internal state static
Make the interface interface state array static, ensuring that the array
is zeroed at boot. This enables interfaces which initialise earlier than
the CONN_MGR module to set flags in their init functions.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-07-19 15:35:31 -04:00
Fin Maaß
7e05345562 shell: move date_service to sys_clock api
move date_service from posix api
to sys_clock api.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-07-19 15:30:29 -04:00
Loic Domaigne
f314560b4a Bluetooth: Controller: Fix a potential NULL pointer dereference
Fix a potential NULL pointer dereference for skip_fields in the function
ull_adv_sync_copy_pdu_header. This issue been reported by Coverity.

Coverity CID: 392529

Signed-off-by: Loic Domaigne <tech@domaigne.com>
2025-07-19 13:50:57 -04:00
Andrey Dodonov
8e70b5ad48 net: lib: http: allow configuring response chunk size
Introduce Kconfig HTTP_SERVER_STATIC_FS_RESPONSE_SIZE,
size of individual chunks when serving files.

Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
2025-07-19 13:48:00 -04:00
Tom Burdick
7bc4d14cfc llext: Drop unused memory domain member
Not sure why this vestigal struct member was here at this point (18
months ago...) but its unused and was causing problems for certain
parts.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-07-19 13:40:42 -04:00
Serhiy Katsyuba
98dfa0aa0b pm: Fix to prevent incorrect forever timeout
K_TICKS_FOREVER is defined as -1. Guard logic has been added for the case
when `ticks - exit_latency_ticks == -1` to prevent sys_clock_set_timeout()
from incorrectly setting a forever timeout.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2025-07-19 13:27:08 -04:00
Håvard Reierstad
d989188f29 Bluetooth: Host: l2cap: Fix MPS/MTU confusion
The implementation used BT_L2CAP_ECRED_MIN_MTU to check the lower limits
of both MTU and MPS, instead of BT_L2CAP_ECRED_MIN_MPS for MPS. While
these are the same here, confusion may arise. This commit fixes the
confusion.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-07-19 13:26:29 -04:00
Seppo Takalo
d5f4ca3b64 net: ppp: Allow peer-options to be rejected
There are cases, for example when peer is requesting two DNS
addresses, but we can only give one, we should reject the secondary
DNS request first, before sending NAK to acceptable options.

Option parser can reject a parameter by returning -ENOTSUP and when
it wants to NAK the parameter, it returns -EINVAL.

On RFC 1661:
Configure-Reject
  If some Configuration Options received in a Configure-Request are
  not recognizable or are not acceptable for negotiation (as
  configured by a network administrator), then the implementation
  MUST transmit a Configure-Reject.

Configure-Nak
  If every instance of the received Configuration Options is
  recognizable, but some values are not acceptable, then the
  implementation MUST transmit a Configure-Nak.

So as stated by RFC, we should start the negotiation by rejecting all
parameters that we cannot configure. I added an example of rejecting
DNS requests, if we don't have those.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-07-19 13:24:41 -04:00
Seppo Takalo
5a31f3d108 net: ppp: ipcp: Don't request DNS if not needed
When Kconfig option CONFIG_NET_L2_PPP_OPTION_DNS_USE is enabled,
Zephyr should request two DNS addresses in IPCP negotiation by sending
IPCP ConfReq for DNS otions using 0.0.0.0 as an address.

Remote peer may offer DNS by sending IPCP ConfNak with proper address.
This is explained in RFC 1332 and RFC 1877 (DNS extension).

When no DNS is required, we should only send IPCP ConfReq for IP
address, without having DNS fields in the same request.

However, when PPP is configured to serve a DNS using Kconfig option
CONFIG_NET_L2_PPP_OPTION_SERVE_DNS it should serve the DNS address in the
IPCP ConfNak message and from the ipcp.peer_options structure, not from
the ipcp.my_options.

This might break backward compatibility outside this repository
as DNS addresses used to be served from ipcp.my_options.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-07-19 13:24:41 -04:00
Robert Lubos
3d93657ca9 net: if: Add const qualifier to addr pointer where applicable
Some APIs taken in_addr/in6_addr pointer w/o const qualifier, while they
do not actually intend to modify the provided address. This commit
adds the missing const qualifier where applicable.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-19 13:24:08 -04:00
Florian La Roche
d933e0301e net: sockets: add missing break
Add a missing break to socket handling.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2025-07-19 10:10:58 +02:00
Mark Wang
e71b5122f7 bluetooth: classic: add role switch API
add bt_conn_br_switch_role and bt_conn_br_set_role_switchable to control
the role switch, add DEFAULT_ROLE_SWITCHABLE Kconfig to control the default
role switch state.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-07-19 09:59:16 +02:00