Commit graph

21541 commits

Author SHA1 Message Date
Benjamin Cabé
ea2990702f input: adopt SHELL_HELP
Adopt SHELL_HELP macro for input shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-14 12:37:41 -04:00
Szymon Janc
9b27a472f4 Bluetooth: Host: Fix SMP Pairing failed code on invalid Public Key
Core Specification 6.1 clarified exptected erro code in case peer
sending invalid Public Key. In case pairing is aborted during or
immediately after Public Key Exchange phase has completed (which is
the case here) expected reason code is set to "DHKey Check Failed".

This was affecting SM/CEN/KDU/BI-04-C and SM/PER/KDU/BI-04-C
qualification test cases.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-06-13 10:21:42 -07:00
Benjamin Cabé
5e287bb73f net: coap: adopt SHELL_HELP
Adopt SHELL_HELP macro for coap_server_shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-13 10:11:29 -07:00
Benjamin Cabé
5f9d4385f3 pm: adopt SHELL_HELP
Adopt SHELL_HELP macro for pm_shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-13 10:42:16 -04:00
Benjamin Cabé
595645b4fe settings: adopt SHELL_HELP
Adopt SHELL_HELP macro for settings_shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-13 10:41:42 -04:00
Adib Taraben
9b8be4971e drivers: ethernet: nxp: timestamping to all potential packets.
add timestamping on Tx to packets marked for timestamping
add timestamping on Rx to all packets for later use
fix race condidition on adding timestamp when sending delay_req

Signed-off-by: Adib Taraben <theadib@gmail.com>
2025-06-13 10:40:49 -04:00
Vinayak Kariappa Chettimada
d011dd11da Bluetooth: Controller: nRF53x: Fix up ISO Rx Buffer size
Fix up the bus fault by not violating the MAXPACKETSIZE
value range of NRF_CCM h/w peripheral.

Fix up relates to commit 920117922b ("Bluetooth:
Controller: nRF53x: Fix NRF_CCM MAXPACKETSIZE value").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-06-13 10:39:09 -04:00
Vinayak Kariappa Chettimada
01c9c6716a Bluetooth: Controller: Fix incorrect elapsed events value
Fix incorrect elapsed events value when LLL event prepare_cb
was invoked but was aborted before anchor point sync. This
caused premature supervision timeouts under applications
configured with CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX=n
and CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n.

Fixes commit 247037bd3e ("Bluetooth: Controller: Fix
incorrect elapsed events value").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-06-13 10:34:31 -04:00
Marco Widmer
09691484eb Bluetooth: Controller: Deinit ticker
ticker_is_initialized() should only return true when the ticker is
running (triggered regularly). Users like nrf_flash_sync_is_required()
depend on this behavior.

When the bluetooth controller driver is closed, ll_deinit() calls
lll_deinit(), which stops the ticker from being triggered. Also
deinitialize the ticker to ensure that ticker_is_initialized() returns
false.

Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
2025-06-13 10:33:01 -04:00
Shrek Wang
46ba523ba8 net: tcp: Align TCP seqence validation with Spec
According to RFC 793, the seqnum test includes 4 cases when STATE >
TCP_SYN_SENT:

      Seg-len Recv-win    Test
      ------- --------    ---------------------------------------
        0       0         SEG.SEQ = RCV.NXT
        0      >0         RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
       >0       0         not acceptable
       >0      >0         RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
                       or RCV.NXT =< SEG.SEQ+SEG.LEN-1 <RCV.NXT+RCV.WND

After the seq validation, the 'send duplicated ACK' code in FIN_WAIT1/
2/CLOSING/TIMEWAIT state processing is duplicated, so remove them.

Added TEST_CLIENT_SEQ_VALIDATION ztest case in tests/net/tcp.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-06-13 14:28:50 +02:00
Johann Fischer
569f4d6d18 usb: device_next: fix the null pointer dereference on FS devices
With the commit fe3c001eeb ("usb: device_next: disable high-speed USB
device descriptor if not used") there is no high-speed device descriptor
by default.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-13 11:13:14 +02:00
Lyle Zhu
672d367642 Bluetooth: Remove useless sys_cpu_to_le16 for uint8_t type
The target variable is a `uint8_t`. It is not reasonable to pass a
value with `uint16_t` in little-endian format.

Remove `sys_cpu_to_le16`, and pass the value directly.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-06-13 10:10:04 +02:00
Vinayak Kariappa Chettimada
c8fd14ecab Bluetooth: Controller: No ISR_DIRECT_PM and no reschedule for ZLI
When using Zero Latency IRQs do not invoke ISR_DIRECT_PM and
do not return to reschedule in the kernel.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-06-13 07:36:27 +02:00
Jukka Rissanen
d394b74a41 net: shell: dns: Add list command to show service records
Add "net dns list" command that will show DNS SD records
defined in the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-12 09:39:49 -07:00
Jukka Rissanen
ff805ae376 net: dns-sd: Add internal record validator function
Allow network shell DNS module to verify that the DNS SD
record is a valid one. Currently this is not exposed to
applications.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-12 09:39:49 -07:00
Robert Lubos
86244a9c54 net: stats: Make byte counters 64-bit
In high throughput tests it's fairly easy to overflow the current 32-bit
byte counters in net statistics (it's just over 4 GB of data).
Therefore, make the byte counters 64-bit to prevent overflows.
Rearrange some fields to avoid padding.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-06-12 09:36:38 -07:00
Robert Lubos
b877d2c1fe net: stats: Use correct format specifiers when printing stats
net_stats_t type is an unsigned type, therefore %u should be used
instead of %d when printing values of this type, otherwise negative
values will be printer if INT32_MAX is exceeded.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-06-12 09:36:38 -07:00
Maochen Wang
d4648a6767 net: l2: wifi: fix invalid option error when use -i
For 'wifi connect' or 'wifi ap enable' CMD, there is 'invalid option'
error log when input '-i' parameter. Parsing '-i' can fix this issue.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-06-12 10:24:36 +02:00
Maochen Wang
5bcaf33d79 net: l2: wifi: fix dpp btstrap_gen CMD failure
Input 'wifi dpp btstrap_gen ...' cmd or 'wifi dpp ap_qr_code ...',
the console shows 'wrong parameter count'. Fix the typo of 'wifi
dpp btstrap_gen' and 'wifi dpp ap_qr_code' CMD's parameter count.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-06-12 10:24:36 +02:00
Håvard Reierstad
2a8118c945 Bluetooth: Host: Update LE legacy pairing check
Updates the LE legacy pairing procedure as a result of errata ES-24491.
New part:
If the initiating device receives an LP_CONFIRM_R value that is equal to
the LP_CONFIRM_I value, the pairing process shall be aborted and fail
with "Confirm Value Failed" as reason.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-06-11 16:26:23 -07:00
Pieter De Gendt
cf39d12714 net: lib: http: Select required symbols for server
Select the NET_SOCKETS and EVENTFD kconfig symbols in order for the HTTP
server to compile.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-11 16:21:36 -07:00
Robert Lubos
b18bc7cc3e net: sockets_offload: Allow to enable/disable DNS offload at runtime
Add new socket offloading functions, allowing to enable/disable
offloaded DNS implementation at runtime. This may be useful if there is
a mix of offloaded/native network interfaces in the system, so the
application can choose which DNS backend to use.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-06-11 16:20:18 -07:00
Arif Balik
1939ba64c3 logging: backend: mqtt
Added MQTT logging backend

Signed-off-by: Arif Balik <arifbalik@outlook.com>
2025-06-11 16:18:51 -07:00
Robert Lubos
35af68b840 net: mqtt: Allow to bind client to a specific interface
Add a new "if_name" pointer to the transport configuration structure,
allowing the application to bind MQTT client to a specific network
interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-06-11 16:18:31 -07:00
Lyle Zhu
6231b43435 Bluetooth: Classic: SDP: Fix buf leak issue
In the function `sdp_client_ss_search()` and
`sdp_client_ssa_search()`, the allocated buf is not released if the
required UUID is invalid.

Un-reference the allocated net buffer if the UUID is invalid.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-06-11 16:12:31 -07:00
Jukka Rissanen
bd4c0b746c net: acd: Avoid removing auto IPv4 address twice
When the network interface goes down, we call
net_ipv4_autoconf_reset() which removes the autoaddress
from the network interface.
The net_ipv4_autoconf_reset() is also called when ACD is started
in which case we could see this error message

<dbg> net_if_start_acd: Starting ACD for iface 2
<err> net_if: iface 2 addr 169.254.174.230 (net_if_ipv4_addr_rm():4625)
<dbg> net_if_ipv4_addr_rm: Address 169.254.174.230 not found (-22)

This error is superfluous and not needed. So before trying to
remove the address, check if the interface already has it set and
only then remove it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-11 10:26:56 -07:00
Jukka Rissanen
902c95ab95 net: if: Do not start ACD for localhost or point2point links
When adding IPv4 address to the network interface, there is no
need to start ACD procedure for localhost or point-to-point links.
The ACD start function would mark the IP address like 127.0.0.1 as
tentative and never make it preferred which would then cause issues
when selecting the network address for sending.
As the ACD start is also called when the network interface comes up,
add the localhost and point-to-point link check to ACD start function
so that we will avoid ACD checks in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-11 10:26:56 -07:00
Benjamin Cabé
332d8b37ff modbus: fix Apache-2.0 SPDX License identifier case
While SPDX license identifiers are usually considered to be
case-insensitive, matching the case of the canonical identifier is
recommended by the SPDX specification.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-11 10:23:46 -07:00
Fin Maaß
ed4d421ace drivers: ethernet: remove phy related configs from eth config
remove phy related configs from eth config.
phy related configs chould go directly into the phy.
Most ethernet drivers didn't support the now removed
functions yet. Users should instead use `phy_configure_link()`
together with the `net_eth_get_phy()` function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-06-11 10:17:37 -07:00
Fin Maaß
c169ac07a0 drivers: ethernet: remove get configs that are unused
remove get configs that are unused by the
ethernet mgmt api.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-06-11 10:17:37 -07:00
Jamie McCrae
709526007f storage: flash_map: Add support for sub-partitions
Adds support for sub-partitions to the default flash map

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-06-11 10:13:56 -07:00
Adam Kondraciuk
31689690c9 ipc: ipc_service: Parametrize workqueue stack size
Add `IPC_SERVICE_BACKEND_ICBMSG_EP_BOUND_WORK_Q_STACK_SIZE` config
and parametrize its value depending on the optimization level.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2025-06-11 10:09:02 -07:00
Maksim Salau
c2fd84fdd5 modbus: serial: Ignore received data when reception is disabled
A byte received when reception has been disabled
corrupts internal state of the server
(e.g. during transmission of a reply in server mode).
The reponse packet is corrupted and its transmission is aborted and the
data in the buffer is treated by the server as a new incoming packet.
Since the buffer is corrupted CRC doesn't match and the following log
message is printed:

  <wrn> modbus_serial: Calculated CRC does not match received CRC

This condition happens when uart_irq_rx_ready() returns true if there is
a new byte in the receive FIFO even with disabled RX interrupt.

The issue has been discovered on a nucleo_u083rc board with a RS485
transceiver with the RI signal floating (a pull-down gives more stable
reproduction). The pull-down ensures that RI is low during transmission
which is seen as byte 0 with a framing error by the receiver.
The byte is received by the MCU and corrupts the response.
Similar effect can be achieved by not disabling the receiver during
transmission (i.e. nRE is driven by the MCU and is fixed low).

The fix discards any data received when reception has been disabled.

Signed-off-by: Maksim Salau <msalau@iotecha.com>
2025-06-11 10:08:25 -07:00
Emil Gydesen
9b4bebbdf3 Bluetooth: ASCS: Sonarcloud fixes
Made a few complex functions simpler
Added missing default cases in switches
Fixes a bad cast that removed const
Moved loop iterators to inner loop

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-06-11 08:58:09 -04:00
Emil Gydesen
314678c48d Bluetooth: AICS Client: Fix sonarcloud issues
Fixes a few bad casts that ignored const
Add a few missing final else statement
Refactored aics_discover_func to be less complex by
moving some parts of it into a new function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-06-11 08:57:26 -04:00
Emil Gydesen
bf8570256f Bluetooth: AICS: Fix sonarcloud issues
Add missing else and refactored write_aics_control to
be less complex.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-06-11 08:57:26 -04:00
Benjamin Cabé
9ab0ea73a8 shell: Introduce structured help message
In order to enable better and more consistent help messages for shell
commands, this commit introduces a new SHELL_HELP macro that allows to
document a command's description and usage in a more structured way.

This will allow to get rid of inconsistent (and duplicated!) variations
of "Syntax: ...", "Syntax:\n ...", "Usage: ...", in the commands, and
formatting of the description+usage will be taken care of by the shell
when it detects the help message is using the "structured" format.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-11 09:55:21 +02:00
Benjamin Cabé
7bdeffb5a6 shell: fix margin handling after newlines in formatted help text
Lines following newlines in shell help text were not properly indented.
For example, in "abc def\ndef ghi\njkl mno", the lines "def ghi" and
"jkl mno" would appear without the expected left margin.

The issue was that after processing a newline and setting proper cursor
position, the function would fall through to z_shell_raw_fprintf() which

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-11 09:55:21 +02:00
Ling Pei Lee
75bfd799c4 net: shell: iface: Add link speed settings command
Add this to set link speed through net_shell.
Current zephyr version doesn't have user interface to change
speed, hence adding this to accomodate it. Full duplex will
be set by default for each link speed.

Able to change link speed using command below:
net iface set_link <iface idx> <speed> <optional:h(half)/f(full)>
eg: net iface set_link 1 100 h
    net iface set_link 1 10 f
    net iface set_link 1 1000

Able to set multiple link speed like below:
net iface set_link <iface idx> <speed1> <speed2> <optional:h/f>
eg: net iface set_link 1 10 100 h
    net iface set_link 1 1000 f 10

Signed-off-by: Ling Pei Lee <pei.lee.ling@intel.com>
2025-06-11 09:54:56 +02:00
Johann Fischer
79a80730b2 usb: device_next: allow to use label as interface string descriptor
The intention was to use the "interface-name" string property in the
interface string descriptor, but using the label property is acceptable
again. Therefore, allow the use of the DT label property string in the
interface string descriptor.

Follow exactly the same approach as in the CDC ACM implementation
introduced in the commit b0791400f6
("usb: device_next: cdc_acm: allow setting the interface description").

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-11 08:18:30 +02:00
Lyle Zhu
55c0f00f23 Bluetooth: Classic: SDP: Avoid invalid session->param be accessed
The `session->param` should be updated to date whatever the function
`sdp_client_ssa_search()`, `sdp_client_sa_search()` or
`sdp_client_ss_search()` can be executed properly.

Update the `session->param` to the new `param` when executing the
function.

Fixes #91156

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-06-11 08:17:57 +02:00
Maksim Salau
bdd94261a5 modbus: serial: Add non-compliant mode with custom stop-bit settings
The mode is activated by the CONFIG_MODBUS_NONCOMPLIANT_SERIAL_MODE option
and allows any stop-bit setting for the serial port.

Signed-off-by: Maksim Salau <msalau@iotecha.com>
2025-06-10 12:53:23 -04:00
Guennadi Liakhovetski
5f4177b47c llext: add context save and restore
Some applications need to save LLEXT context, e.g. when suspending,
to later restore it quickly without a full relinking. Add 2 functions
for context saving and restoring. Since these functions are likely to
change in the future, put them in llext_experimental.c, which depends
on CONFIG_LLEXT_EXPERIMENTAL and is disabled by default.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-06-10 12:52:38 -04:00
Guennadi Liakhovetski
d8195c05c7 llext: rename _llext_list to llext_list
Beginning symbols or structure field names with an underscore isn't a
widely used style in Zephyr, remove the leading underscore from
_llext_list.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-06-10 12:52:38 -04:00
Alberto Escolar Piedras
3c55048c76 unit_testing: Fix NATIVE_APPLICATION kconfig dependency
NATIVE_APPLICATION is deprecated, let's not use it, let's use instead
NATIVE_BUILD.
unit_testing is not really meant to be covered by NATIVE_APPLICATION,
or NATIVE_BUILD for that matter, as these options are meant for POSIX
arch based targets.
Still, some kconfig options will default to something which will
also be incompatible with unit_testing (primarily CONFIG_PICOLIBC=y)
if we don't set at least NATIVE_BUILD, which would cause some unit
tests to fail. So let's select NATIVE_BUILD to avoid needing to add
extra dependencies on the libCs options.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-06-10 13:29:28 +02:00
Lyle Zhu
f924af1df5 Bluetooth: Classic: HFP_HF: Fix out of bounds potential issue
There is a potential issue that the index of ACL may out of the
bounds of the array `bt_hfp_hf_pool` if the array size is not aligned
with the array size of `acl_conns`.

To avoid the potential issue, check if the ACL conn index is less than
the array size of `bt_hfp_hf_pool` before accessing the array
`bt_hfp_hf_pool` with ACL conn index.

Fixes #91172

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-06-10 13:29:17 +02:00
Mark Wang
d166d53238 bluetooth: keys: addr is null and assert in bt_keys_find_addr
When there are br connections connected, find_key_in_use call
bt_conn_get_dst to get br connection's dst and bt_conn_get_dst return NULL,
then bt_keys_find_addr aseert because addr is NULL.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-06-10 13:28:55 +02:00
ZhongYao Luo
821e9f3c6a Bluetooth: SDP: Don't clear l2cap chan on disconnect
- Remove memset on bt_l2cap_br_chan during SDP
  disconnect to prevent overwriting resources
  (e.g., rtx_work) still in use by L2CAP,
  which handles channel cleanup itself.
- Delete unused partial_resp_queue to clean up code.

Signed-off-by: ZhongYao Luo <LuoZhongYao@gmail.com>
2025-06-10 13:28:24 +02:00
Lu Jia
634b72a76c Bluetooth: Add API to obtain ACL connection corresponding to a2dp
When connecting two devices with an application, it
is necessary to differentiate which is the remote device.

Signed-off-by: Lu Jia <jialu@xiaomi.com>
2025-06-10 13:28:16 +02:00
Lyle Zhu
2a1bcc2919 Bluetooth: Classic: L2CAP: Fix issue is received data len less than 2
If the received data length is less than 2 in none basic mode, the
L2CAP channel connection will be dropped.

Only check the received data length if the `SAR` is
`BT_L2CAP_CONTROL_SAR_START`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-06-10 12:25:55 +02:00