Commit graph

22128 commits

Author SHA1 Message Date
Kai Cheng
ff2503c002 Bluetooth: SDP: wrap sdp attr item into u16 common func
Wrap sdp attr item into u16 common function, and it would help
to add pnp etc info

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2025-08-18 10:55:19 +02:00
Sean Kyer
a28925af31 net: ocpp: Fix cast warning
Fix warnings generated from casting pointers
of different sizes and string literals in ocpp

Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
2025-08-16 10:20:26 +02:00
Emil Gydesen
04dc211f64 Bluetooth: CAP: Fix bad return from bap_unicast_group_foreach_stream_cb
The function should stop iterating if the callback provided to
bt_cap_unicast_group_foreach_stream returns true.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-16 10:20:18 +02:00
Emil Gydesen
ddfc33a4e5 Bluetooth: BAP: Implement bt_bap_broadcast_source_foreach_stream
Implement the function bt_bap_broadcast_source_foreach_stream that
allows users to iterate on all BAP streams in a BAP broadcast source.
This can be used to easily get reference to other broadcast streams in
the same group as any other stream via the stream->group pointer
or a broadcast source pointer directly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-16 10:20:10 +02:00
Johan Hedberg
30527e5403 Bluetooth: Host: Rename acl_data to bt_conn_rx
We already have bt_conn_tx for outgoing buffer user data, so name the
struct for incoming (rx) buffers similarly. Also, update ISO to use this
struct instead of a custom iso_data struct, since the content and purpose
is identical.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-08-16 10:18:50 +02:00
Håvard Reierstad
fbd7acec25 Bluetooth: Host: Remove deprecated device name API
Removes the BT_LE_ADV_OPT_USE_NAME and BT_LE_ADV_OPT_FORCE_NAME_IN_AD
advertiser options and related flags, macros and functions. The
application now needs to include the device name explicitly.

The API was deprecated in
https://github.com/zephyrproject-rtos/zephyr/pull/71700

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-08-15 15:34:58 +02:00
Vinayak Kariappa Chettimada
72dac165d8 Bluetooth: Controller: Use OVERHEAD_XTAL_US from devicetree
Use the external crystal high frequency clock settling value
from devicetree.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-15 15:34:00 +02:00
Johann Fischer
4bf0381592 usb: device_next: cdc_ncm: disable data interface when disconnected
Disable the data interface when the device is disconnected or when the
CDC-NCM and CDC-ECM instances are disabled for any reason.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-08-15 10:11:16 +03:00
Cristian Bulacu
4f644d8441 net: socket: Fix recvmsg() pktinfo support.
Fix an issue where IPV6_RECVPKTINFO was used instead of IPV6_PKTINFO
when insert_pktinfo was called.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-08-15 10:10:59 +03:00
Cristian Bulacu
6c826efd5a net: context: Add support for setting hop limit from ancillary data
Add support to parse over msghdr and set pkt hop limit, if needed, when
sendmsg() is used.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-08-15 10:10:59 +03:00
Cristian Bulacu
05f8edfebc net: socket: Add support for setting hop limit options
Add IP_RECVTTL or IPV6_RECVHOPLIMIT BSD socket options
that can be used to extract ttl/hop limit from ancillary data
in recvmsg() call.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-08-15 10:10:59 +03:00
Cristian Bulacu
4388cb1438 net: context: Add support for setting receive hop limit option
Add support for setting IPV6_RECVHOPLIMIT or IP_RECVTTL socket option.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-08-15 10:10:59 +03:00
Adrien Lessard
c5229fcda6 pm: device_runtime: fix pm_device_runtime_get rollback
In a call to pm_device_runtime_get, if the power domain is taken but
action_cb fails, the power domain is not released.

Signed-off-by: Adrien Lessard <adrien.lessard@rbr-global.com>
2025-08-14 15:11:13 -04:00
Emil Gydesen
f149118e7c Bluetooth: BAP: Source: Remove LOG_WRN for started/stopped
Removed the LOG_WRN if the started or stopped callback
for streams are not set. The reasoning is that there is also
the group-wide started and stopped callbacks, and an application
may want to use those instead of the per-stream callbacks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 18:04:01 +02:00
Emil Gydesen
cb7965a1a9 Bluetooth: BAP: Sink: Remove LOG_WRN for started/stopped
Removed the LOG_WRN if the started or stopped callback
for streams are not set. The reasoning is that there is also
the group-wide started and stopped callbacks, and an application
may want to use those instead of the per-stream callbacks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 18:04:01 +02:00
Emil Gydesen
e6da768edc Bluetooth: BAP: Add missing ep->iso checks
The bt_bap_unicast_client_ep_qos function attempts to access
ep->iso->chan.iso->iso, but where some of the pointers may be
invalid. Add an additional check for these.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 18:03:41 +02:00
Emil Gydesen
6dffbf88f9 Bluetooth: BAP: Broadcast Source: Fix missing group relations
Adds missing assignments to stream->group and
cleanup of ep->broadcast_source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 18:03:32 +02:00
Emil Gydesen
aac06ba84f Bluetooth: BAP: Broadcast Sink: Fix missing group relations
Adds missing assignments to stream->group and
cleanup of ep->broadcast_sink.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 18:03:32 +02:00
Emil Gydesen
ff7de521c2 Bluetooth: BAP: Fix missing endian conversions for codec_cfgs
Adds a few missing endian conversions when handling codec_cfgs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 18:03:25 +02:00
Pavel Vasilyev
a18811857b bluetooth: host: smp: Update bt_keys addr when receiving identity addr
In addition to aligning the destination address of all connection
objects during the identity resolution phase, we also need to update the
corresponding address field in the `struct bt_keys` structure for each
of these connection objects.

If we don't do this, `bt_keys_get_type` for that connection won't find
the `bt_keys` structure in the pool and will allocate a new one. This
will result in orphaned `bt_keys` structures in the pool.

This completes the change done in https://github.com/zephyrproject-rtos/zephyr/pull/61030/commits/637dabc3c9b018f47dee656d2ca0fe8f2fa21984

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-14 15:49:09 +02:00
Pavel Vasilyev
1a61ba5316 bluetooth: host: Increase BT_MAX_PAIRED to 250
This is done to align with BT_MAX_CONN max value.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-14 15:49:09 +02:00
Pavel Vasilyev
c3edbac5cb bluetooth: host: hci_core: Move event length check to bt_recv_unsafe
The event header is already accessed in `bt_recv_unsafe`. If length is
valid there, no point in checking it again in `hci_event` or
`hci_event_prio`.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-14 15:49:09 +02:00
Pavel Vasilyev
9e5e23d1e9 bluetooth: host: hci_core: prioritize LE Conn Complete event handling
During debugging multiple.sh test, a race condition was observed where
advertiser state on Host and Controler was desynchronized.

Below is the sequence of actions led to this issue:

0. Host has queued few priority events at this moment.
1. Controller establishes a connection and stops the advertiser.
2. Controller sends to Host BT_HCI_EVT_LE_ENH_CONN_COMPLETE.
3. Host deprioritizes BT_HCI_EVT_LE_ENH_CONN_COMPLETE event and doesn't
   process it immediately.
4. Controller sends to Host other priority events which are processed
   immediately.
5. Host wants to disable the advertiser in order to update the Resolving
   List (see `bt_id_add`).
6. Host sends to Controller BT_HCI_OP_LE_SET_ADV_ENABLE(Disable)
   command.
7. Controller sends to Host BT_HCI_EVT_CMD_COMPLETE event on
   BT_HCI_OP_LE_SET_ADV_ENABLE command.
8. Host prioritizes this BT_HCI_EVT_CMD_COMPLETE event, processes it
   immediately and clears `BT_ADV_ENABLED` flag for the advertiser.
   Note that Controller already has the advertiser disabled after
   establishing connection on step 1.
9. Host sends few commands in a row and Controller sends
   BT_HCI_EVT_CMD_COMPLETE events that are prioritized (see
   `bt_id_add`).
10. Host wants to re-enable the advertiser after updating the Resolving
    List.
11. Host sends to Controller BT_HCI_OP_LE_SET_ADV_ENABLE(Enable)
    command.
12. Controller sends to Host BT_HCI_EVT_CMD_COMPLETE event on
    BT_HCI_OP_LE_SET_ADV_ENABLE.
13. Host prioritizes this BT_HCI_EVT_CMD_COMPLETE, processes it
    immediately and sets `BT_ADV_ENABLED` flag for the advertiser.
14. Controller has the advertiser enabled.
15. Host now processes the delayed BT_HCI_EVT_LE_ENH_CONN_COMPLETE
    event.
16. Host resets the advertiser state, thinking the Controller's
    advertiser is also stopped.

This commit prioritizes LE Connection Complete and LE Enhanced
Connection Complete events to drop advertiser state on Host immediately
once the corresponding event was received.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-14 15:49:09 +02:00
Pavel Vasilyev
6f3248b34f bluetooth: host: id: Print identity handle upon collision detection
To improve clarity, print identity handle upon collision detection.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-14 15:49:09 +02:00
Nirav Agrawal
27e4533038 bluetooth: tbs: fix issues for setting URI scheme for GTBS
- "bt_tbs_set_uri_scheme_list()" function does not setting URI for
 GTBS instance. Using "inst_lookup_index()" fixes issue to find
 registered GTBS instance for provided bearer_index.
- "bt_tbs_set_uri_scheme_list()" function overrides URI scheme list
 with latest provided list. But the expectation is that it should
 keep previously added URI schemes and only update new scheme which
 are not part existing list. Code is updated to fix this.
- The same function uses net-buf to combine all URI schems for all
 TBS bearer if current request is not for GTBS instance. Currently,
 the code only uses combined URI scheme list for logging purpose and
 it is not used to send for URI Scheme notification to provide
 updated GTBS URI scheme to remote. Code is now updated to add
 dynamic buffer to add all TBS URI scheme list for GTBS instance
 and notify it similar to other functions to optimise memory usage.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-08-14 15:48:50 +02:00
Emil Gydesen
82a83cd3fc Bluetooth: BAP: BA: Fix sonarcloud issue with assignment and ++
Sonarcloud does not allow to use the result of a incremental
(++) as an assignment.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 15:48:42 +02:00
Emil Gydesen
65550f5ff4 Bluetooth: BAP: BA: Add log and return on invalid UUID
If the chrc->uuid is somehow an invalid UUID, we log it and
terminate the discovery procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 15:48:42 +02:00
Emil Gydesen
ebf206cd08 Bluetooth: TBS: Fix TBS API accessing NULL inst
Some TBS API functions attempted to take the mutex
of an instance before the NULL check.

Reorder the checks of the functions, and also modify function
to be more similar (using the same terms and structure).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 15:48:01 +02:00
Lyle Zhu
0af3fd6faa Bluetooth: Classic: RFCOMM: Remove TX thread from DLC
There are two main issues found with using DLC TX thread,
Issue 1, the RAM consumption. Every DLC will have a dedicated thread
and thread stack.
Issue 2, the thread stack overflow issue. There is no way to strike a
balance between stack size and RAM consumption. Since the deep of call
stack is depended on the upper layer, the thread stack needs to set by
application. Due to the thread stack of DLC is dedicated, RAM
consumption is the product of the added value and the number of DLCs.

Use a TX worker to replace DLC TX thread.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-14 10:40:38 +03:00
Adam Wojasinski
8fb7f8a19d net: lib: ptp: Fix PTP_UDP_IPv6_PROTOCOL compilation error
When the `PTP_UDP_IPv6_PROTOCOL` configuration is enabled
the `mcast_addr` variable is defined as an IPv6 structure, which
doesn't have `s_addr` member.

To not introduce preprocessor guarded code blocks in functions
added union to represent both configurations: IPv4 and IPv6.

Fixes: #92975

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2025-08-14 10:40:16 +03:00
Lyle Zhu
3a46e25582 Bluetooth: Classic: Shell: Add connectionless command set
Add connectionless shell commands, `register`, `unregister`, and
`send`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-14 10:39:54 +03:00
Lyle Zhu
0b3f572d85 Bluetooth: Classic: L2CAP: Add connectionless data reception feature
Add a Kconfig `BT_L2CAP_CONNLESS` to enable the feature.

Add an API `bt_l2cap_br_connless_register()` to register the monitor
to receive the unicast connectionless data.

Add an API `bt_l2cap_br_connless_unregister()` to unregister the
registered callbacks.

Add an API `bt_l2cap_br_connless_send()` to send unicast
connectionless data.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-14 10:39:54 +03:00
WenBin Zhang
d28602adaf tracing: systemview: Add isr name for Segger-sysview
With symtab enabled, the isr name is collected by symbol table

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-08-13 22:12:01 -04:00
Yangbo Lu
0e1b918066 net: dsa: support tag protocol setup
Supported tag protocol setup.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Yangbo Lu
28d0198ef1 net: dsa: add NXP NETC tag protocol driver
Added NXP NETC tag protocol driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Yangbo Lu
560249bcbc net: dsa: move DSA core options to subsystem
Moved DSA core options to subsystem.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Jordan Yates
19134fc53f net: lib: tls_credentials: fix unregistered log module
A logging module named `tls_credentials` was being declared, but no
other source module was creating and registering it. Do the registration
in the file to fix the compiler error.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-08-13 22:08:46 -04:00
Dmitrii Sharshakov
6e2001ba90 Bluetooth: isoal: fix building with verbose logging
Fixes d414cab87a (likely a missed rename)

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-08-13 11:08:48 +01:00
Tomasz Bursztyka
60e5a5622b shell: Improve device list command with an optional filter
It might come in handy to filter the output of a device list
command, by adding a filter (auto-completion enabled as well).

Such as:
$ device list uart
devices:
- uart@2f8 (READY)
  DT node labels: uart1
- uart@3f8 (READY)
  DT node labels: uart0

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
Co-authored-by: Dimitris Karnikis <dika@bang-olufsen.dk>
Co-authored-by: Hans Binderup <habi@bang-olufsen.dk>
2025-08-13 11:08:07 +01:00
Tomasz Bursztyka
1cb1a2777e shell: Add an init command to device module
Optional, this command can be helpful to debug device initialization
process.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-08-13 11:08:07 +01:00
Tomasz Bursztyka
c30cbe39b4 shell: utils: Add non-ready device handling functions
It might come in handy to access non-initialized devices throuhg the
shell. I.e. devices which 'zephyr,deferred-init' DTS attribute was set.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-08-13 11:08:07 +01:00
Tomasz Bursztyka
eb85374e2a shell: Fix device name lookup buffer size
It is actually easy to have device name going beyond 20 characters.
There is a maximum defined internally, better using it.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-08-13 11:08:07 +01:00
Johan Hedberg
381ec33879 Bluetooth: Controlller: Remove deprecated BT_CTLR Kconfig option
This option was deprecated in Zephyr 4.1.0, so it can be removed for Zephyr
4.3.0.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-08-12 18:40:20 -04:00
Jeppe Odgaard
7c796c417e shell: mqtt: add configurable delays
Allow changing delays via Kconfig values.

Use identical delay (`SHELL_MQTT_WORK_DELAY_MS`) for connect, subscribe and
process work instead of varying 1 or 2 second delay.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-12 21:31:35 +02:00
Emil Gydesen
965bcd6312 Bluetooth: CAP: Implement unicast to broadcast handover
Implement the unicast to broadcast handover procedure,
as per the Bluetooth CAP specificiation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-12 12:35:57 +02:00
Muzaffar Ahmed
445e993491 net: l2: wifi: Fix get RTS threshold in Wi-Fi shell
Changed the number of mandatory options of `rts threshold` to 1, so as
to allow no arguments for querying.

Signed-off-by: Muzaffar Ahmed <muzaffar.ahmed@silabs.com>
2025-08-12 12:35:22 +02:00
Jamie McCrae
637082efb0 lorawan: Imply soft-se instead of selecting it
This allows the software secure enclave to be changed to a
different implementation, which currently is not possible

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-08-12 09:56:06 +03:00
Andrey Dodonov
98db4d975c net: lib: http_server: prevent busfault if socket family is AF_UNSPEC
If webserver uses custom socket creation,
and it's family is AF_UNSPEC, net_sprint_addr will return NULL,
which leads to LOG_DBG crashing with busfault.
Add NULL check for that.

Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
2025-08-11 15:57:35 -04:00
Robert Lubos
09cbd286c5 net: connection: Use NET_CONN_*_PORT_SPEC flag when comparing ports
The NET_CONN_LOCAL/REMOTE_PORT_SPEC flags were set on the connection but
not really used. At the same time, when remote address was being
cleared, only the flag was unset, but the actual port number left
intact. This could lead to false port comparisons when remote address
was cleared from the connection context.

In order to avoid that, use the NET_CONN_*_PORT_SPEC flags to determine
whether to compare local/remote ports instead of checking the port value
right away (which may not be valid anymore if the flag is unset).

Also align with MISRA rules when comparing flags in other cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-08-11 13:23:42 -05:00
Robert Lubos
841035a2d6 net: connection: Fix mixed up comments
Local/remote address port comments were mixed up in the flags
documentation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-08-11 13:23:42 -05:00