Commit graph

21541 commits

Author SHA1 Message Date
Lyle Zhu
76c072549d Bluetooth: Classic: L2CAP: Fix the FCS incorrect issue
The FCS flag of TX direction is not set correctly if the FCS flag of
RX direction is set. The issue could be found with following steps,
Step 1, Local sends configuration request with ERET mode and FCS
omitted.
Step 2, Peer replies the configuration response without any errors.
Step 3, Peer sends configuration request with ERET mode and NO FCS.
Step 4, Local replies the configuration response without any errors.

The FCS flag of TX is cleared incorrectly.

The FCS should be enabled if any one side enables the FCS.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-28 08:36:13 +02:00
Lyle Zhu
b3581fe1d4 Bluetooth: Classic: L2CAP: Handle multi L2CAP packets of a HCI ACL
In current implementation, if the HCI ACL data length exceeds on L2CAP
packet, the HCI ACL data will be discarded.

Support the case if the transport is classic.

Add a function `bt_br_acl_recv()` to handle the multi L2CAP packets
one by one.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-28 08:36:02 +02:00
Jukka Rissanen
aef83fce14 net: if: Allow selecting deprecated IPv6 address as src addr
This adjust the IPv6 source address selection so that it is possible
to select deprecated IPv6 address if no better preferred address is found.

From RFC 6724 chapter 5:

   Rule 3: Avoid deprecated addresses.
   If one of the two source addresses is "preferred" and one of them is
   "deprecated" (in the RFC 4862 sense), then prefer the one that is
   "preferred".

   Rule 8: Use longest matching prefix.
   If CommonPrefixLen(SA, D) > CommonPrefixLen(SB, D), then prefer SA.
   Similarly, if CommonPrefixLen(SB, D) > CommonPrefixLen(SA, D), then
   prefer SB.

So the fix allows deprecated address to be selected if it is a better
match than the preferred one. The reasoning here is that an address with
a longer matching prefix is generally considered topologically closer to
the destination. Using such a source address can lead to more efficient
routing, as it's more likely that the source and destination are within
the same network segment or a closely related one.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-25 19:00:59 +02:00
Guennadi Liakhovetski
1b7eae43db logging: mtrace: don't activate with hook == NULL
adsp_mtrace_log_init() can be called with its argument equal NULL,
mtrace_active shouldn't be set to true in that case.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-04-25 19:00:49 +02:00
Emil Lindqvist
500c67fa18 wifi: fix -Wignored-qualifiers warning
Including wifi.h with -Wignored-qualifiers warning enabled gives
a warning. Fix this warning

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2025-04-25 18:58:25 +02:00
Ibe Van de Veire
c6d98acbbf net: lib: sockets: Increase socketpair mem pool size
Increased the heap mempool size for the socketpairs. This way there will
be enough memory available to allocate 2 * struct spair.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2025-04-25 15:57:25 +02:00
Troels Nilsson
4aad818ec2 Bluetooth: Controller: Fix window widening for parameter update
When applying the connection parameter update, the window widening
for the previous connection interval was not applied since that is
normally done in LLL

Fixed by applying the window widening in ull_conn_update_parameters()
instead in this case

Fixes EBQ test failure in LL/CON/PER/BV-10-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
2025-04-25 15:56:04 +02:00
Jukka Rissanen
feb0265e43 net: if: Stop IPv6 router solicitation if interface goes down
Make sure RS process is stopped if network interface goes down
as there is no point doing it any more.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-25 14:06:00 +02:00
Jukka Rissanen
c73f9d834a net: if: Make sure IPv6 RS timer is not added twice to list
It might happen that if the network interface is going up/down
fast enough, the RS timer could get inserted to the active RS
timer list twice. This would then cause a forever loop in
rs_timeout() when traversing the active list.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-25 14:06:00 +02:00
Fin Maaß
051d257b3c net: config: sntp: don't use fallback, when Kconfig is not set
don't use fallback address, when Kconfig server address
is not set.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-25 14:05:35 +02:00
Fin Maaß
5819e1722b net: config: sntp: add assert, when address is not set.
when the sntp address is not set and geting it via
dhcp is not activated do a build assert.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-25 14:05:35 +02:00
Fin Maaß
71aa1b1bec net: config: sntp: add option for failure try interval
add option for a different resync interval, that is
applied when the sntp request fails.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-25 14:05:35 +02:00
Aleksandr Khromykh
855639a3db bluetooth: mesh: keep scanner enabled if lpn has been disabled
Commit fixes the issue when scanner is disabled when
lpn is disabled.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-04-25 14:05:27 +02:00
Nithin Ramesh Myliattil
a94cdafdb7 Bluetooth: CSIP: Fix ntf issue to clients on reboot
On reboot, client list to notify is not updated properly.
Fix is to check and add the reconnected clients on
security changed cb.

Subscription check is added before notify to clients.
BT Enable check is added in the register function before adding
bonded devices to client list.

Also typo is corrected in add_bonded_addr_to_client_list in the
second loop.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2025-04-25 14:04:37 +02:00
Jens Rehhoff Thomsen
73000a6154 Bluetooth: host: Ensure BASS notifications are sent
Update bit array (number of connections) added for each receive state.
Notifications are attempted to be sent in the system workqueue and
retried if failing.

Issue #85487

Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
2025-04-25 14:04:12 +02:00
Jukka Rissanen
3e09a40de5 net: zperf: Add -w option to delay upload jobs
Use -w option to delay the startup of the upload job.
Then when ready, do "zperf jobs start" to launch all upload
sessions at the same time.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-25 10:22:33 +01:00
Jukka Rissanen
563f05eb8b net: zperf: Add concurrency when doing upload tests
If user has enabled CONFIG_ZPERF_SESSION_PER_THREAD, then if
user gives -a (async) option to upload command, then multiple
uploads can be run simultaneously. Each upload will be run
in a dedicated work queue. The work queue thread priority can
be set by -t option.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-25 10:22:33 +01:00
Jordan Yates
1c2fc02cf2 net: ip: net_if: consistent interface id logging
Update logging to consistently refer to interfaces by their ID, instead
of a mix of IDs and pointers.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-24 22:58:51 +02:00
Jordan Yates
3772c719e0 net: l2: ethernet: ethernet_ll_prepare_on_ipv4 handling
Shift the error handling for `ethernet_ll_prepare_on_ipv4` out into
`ethernet_send`, since that is the function that needs to handle the
various result types of the ARP process.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-24 22:58:51 +02:00
Jordan Yates
029f542bb4 net: l2: ethernet: arp: unref pkt if queue add fails
Make it clearer that the `net_buf_ref` is for `k_queue_unique_append`,
and reverse the reference if the queue add fails.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-24 22:58:51 +02:00
Jordan Yates
d283130b68 net: l2: ethernet: arp: explicit error codes
Update `net_arp_prepare` to return a return code instead of a pointer,
so that the various results of the function can be differentiated.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-24 22:58:51 +02:00
Jordan Yates
4e0386a445 net: ip: net_if: warning message on send failure
Print a warning if sending a packet on the L2 interface fails. Currently
this is completely silent unless `NET_DBG` is enabled and the `context`
parameter is provided.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-24 22:58:51 +02:00
Seppo Takalo
78ee0f0c23 net: lwm2m: Do not enforce canonical CBOR decoding
Our decoder can handle decoding of non-deterministic CBOR just fine.
There is no need to block valid CBOR if the server does not produce
length-first deterministic CBOR.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-04-24 22:58:24 +02:00
Jukka Rissanen
0e5df7a67b net: vlan: Avoid printf modifier issue with size_t variable
Change the printf modifier to %zd for size_t variable printout
to avoid compiler warning.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-24 20:27:58 +02:00
Nicolas Goualard
27bfeea162 mcumgr: fs_mgmt: Add a hook on download/upload complete.
Added a hook on the FS group that notify applications when a
 file download/upload has completed.

Signed-off-by: Nicolas Goualard <nicolas.goualard@sfr.fr>
2025-04-24 16:53:35 +02:00
Max Emde
e04d828219 Bluetooth: BAP: Update encrypt_state when BIG synced after bad code
- When encrypt_state in a receive state of the scan delegator is
  BT_BAP_BIG_ENC_STATE_BAD_CODE, make sure that on synchronization
  encrypt_state is updated to BT_BAP_BIG_ENC_STATE_DEC, as this
  implies that a correct code was provided, so that the broadcast
  assistant is not asked for a correct code any longer.

Signed-off-by: Max Emde <mxem@demant.com>
2025-04-24 11:57:25 +02:00
Emil Gydesen
c8742a3cec Bluetooth: Mesh: Add missing includes to va.h
The va.h file used both uintX and bool without including
the appropriate header files, which can cause a compile issue
if the file is included in the wrong order.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-24 10:39:21 +02:00
Fengming Ye
23494b7b68 net: sockets: kconfig: change hostap default socket pair add heap size
Reduce default socket pair add heap size in hostap case.
Reduce 1 socket pair in wpa_supplicant case.
Reduce 2 socket pairs in wpa_supplicant and hostapd coex case.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2025-04-24 10:38:03 +02:00
Yangbo Lu
f0b1cb578f net: dsa: introduce new DSA framework
The new DSA framework purpose and changes are as below.

- Aligned to Linux DSA framework which has been already mature framework
  for many years, For now in zephyr, the DSA components were splited
  as: switch, port, master(not need driver file for now), slave, and tag.
  Seperated drivers were used for maintaining and developing new
  features.

- The unified dts bindings (aligned to linux) were supported. The port
  driver would parse DTS to decide the port type (master port, slave
  port, or cpu port) to set up the switch. All the ports registered as
  standard ethernet devices. (dsa port and dsa switch tree was not
  supported.)

- How to add DSA device driver based on the framework? All the device
  driver needing to do is providing dsa_spi implementation and private
  data, and calling below initialization.

    DSA_INIT_INSTANCE(n, _dapi, data)

- For switch tag case, recv/xmit helpers in dsa_api could be used for
  taging/untagging. No modified ethernet drivers.
  For no-tag type case, ethernet driver of master port should support
  packet injection/extraction for slave ports leaving NULL recv/xmit.

The dsa_nxp_imx_netc.c driver will be the first example of the new DSA
framework.

The future work for DSA will be supporting bridge for ports. We may align
Linux to give users two options to use DSA device:

- Standalone mode: the switch ports work as regular ethernet ports.

- Bridge mode: switch mode with virtual bridge device which could be
  assigned IP address.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-04-24 01:26:46 +02:00
Yangbo Lu
b22db75cec include: ethernet: rename dsa master/slave to conduit/user
Renamed dsa master/slave to conduit/user for capabilities.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-04-24 01:26:46 +02:00
Yangbo Lu
018a718e12 net: dsa: make current DSA core driver obsolete
Current DSA TX/RX way was hard-coded in ethernet devices driver
with ETH_DSA_SUPPORT and NET_DSA.
This patch is to make such way obsolete, as we actually will support
a better DSA framework to handle this in NET/DSA core driver.
To make legacy devices not affected, below options are used instead.

- ETH_DSA_SUPPORT_DEPRECATED
- NET_DSA_DEPRECATED

Once the legacy devices are converted to new DSA framework, this code
could be removed.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-04-24 01:26:46 +02:00
Haiyue Wang
9c9c080b68 pmci: mctp: Fix No SOURCES CMake warning
The commit 1e0af58b51 ("pmci: Move MCTP into the PMCI subsys") changes
'mctp' directory adding to unconditionally, which will cause:

CMake Warning at ./zephyrproject/zephyr/CMakeLists.txt:1022 (message):
  No SOURCES given to Zephyr library: subsys__pmci__mctp

  Excluding target from build.

Signed-off-by: Haiyue Wang <haiyuewa@163.com>
2025-04-23 17:55:19 +02:00
Arkadiusz Balys
66e78e05d3 openthread: Separate OpenThread Kconfigs from L2 layer
Moved OpenThread-related Kconfigs from L2 layer to
modules/openthread. All of those configs were not strictly related
to the L2 layer, so they fits better to OpenThread module.
This operation allows using OpenThread Kconfigs even if L2 layer is
disabled.

Enabling NET_L2_OPENTHREAD also configures those configs by
selecting the OPENTHREAD kconfig, so there is no change regarding
backwards compatibility. The only change is that the Kconfigs
related to Thread were moved to the modules space, so their
location in the menuconfig also changed.

Once it is done, a choice for setting different L2 implementations
seems to be redundant.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2025-04-23 17:54:58 +02:00
Fin Maaß
89ad446b27 mgmt: hawkbit: deprecate HAWKBIT_DDI_NO_SECURITY
anonymous/no authentication mode had been removed
from the last hawkBit server release, so mention it and
deprecate the option.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-23 15:00:05 +02:00
Fin Maaß
1db528fc45 mgmt: hawkbit: add more infos for authentication modes
add more infos for security token authentication modes

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-23 15:00:05 +02:00
Jordan Yates
00c68722d9 net: lib: zperf: TCP uploader: populate total_len
Populate the `total_len` field of the output results.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-23 11:48:42 +02:00
Jordan Yates
6ce51997e7 net: lib: zperf: conditional UDP/TCP compilation
Only compile in the UDP/TCP variants of the zperf functions if the
underlying support is present.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-23 11:48:42 +02:00
Jordan Yates
82d767585d net: lib: zperf: optional server support
Make the zperf server support optional, if only upload throughput
testing is required. This reduces the resources required to operate.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-23 11:48:42 +02:00
Jordan Yates
05d577993f net: lib: zperf: update descriptions
`NET_ZPERF` enables the core zperf utility library, not a shell module.
Add more specifics about what the utility can communicate with.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-23 11:48:42 +02:00
Robert Lubos
379e71def3 net: connection: Cleanup packet input processing
Part of the socket matching criteria for AF_PACKET family took place
inside conn_raw_socket() function, and some of it was redundant with
what already was checked in net_conn_packet_input(). Moreover, if the
packet cloning for packet socket failed for whatever reason, the packet
was reported as NET_DROP, which was confusing.
Finally, conn_raw_socket() updated network stats, which didn't really
work as net stats are only collected for UDP/TCP protocols and not for
L2 level protocols.

Therefore, cleanup the processing by:
  * Moving all socket matching criteria into net_conn_packet_input()
    for clarity,
  * Drop unneeded net stats functions,
  * Clarify NET_DROP strategy for packet socket input.
    net_conn_packet_input() should only be responsible for delivering
    packets to respective packet sockets, it should not decide whether
    to drop the packet or not - it's L2/L3 processing code
    responsibility. Therefore, assume this function forwards packet for
    further processing by default, and only allow small optimization to
    return NET_OK if the packet socket was really the only endpoint in
    the system.
  * And finally, since now conn_raw_socket() responsibility was to clone
    the packet for the respective socket, and was almost identical to a
    corresponding function for raw IP sockets, unify the two functions.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-23 11:48:33 +02:00
Robert Lubos
32f3ce396f net: connection: Split net_conn_input()
The current implementation of net_conn_input() can accept different
packet types, with completely different processing code, resulting in a
function which is pretty bloated, sliced with conditionally enabled code
and hard to understand and therefore maintain.

This commit splits that function into smaller ones, specialized for
different packet types (and entry levels). The following functions have
been extracted from the original one:
  - net_conn_packet_input() for early packet processing (covering
    AF_PACKET family sockets)
  - net_conn_raw_ip_input() for raw IP packets processing (covering
    AF_INET(6)/SOCK_RAW sockets)
  - net_conn_can_input() for CAN packets processing (covering AF_CAN
    family sockets)

The net_conn_input() function stripped from above cases now only takes
care of packets that have been processed by respective L4 and are
intended for regular TCP/UDP sockets.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-23 11:48:33 +02:00
Robert Lubos
edba291799 net: core: Pass the actual LL proto for DGRAM packet sockets
After L2 processing, the LL protocol type is already known and should be
set accordingly on the packet. Therefore it can be passed to the
net_packet_socket_input() function to allow proper socket filtering
based on protocol.

Additionally, as LL protocol type is 16 bit value, fix the proto
parameter type in net_packet_socket_input().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-23 11:48:33 +02:00
Mark Wang
5c4dece721 bluetooth: classic: smp: fix the wrong Responder Key Distribution
BR_SEND_KEYS_SC should be used to determine the value of
Responder Key Distribution when sending pairing_response to
reply smp br pairing_request.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-04-23 10:04:23 +02:00
Christoph Winklhofer
501f33edea arch: Unify declaration of text region
The declaration for the text region '__text_region_start' and
'__text_region_end' should be consistent with the declaration in the
include file 'zephyr/linker/linker-defs.h'.

The local declarations are:
  extern uintptr_t __text_region_start, __text_region_end;
whereas 'linker_defs.h' declares them as:
  extern char __text_region_start[];
  extern char __text_region_end[];

This may result in conflicting types when 'linker_defs.h' is indirectly
included. Hence, remove the local declarations.

Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-23 02:15:25 +02:00
Christoph Winklhofer
8c7aded4c1 logging: Assign module data to memory partition 'k_log_partition'
The logging module data is assigned to the memory partition
'k_log_partition' so that a user mode thread can access this data (see
k_mem_domain_add_thread()). The 'k_log_partition' is created when:
- CONFIG_USERSPACE=y
- CONFIG_LOG_ALWAYS_RUNTIME=y

The option CONFIG_NO_OPTIMIZATIONS=y forces the logging module to use
the runtime message creation CONFIG_LOG_ALWAYS_RUNTIME=y. This raises a
MPU violation when logging is used in a user mode thread since this
thread is not allowed to access the module data (e.g. __log_level,
__log_current_const_data).

Note that the user mode thread may also require access to the partition
'z_libc_partition'.

Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-23 02:15:25 +02:00
Christoph Winklhofer
77925656ab logging: Fix runtime message creation in user-mode thread
The runtime message creation (CONFIG_LOG_ALWAYS_RUNTIME=y) in a user-
mode thread raises a MPU violation, e.g. call LOG_INF("Test") in a
user-mode thread.

The function 'z_log_msg_runtime_vcreate' runs in user mode but works
with Kernel data. Hence, create the cbprintf package on the stack (of
the user mode thread) and pass it further to the syscall
'z_log_msg_static_create'.

Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-23 02:15:25 +02:00
Johann Fischer
52db58defa usb: device: remove loopback function in favor of new device stack
This function is used for testing purposes only, there is no real use
for it in a user application. Remove in favor of implementation in new
device stack.
Also remove the part of the documentation that depends on loopback.
Documentation on how to implement your own USB device function using the
new USB device support will follow during the documentation rework.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-04-23 02:15:10 +02:00
Emil Gydesen
11c3ee12a8 Bluetooth: BAP: Sink: Move mod_src_param to RAM
The mod_src_param was several places stored on the stack.
However this is a complex paramater struct that has
2 Kconfig options that can significantly increase the size,
and the maximum size of the parameter is nearly 8 KiB, and
was always place the in the BT RX thread's stack.

For this reason, the param is now stored in a single
static variable in RAM instead, so that the BT RX thread's stack
does not need to be increased based on the Kconfig options,
as that is quite difficult for users to be aware of.

The add_src_param has been left as is, as that stored in
the calling thread, and it is easier for an application
to determine if the calling thread needs additional stack
space.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-22 16:53:58 +02:00
Gudipudi Ramana Kumar
aafcd4f851 bluetooth: audio: Update bad code in BASS to be v1.0.1 compliant
Bad Broadcast Code in BASS/Scan Delegator if BIG_Encryption
field value = 0x03 (Bad_Code), Bad_Code shall be set to the
value 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF according to BASS v1.0.1

Signed-off-by: Gudipudi Ramana Kumar <gudipudiramanakumar@gmail.com>
2025-04-22 16:53:49 +02:00
Make Shi
d879e8482f Bluetooth: Classic: L2CAP: Set the BR chan identifier for PENDING Case
When the connection status is "PENDING", need reset the br channel
identifier to the correct value before resend the connection response,
otherwise these is in an "ident mismatch" error being reported.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-04-22 10:00:08 +02:00