Commit graph

21541 commits

Author SHA1 Message Date
Pisit Sawangvonganan
eeda631ee5 bluetooth: shell: move bt_shell_private.c to common folder
Relocated `bt_shell_private.c` to the `common` folder to enable
independent use between `BT_SHELL` and `BT_MESH_SHELL`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-01-14 10:56:16 +01:00
Tomasz Moń
c705551a8c usb: device_next: hid: Pass request buffer in input report done
Pass the report buffer originally provided in hid_device_submit_report()
as a parameter to input_report_done() callback. Example use case is to
enable HID report multi buffering which is easiest achieved by
allocating report buffer before submitting it and then releasing the
buffer after it has been sent.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-01-14 10:56:06 +01:00
Kyra Lengfeld
64d8713683 Bluetooth: Mesh: use settings priority feature
By using `SETTINGS_STATIC_HANDLER_DEFINE_WITH_CPRIO` we can ensure that
BT subsystems always get loaded after BT, and BT Mesh after both of
them.

This solves the host having to register a GATT service in a delayed
manner, as we are sure to now register the GATT service after sc_commit
sets `SC_LOAD`.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2025-01-14 00:00:56 +01:00
alperen sener
37cdfe818b bluetooth: mesh: fix mesh pb gatt cli uuid usage
uuid needs to be keept in pb_gatt_cli server context until the client
is connected to server, otherwise, since we only kept the pointer from
the net_buffer, any incoming unprovisioned beacon before the connection
is established may overwrite uuid.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2025-01-14 00:00:44 +01:00
Jukka Rissanen
ec96507925 net: pkt: Clone all needed attributes
The net_pkt_clone() did not cloned all needed fields.
Added what was missing from the clone.

Fixes #83157

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-13 20:23:50 +01:00
Jukka Rissanen
eb3804a618 net: http: server: Add Content-Lenght to static FS resource
When serving a static file to the HTTP client, we need to supply also
content length field so that the connection can be closed immediately
when the file is fully sent.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-13 20:23:18 +01:00
Robert Lubos
60f5337a7a shell: websocket: Fix build with websocket logger disabled
In case websocket logger is disabled, the websocket shell backend should
still build, fix that.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-13 20:23:07 +01:00
Robert Lubos
814aa381c4 shell: websocket: Fix duplicate logs over websocket shell backend
In case websocket logging is enabled, the websocket shell should not be
configured as a logger backend, otherwise logs are duplicated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-13 20:23:07 +01:00
Robert Lubos
77810b373a log: websocket: Remove debug printing
The debug printing feature seems to be broken by design - not only in a
default configuration it would trigger endless logging loop (as printk
is piped through logging subsys), it also doesn't work well with
deferred logging (additional artifacts in the output).
Since similar effect can be achieved by enabling any other logger
backend, which should receive the same data as the websocket one, simply
remove it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-13 20:23:07 +01:00
Robert Lubos
02b5ec62c7 log: websocket: Avoid byte drop for long messages
In case the log message length exceeded the websocket buffer size, the
backend would drop the overflowing character, instead of sending it as a
part of the next message.

Rework the ws_console_out() logic a bit to prevent that.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-13 20:23:07 +01:00
Robert Lubos
224ffca819 log: websocket: Fix log output function return value
The log output function registered for the logger backend is expected to
return the number of bytes processed, but currently it returns the TX
retry count. This commit fixes it. In case data could only partially be
sent, respective bytes count is returned. In case of TX error, the bytes
are assumed dropped to prevent busy looping in the logger.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-13 20:23:07 +01:00
Robert Lubos
4e38abad67 shell: websocket: Fix registered log level
Wrong symbol was used for log level when registering logger instance for
websocket shell, causing misconfiguration and in result unexpected
crashes.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-13 20:23:07 +01:00
Pieter De Gendt
81b87ac35b net: lib: coap: Handle truncated messages in CoAP server
If the CoAP server receives a message that doesn't fit into the receive
buffer, we should stop processing the message and respond to the client
with 4.13 "Request Entity too large".

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-01-13 20:22:47 +01:00
Yago Fontoura do Rosario
9f7736259f Bluetooth: Host: Ensure conn_ready access is thread safe
* The `bt_dev.le.conn_ready` list is accessed by the tx_processor
which runs in a workqueue, but `bt_conn_data_ready` can be called
from different threads so we need to make sure that nothing will
trigger a context switch while we are manipulating the list since
sys_slist_*() functions are not thread safe.
* This only happens if call to `bt_conn_data_ready` is performed
from a preemptive task which can happen depending on the
application.

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2025-01-13 10:08:55 +01:00
Anas Nashif
1f4874088f tests: twister: add supported toolchains for unit tests
Allowed toolchains was not set in 'board' metadata causing those to not
build and get filtered.

Fixes #83792

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-01-10 17:12:09 -05:00
Patryk Duda
22d3173a61 include: zephyr: sys: Introduce IS_BIT_SET() macro
This macro is defined in a few places which leads to macro redefinition
error e.g. when compiling prometheus network sample for NPCX boards.

Provide one definition of IS_BIT_SET() in util_macro.h to fix the
problem.

Signed-off-by: Patryk Duda <patrykd@google.com>
2025-01-10 14:48:13 +01:00
Lyle Zhu
132a24d21c Bluetooth: LE: BAP: Check buf len before using it
Check whether the length of buf is consistent with the valid data
received for op code BT_BAP_BASS_OP_ADD_SRC and BT_BAP_BASS_OP_MOD_SRC.

If the length of buf is inconsistent with the valid data received, the
response is error code BT_ATT_ERR_WRITE_REQ_REJECTED instead of other
errors.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-01-10 14:47:54 +01:00
Gang Li
50bcb122e8 net: wifi: shell: fix 11k neighbor request cannot specify ssid
Fix the issue of sending neighbor report request failing
when specifying ssid.

Signed-off-by: Gang Li <gang.li_1@nxp.com>
2025-01-10 09:49:55 +01:00
Nicolas Pitre
46aa6717ff Revert "arch: deprecate _current"
Mostly a revert of commit b1def7145f ("arch: deprecate `_current`").

This commit was part of PR #80716 whose initial purpose was about providing
an architecture specific optimization for _current. The actual deprecation
was sneaked in later on without proper discussion.

The Zephyr core always used _current before and that was fine. It is quite
prevalent as well and the alternative is proving rather verbose.
Furthermore, as a concept, the "current thread" is not something that is
necessarily architecture specific. Therefore the primary abstraction
should not carry the arch_ prefix.

Hence this revert.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-10 07:49:08 +01:00
Maochen Wang
76fd272652 net: wifi: fix wifi connect parameter count error
Fix wrong parameter count error when input 'wifi connect' in
enterprise mode.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
65545997b6 net: wifi: should enable MFP when connect to WPA3 network
Add check that should enable MFP when connect to WPA3 network,
as MFP required is mandatory for WPA3 network.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
bc370ea075 net: wifi: support printing WPA3 enterprise in scan result
Support printing WPA3 enterprise type in scan result for more
accurate display, including the suiteb, suiteb-192 and WPA3
enterprise only.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
f2f2fbb315 hostap: support getting enterprise type by status cmd
For 'wifi status' and 'wifi ap status' cmd of the hostap case,
originally only support getting 'EAP-TLS' for the enterprise
mode, which is not correct. Now support getting the specific
enterprise mode, including the WPA3 enterprise mode and
the EAP method type.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
c1782420d5 hostap: add WPA3 enterprise security type
Change Wi-Fi suiteb type into WPA3 enterprise security type, it
includes suiteB, suiteB-192 and WPA3 enterprise only mode.
Support setting WPA3 enterprise only mode, which should use
cipher_config->key_mgmt as WPA-EAP-SHA256, and the AKM in RSN
IE will show 00-0F-AC:5.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
4777dfaa28 net: l2: wifi: remove EAP TLS SHA256 security
Remove EAP TLS SHA256 security, as it was added to support the AKM
of 00-0F-AC:5 in RSN IE, but actually this AKM is used by WPA3
enterprise only mode.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Luca Burelli
820f0ae15b llext: fix minor Coverity issue #434586 (again)
The check combination of "is zero" and then "less than zero" leaves open
the theoretical possibility of a positive return value, which would
continue on with an uinitialized 'sym'.

Checking for "not zero" has the same effect and covers all situations.

Commit 56fd85442 did the same thing for 'rela' a few lines above, but
missed this instance. No other places in the llext code have this issue.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-10 07:28:51 +01:00
Chris Friedt
ec7d272979 fs: allow mounting filesystems at /
Previously, filesystems could not be mounted at '/' because
mount points were restricted to being at least 2 characters.

Since '/' corresponds to the standard POSIX root filesystem
location, reduce the minimum length of a mount point to
1 character.

With that, we can mount a POSIX root filesystem.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-01-10 04:13:01 +01:00
Chris Friedt
f42a49e4cc demand_paging: use ram backend by default
In order to be functional and avoid linker errors, use a
default setting for BACKING_STORE_CHOICE that is something other
than "this is not implemented".

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-01-09 15:50:37 +01:00
Emil Gydesen
48ac31c7a2 Bluetooth: TMAP: Remove double definitions of TMAP roles support
Both the TMAP kconfig file and public header file defined
which roles were supported.

The Kconfig file options were recently added and were more
up to date (and correct), and allows for other Kconfig files
to use these values, thus allowing for more flexibility when
implementing applications.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-09 15:49:10 +01:00
Matt Rodgers
b7091ed439 net: http_server: serve resources only for their defined services
Ensure that HTTP resources can only be served to a client connected on
the specific service(s) that the resource was registered against using
the HTTP_RESOURCE_DEFINE macro.

This allows different resources to be registered to different services,
for example to make some resources only available via an HTTPS service
and not via unencrypted HTTP.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-09 14:13:57 +01:00
Fin Maaß
3c88970cec mgmt: hawkbit: add CONFIG_HAWKBIT_SAVE_PROGRESS_INTERVAL
add CONFIG_HAWKBIT_SAVE_PROGRESS_INTERVAL, to
be able to set a interval, how often the progress is saved.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-01-09 14:13:42 +01:00
Fin Maaß
4cd44e7da2 mgmt: hawkbit: resume firmware downloads
save download progress, to resume failed
firmware downloads.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-01-09 14:13:42 +01:00
Djordje Nedic
30bac038fa fs: littlefs: Fix lookahead buffer sizing
The lookahead buffer is a bitmap containing info on free blocks and does
not have a minimum size or an alignment requirement.

This fixes the arbitrary 4 * block_size requirement for block devices
and fixes Kconfig documentation to remove a reference to nonexistent
8 byte alignment requirement.

Signed-off-by: Djordje Nedic <nedic.djordje2@gmail.com>
2025-01-09 04:04:16 +01:00
Djordje Nedic
2a206a07b3 fs: littlefs: Improve block device cache size
Instead of picking a set of safe block multiple sized values for caches,
round down to the nearest block multiple, increasing static buffer usage
determined by Kconfig variables.

Signed-off-by: Djordje Nedic <nedic.djordje2@gmail.com>
2025-01-09 04:04:16 +01:00
Dmitry Lukyantsev
c85c8d33d3 demand_paging: Fix static assert in k_mem_paging_backing_store_page_out()
With assert condition set to true, assertion never happens.
Change __ASSERT(true) to __ASSERT(false).

Signed-off-by: Dmitry Lukyantsev <dmitrylu@meta.com>
2025-01-08 21:02:15 +01:00
Matt Rodgers
549e5de277 net: websocket: pass HTTP upgrade request context to user callback
Passing HTTP upgrade request context to the user callback allows the
user to decide whether to accept or reject the websocket connection
based on the HTTP headers in the request. The primary reason for this is
to enable authentication of the websocket connection (e.g. via cookies
or Authorization header).

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-08 21:02:02 +01:00
Daniel Mangum
2522bb0f1b net: support configuring offloaded network device as default interface
Adds Kconfig option for making an offloaded network device the default
interface.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2025-01-08 19:11:15 +01:00
Emil Gydesen
cc042a6a70 Bluetooth: Host: Refactor provacative comment
There is no reason to call people who disable
asserts for animals.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-08 07:51:17 +01:00
Emil Gydesen
e45830893f Bluetooth: CCP: Introduce new CCP API
The CCP API for the Call Control Profile works on top of the
TBS API, and will eventually replace parts of the TBS API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-08 07:50:32 +01:00
Martin Jäger
0a838bc000 task_wdt: Kconfig: Increase TASK_WDT_HW_FALLBACK_DELAY range
If a time-intensive task (like coredump storage over logging interface)
is run in the task watchdog callback, the hardware watchdog might
reset the system before the task finishes.

Increasing the delay from 1s to 10s, which should be sufficient for any
use case.

Signed-off-by: Martin Jäger <martin@libre.solar>
2025-01-07 20:34:41 +01:00
Dominik Ermel
bb0fa0746b stream_flash: Enforce size to be explicitly present on init
The commit changes requirements for stream_flash_init, where size
can no longer be 0 and has to be explicitly set, to avoid situation
where size autodetection, invoked by size == 0, would miss changes in
layout and silently allow overflow of Stream Flash into other partitions.

There has also been new Kconfig option CONFIG_STREAM_FLASH_INSPECT,
set to y by default to keep legacy behaviour, that can be used to turn
off stream_flash_ctx vs device inspection, allowing user to shed
inspection code once it is not useful anymore.

Fixes: #71042

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-01-07 15:56:49 +01:00
Dominik Ermel
ce971850fb storage/stream_flash: Initialize settings at point of use
The commit moves Settigns initialization out of stream_flash
initialization function into: stream_flash_progress_clear
 stream_flash_progress_load and stream_flash_progress_save.

This slightly increases code size (~56 bytes on Arm) but allows
to initialize Stream Flash even if Settings subsystem fails
to initialize and continue providing its basic functionality.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-01-07 10:10:15 +01:00
Triveni Danda
3a2a7c1855 net: ip: Add a name to existing Kconfig choice
Update kconfig choice name to enable overriding
from other parts of the code.

Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
2025-01-07 08:08:58 +01:00
Emil Gydesen
a0b1e75268 Bluetooth: MPL: Fix build issues with the MPL shell
If logging (CONFIG_LOGGING) was disabled, then the shell
could not build. Ideally the (test) functions should not
depend on logging, but rather only CONFIG_BT_TESTING.

The shell commands were also properly guarded.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-07 00:27:17 +01:00
Matt Rodgers
b7b3449f48 net: websocket: don't mask data sent from server via zvfs write
RFC6455 section 5.1 specifies that "A server MUST NOT mask any frames
that it sends to the client". Implement this for websocket write calls
via ZVFS, by storing in the websocket_context whether a socket is acting
in the client or server role, and using this to determine if sent data
should be masked.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-03 13:26:43 +01:00
Chaitanya Tata
b28f246f53 net: l2: wifi: Fix PHY rate display
The WPA supplicant already converts this to Mbps.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-01-03 11:39:13 +01:00
Jamie McCrae
5871037426 mgmt: mcumgr: grp: os_mgmt: Add error code for invalid responses
Adds a new error code that can be used to signify that a query was
valid but the response was not valid

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-01-03 10:02:23 +01:00
Kris Wolff
991fd8d4d5 net: dhcpv4: update DNS address assignment to be optional
The DHCPv4 options always assigns the DNS address if the router
provides one through the DHCP callback. There are times a developer
may not always want to assign the server from the router, but only
manually assign them. Adding a Kconfig option for assigning the DNS
address and defaulting to true to not interfere with previously
expected functionality.

Signed-off-by: Kris Wolff <kwolff@wavelynx.com>
2025-01-02 16:03:25 +01:00
Maochen Wang
f9901e8e9b net: sockets: change socketpair related buffer and heap size
Latest supplicant uses 1K buffer size for sending control message via
socketpair, so reducing the NET_SOCKETPAIR_BUFFER_SIZE to save memory
footprint. There are 4 socketpairs for supplicant only case, and 6
socketpairs for hostapd case, update the heap size correspondingly.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-02 12:35:46 +01:00
Vinayak Kariappa Chettimada
9678ff2041 Bluetooth: Controller: Include mem and ecb in-system tests
Include mem and ecb implementation in-system tests.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-01 02:04:33 +01:00