Commit graph

21541 commits

Author SHA1 Message Date
Jordan Yates
4582c64816 net: lib: zperf: warning on bad response flags
Output a warning if the server response does not have the expected
header flag set.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-22 09:59:57 +02:00
Jordan Yates
5c8b7cdd89 net: lib: zperf: fix internal UDP header definition
Fix the zperf UDP datagram header definition, as iperf introduced a
backwards incompatible format change in version 2.0.10 (August 2017).
```
struct UDP_datagram {
// used to reference the 4 byte ID number we place in UDP datagrams
// Support 64 bit seqno on machines that support them
    uint32_t id;
    uint32_t tv_sec;
    uint32_t tv_usec;
    uint32_t id2;
};
```

Update the header to the new format, with a Kconfig option to fall back
to the previous header definition.

The response decoding was testd with a nRF7002 client and
`iperf-2.2.1-win64.exe` server, with the output statistics struct now
containing the same information as reported on the PC server.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-22 09:59:57 +02:00
Lyle Zhu
40b10ccf8d Bluetooth: Classic: SSP: Only set MITM when sec level is more than 2
The local device shall only set the MITM protection required flag if
the local device itself requires MITM protection.

Only set MITM flag when the required security level is more than 2 and
pairing method is not `JUST_WORKS`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-21 12:43:42 +02:00
Tom Burdick
1e0af58b51 pmci: Move MCTP into the PMCI subsys
PMCI conveys a stack of specifications from DMTF including MCTP (a
transport layer protocol), PLDM (request/response messaging protocol),
and ancillary SPDM messaging. Placing all these libraries under PMCI
subsystem makes more sense than simply adding MCTP as its own subsystem.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-04-21 12:43:33 +02:00
Krzysztof Chruściński
bb4fb12ca4 pm: policy: default: Optimize power state selection
Update power state selection. Previously, it was iterating over states
starting from the last one so the most common short sleep periods were
taking the longest time to select. Order is now swapped so that short
sleeps will get power state as quick as possible.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-21 07:45:07 +02:00
Krzysztof Chruściński
5a313e141d pm: Add option to quickly detect power state availability
When all states are locked or latency requirement cannot be met
by any power state it is important to be able to quickly exit
suspend procedure because that usually means that application
requires high performance. Add function for detecting if any
power state is available.

Additionally, add function pm_policy_state_is_available for
checking if given state is available which means that it is not
locked and fulfills current latency requirement.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-21 07:45:07 +02:00
Yishai Jaffe
b5c634f4bb cfb: fix get_glyph_byte for vtiled displays
V-Tiled displays need different treatment when getting the glyph byte.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-04-18 12:36:16 +02:00
Emil Gydesen
efdca63c25 Bluetooth: Host: Add missing includes for all BT host files
Added missing includes and fixed typos in the files.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-17 21:17:29 +02:00
Emil Gydesen
1efd817dbd Bluetooth: Shell: Add missing includes for all BT host shell files
Added missing includes and fixed typos in the files.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-17 21:17:29 +02:00
Krzysztof Chruściński
ecabcf5db5 pm: Use pointers for current and forced power states
Use power state pointers instead of copies which improves performance.

Align power_mgmt_multicore test which was creating pm states in
runtime.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-17 21:17:18 +02:00
Aleksandr Khromykh
b53b5e198a bluetooth: rename _bt_gatt_ccc and clarify usage
Bluetooth had two public types with similar name _bt_gatt_ccc and
bt_gatt_ccc, but for absolutely different purposes.
That caused misunderstanding of relationship of them and cases
where to use which one.

Commit changes name of _bt_gatt_ccc to more suitable by usage and
improves documentation of it.

Additionally, it changes name of BT_GATT_CCC_INITIALIZER
to correspond the type name.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-04-17 17:24:19 +02:00
Robert Lubos
6c0aef4da0 net: sockets: packet: Ensure correct interface is used
Make sure that when sendto is being used without the socket being bound
before, a correct interface is used for transmission. As
zpacket_sendto_ctx() calls net_context_recv() to register receive
callback before sending, a default binding was used by the context
layer, which would bind the socket to the default interface. This could
lead to unexpected results, i.e. packet being sent on a default
interface, even though a different one was specified.

Make also sure that there is no ambiguity in the interface selection -
the application should be explicitly clear what interface it wants to
use when it comes to packet sockets. It's better to return an error if
no valid interface was specified.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-17 17:23:23 +02:00
Robert Lubos
332843be33 net: sockets: packet: Allow proto 0 for RAW sockets
According to AF_PACKET man pages protocol number 0 is allowed, however
in such case the socket is only capable of transmitting packets then:

  "If protocol is set to zero, no packets are received."

Therefore, allow to create sockets with such protocol, and at the
connection.c level filter out such sockets from data reception.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-17 17:23:23 +02:00
Martin Durietz
3197be97e6 lorawan: add link check support.
Add link check support, by adding:
- link check callback in response of LinkCheckAns.
- link check request function using LinkCheckReq.

Signed-off-by: Martin Durietz <martin.durietz@gmail.com>
2025-04-17 17:23:12 +02:00
Chaitanya Tata
eb1a13eda7 samples: net: wifi: Add two variants of certs
RSA3K based certs are not supported on all platforms, so, keep both
variants, rsa2k (the older certs but with longer expiry 9999 days) and
rsa3k (latest ones) and we can have more variants in this folders.

Also, add a cmake variable to override the path with default as rsa3k.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-04-17 17:22:58 +02:00
Chaitanya Tata
9b68218e9a net: l2: wifi: Make build time certs as optional
Certificates usage depends on STA/AP mode, but we don't have that
information at a build time, so, make all certs as optional and if a
file isn't found then generate an empty header so that corresponding C
code will be built.

Any missing mandatory certificates will be validated before connection
and connection is failed.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-04-17 17:22:58 +02:00
Chaitanya Tata
c2f4e67c8a net: lib: tls_credentials_shell: Fix crash during delete
Deletion of credential should use the pointer from the reference slot
not the temporary buffer, this causes a crash (unknown error).

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-04-17 17:22:58 +02:00
Chaitanya Tata
7ba5e43cf5 net: lib: tls_credentials_shell: Add a config for heap
The volatile backend stores the credentials on the heap, so, explicitly
add a config option that can be overridden in case there are more certs
than the default.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-04-17 17:22:58 +02:00
Chaitanya Tata
b2e7d7fc0c net: l2: wifi: Add support for run-time certificates
Using TLS credentials library add support for run-time certificates where
the installed certs are retrieved from the credential store (as of now
only volatile backend is tested).

This helps in production environments.

Implements #79564.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-04-17 17:22:58 +02:00
Riadh Ghaddab
2eba2e9c9c zms: add more robustiness in extreme cases
When power cuts during a GC operation, the sector is erased again in the
next reboot cycle and the cycle_cnt of the empty ATE is incremented.
If the same power cut happens 255 times in a row, the empty ATE cycle_cnt
will become equal to the close ATE which causes a memory corruption.
Fix this by checking the close ATE cycle_cnt before incrementing the
empty ATE cycle_cnt.

Fixes: #84874
Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-04-16 20:36:49 +02:00
Toon Stegen
a4f89574b9 bluetooth: increase stack size for NO_OPTIMIZATIONS
when building without optimizations, the bt long thread needs more space
to not crash

Signed-off-by: Toon Stegen <toon@toostsolutions.be>
2025-04-16 17:08:02 +02:00
Kapil Bhatt
a9507729c7 net: lib: Correct the wifi_cred command
Change wifi_cred to wifi cred.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2025-04-16 14:53:54 +02:00
Krzysztof Chruściński
2ccc3ce6aa debug: cpu_load: Add missing static keyword
Local variable for counter device is missing static keyword.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-16 14:53:30 +02:00
Jukka Rissanen
4c01b37bda net: pkt_filter: Add VLAN support to filtering
The Ethernet matching needs tweaking so that it will also
work with VLAN packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jukka Rissanen
3232b6190c net: pkt_filter: Add more debug prints when matching packets
Add some more useful debug prints when checking packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jukka Rissanen
28dca17436 net: shell: Add packet filter support
Add a "net filter" command that will allow user to see the
current network packet filter configuration.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jukka Rissanen
f5bac38865 net: pkt_filter: Add enablers for shell support
Add helpers and enablers that allow "net filter" shell command to
work.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jukka Rissanen
bd3ce84d91 net: virtual: Hook into packet filter processing
Make sure that we check possible network packet filtering status
before accepting the packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jukka Rissanen
cde70232b9 net: pkt_filter: Add statistics support to packet filter
As the network packet filter drops packets without any indication
that the packet is dropped, it can be difficult to monitor what
is going on in the system when receiving data. The user can
now monitor the statistics and see if packets are being dropped
because of packet filter activity.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jukka Rissanen
c066deb5ef net: pkt_filter: Avoid unused function warning
The get_ip_rules() function is only used if IPv4 or IPv6
filtering is enabled so add checks to avoid unused function
warning.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jordan Yates
dfabbee634 net: socketpair: fix allocated number of buffers
According to `f9901e8e` and validated by testing, the supplicant only
use case only requires 4 socket pairs. 6 pairs are required for the
`hostapd` use case.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-16 08:05:12 +02:00
Jordan Yates
94583777fd net: socketpair: give allocation strategy option a name
Give the socketpair allocation strategy a name so that users can change
the default.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-16 08:05:12 +02:00
Jordan Yates
e803bfb4bb net: ip: net_context: louder warning for no src address
Increase the verbosity of the message when there is no source address
in `net_context_create_ipv4_new`. This is likely the first failure point
when attempting to send data on an interface that has not yet been
assigned an IP address. Burying the fault at the DBG level makes it much
more time consuming to determine the root cause of this error.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-16 08:05:03 +02:00
Emil Gydesen
da953b64c2 Bluetooth: Host: Shell: Add missing guard for CS test commands
The start_simple_cs_test and stop_cs_test depends on
CONFIG_BT_CHANNEL_SOUNDING_TEST and could cause build errors if that
is disabled while CONFIG_BT_CHANNEL_SOUNDING=y in the shell.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-16 08:04:53 +02:00
Eric Ackermann
421a7047e5 net: gPTP: Fix pointer type in gptp_add_port
The number of ports in gptp_domain.default_ds.nb_ports is a uint8_t.
A pointer to it is passed to gptp_add_port.
However, in this method, the pointer is cast to an int pointer.
The C compiler generates an int-size store for this.
In addition to potentially overwriting adjacent attributes, on platforms
such as RISC-V that do not support unaligned accesses, this causes an
exception on access.
This commit casts nb_ports to the correct type, uint8_t.

Signed-off-by: Eric Ackermann <eric.ackermann@cispa.de>
2025-04-15 19:10:04 +02:00
Utsav Munendra
fd8abcff37 portability: cmsis: Avoid copying objects names into control block
Instead, just store the pointer to the string provided as part of the
RTOS object init attributes.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-04-14 20:03:19 +02:00
Utsav Munendra
e676bf3d35 portability: cmsis: Store thread name within Zephyr k_thread
Use underlying Zephyr thread directly to store thread name instead of
storing the name in CMSIS control block. Also, allow `osThreadGetName`
to work within ISR, as expected from spec.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-04-14 20:03:19 +02:00
Jordan Yates
ab34a9df48 zbus: remove k_malloc dependency for ZBUS_RUNTIME_OBSERVERS
Remove the dependency on the system heap existing when enabling
`ZBUS_RUNTIME_OBSERVERS`. Instead the previously allocated memory is
required to be provided to `zbus_chan_add_obs` (which can still be
allocated through malloc).

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-14 20:03:09 +02:00
Fin Maaß
ddefc4222b storage: flash_map: add flash_area_copy()
add flash_area_copy() function based on
flash_copy().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-14 16:07:35 +02:00
Théo Battrel
77bdc8a435 Bluetooth: Add usage of util_eq and util_memeq
Update `bt_irk_eq` to use `util_memeq` instead of `memcmp` and the
"disconnect" BabbleSim test to use `util_eq` instead of a first
assertion on the size followed by a `memcmp`.

This is done as an example usage of the two new functions.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2025-04-14 16:06:38 +02:00
Mark Wang
6c9e478e49 Bluetooth: Classic: Fix assert when aborting initiating SCO connection
return an error instead of assert

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-04-14 13:06:20 +02:00
Krzysztof Chruściński
73d19acce7 debug: cpu_load: Add configurable log level
Add Kconfig for configuring cpu_load log level.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-14 13:06:06 +02:00
Gerhard Jörges
cbfa49f378 fs: shell: fix maybe-uninitialized warning
`read` may have been used uninitialized.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2025-04-14 11:49:28 +02:00
Torsten Rasmussen
db6b126e90 zperf: moving declaration of variable to top of function
Declaration of variables after a label inside a switch statement is a
c23 extension, not c99.

This results in the following warning when compiling with clang:
> .../subsys/net/lib/zperf/zperf_shell.c:912:4: warning: label followed
>                by a declaration is a C23 extension [-Wc23-extensions]
>   912 |                      int seconds = parse_arg(&i, argc, argv);
>       |                         ^
> .../subsys/net/lib/zperf/zperf_shell.c:1145:4: warning: label followed
>                by a declaration is a C23 extension [-Wc23-extensions]
>  1145 |                      int seconds = parse_arg(&i, argc, argv);
>       |                         ^
> 2 warnings generated.

There are no practical reasons why the variable should be declared
inside the switch statement, therefore move the declaration and place it
together with declaration of other variables.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-04-14 09:47:57 +02:00
Lyle Zhu
918b91bc85 Bluetooth: Classic: Shell: HFP: Clear all calls if SLC is broken
If the SLC is broken, all saved calls should be cleared.

Clear all calls in the callback `hf_disconnected()` and
`ag_disconnected()`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-14 09:47:48 +02:00
Lyle Zhu
03ca91fef4 Bluetooth: Classic: HFP_AG: Don't change call status if SLC broken
In current implementation, the active/hold call will be terminated
and notify the upper layer the status change of calls when the SLC
is broken. But the calls should not be terminated in this case.

Do not terminate the calls and only clear the status of all calls.
And disconnect the SCO connection if it is established.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-14 09:47:41 +02:00
Utsav Munendra
d130b68872 portability: cmsis: Fix whitespace in KConfig help
Got messed up in #86599

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-04-12 17:41:34 +02:00
Emil Gydesen
ff9a9fe031 Bluetooth: BAP: Release read_buf_sem in receive_state_updated earlier
The semaphore should be returned before calling the application
callbacks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-11 22:06:44 +02:00
Robert Lubos
ab448a88db net: openthread: Fix ignored return values in OT utils
Do not ignore return values of OT functions registering IPv6 addresses.
As this is called from the net_mgmt callback context, which returns
void, there's not much that can be done, other than logging the error.

To simplify the logging code and avoid the need to use extra buffer,
use net_sprint_ipv6_addr() networking utility function within the log
message to convert binary address to string.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-11 14:53:59 +02:00
Jordan Yates
71a0f39568 pm: device: correct state in pm_device_driver_init
Set the value of `pm->state` as we move through the various stages of
`pm_device_driver_init`. This ensures hat if any of the code inside the
actions callbacks runs `pm_device_state_get` they get the correct state,
instead of always getting `PM_DEVICE_STATE_ACTIVE` (0, the value at
reset).

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-11 14:53:53 +02:00