Without this we can have scenarios where PSA Crypto headers are not
found under certain configurations.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Move the AVRCP cover art initialization from bt_avrcp_init() to
bt_avrcp_tg_register_cb(). This ensures that cover art is initialized
only when the target callback is registered, aligning with the
initialization flow of other AVRCP target features.
Additionally, add a check in bt_avrcp_tg_cover_art_init() to prevent
re-initialization if the PSM is already set, returning success if
cover art is already initialized.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The bt_bap_unicast_client_discover and
bt_bap_broadcast_assistant_discover functions now require security
to have already been done before any operations are done.
The BAP require a specific security level and properties,
and checking the security earlier will prevent any unncessary
operations if the expected security requirement cannot be met.
Additionally, ensuring that there is an appropriate pairing with
the provided connection, ensures that we can rely on CONFIG_BT_MAX_PAIR
for soem arrays in the future.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Newer version of libmctp allocates a buffer to reassembly messages that
has `MCTP_MAX_MESSAGE_SIZE` size. By default, this size is 64Kb, which
may be too big for Zephyr applications.
This patch adds CONFIG_MCTP_MAX_MESSAGE_SIZE - default 1024 - to allow
Zephyr applications to tune the value used by libmctp.
Also update CONFIG_MCTP_HEAP_SIZE to note it needs to be big enough to
hold CONFIG_MCTP_MAX_MESSAGE_SIZE, on top of other allocations.
Assisted-by: GitHubCopilot:claude-sonnet-4.6
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Newer version on libmctp has a different signature for
`mctp_set_alloc_ops`:
mctp_set_alloc_ops(alloc, free, msg_alloc, msg_free)
This patch updates mctp_memory.c to provide the new wrappers for
msg_alloc and msg_free and use new signature for `mctp_set_alloc_ops`.
While at it, remove old usages of `mctp_set_alloc_ops` that existed in
the samples: `mctp_memory.c` should take care of everything.
Finally, libmctp doesn't deallocate packets sent to its RX bus: it's now
for the caller to do so. So this patch also adds the corresponding
`mctp_pktbuf_free` calls.
Assisted-by: GitHubCopilot:claude-sonnet-4.6
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Move the `depends on POLL` Kconfig depenedency to `select POLL`. Mixing
`select` and `depends on` with the same symbol is the primary cause of
Kconfig dependency loops, and every other `POLL` "dependency" uses
`select`.
Signed-off-by: Jordan Yates <jordan@embeint.com>
set iface in data during build. So we don't have to set it later in
the iface init. Due to the fact that we already set the id of the data
structure during build, it is already in the data section of the linker
and not the bss section, so that it doesn't increase the size of the
binary. At the same time we save some code and instructions to set the
iface in the data structure during init.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The cdc_ncm_send() function ignores the return value from
usbd_ep_enqueue(). If the enqueue fails, the code proceeds to block
forever on k_sem_take() waiting for a completion callback that will
never arrive, causing a deadlock.
This was discovered by comparing the CDC-NCM implementation with
CDC-ECM, which correctly checks the return value:
ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
return ret;
}
The NCM driver was missing this error handling, leading to potential
hangs if usbd_ep_enqueue() fails for any reason (e.g., endpoint not
ready, USB disconnected, buffer issues).
Fix by checking the return value and properly cleaning up (freeing
the buffer) before returning the error code to the caller.
Signed-off-by: Jay Beavers <jay@tolttechnologies.com>
Definining the functions counterpart for cabled ethernet to operate on
the list of interfaces and differentiate them from the 802.11 based ones
Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
There are situations where internal DNS resolver will reject the packet,
and in this case, query index is not calculated.
This may break forwarding mechanism;
If DNS packet forwarding is enabled, and internal validation fails, some
checks are done and an attempt to calculate query index is performed, so
the packet can be forwarded and used.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Remove in-tree support for the optional CANopenNode module. This will be
provided as an external module instead, as there are no bindings from
Zephyr towards this module.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Make the qos parameter of the BAP can CAP APIs const,
as they are now only used as one-time parameters, and not stored.
This also means that any uses of this can place the qos
parameter in the stack, rather than static memory.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The pointer represent the qos configuration
for a stream based on the ASE or broadcast configuration,
and serves as a read-only value. Changing it to `const` makes
this more clear.
Some minor changes were done to existing code to help
support this change.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In some cases the stream->qos pointer pointed to the
qos argument, and sometimes it pointed to the ep->qos.
Now all qos arguments are copied to ep->qos, and
stream->qos always points to stream->ep.qos.
Some modules had some refactoring done to properly store
the QoS. The unicast client had some additional checks
done or redone, and some now-unused code removed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove the hardcoded setsockopt(TLS_HOSTNAME, "localhost") which
prevents server-side peer certificate verification from working: the
hostname check compares "localhost" against the client cert's CN/SAN,
which will never match a real client certificate.
Signed-off-by: Steven Friedman <friedman@ionq.co>
Standardize error handling for bt_conn_get_info()
across the Bluetooth shell.
- Use a local 'err' variable instead of inline calls
- Check for (err != 0) consistently
- Include error code in all error messages
- Improve log messages for better debugging context
This ensures consistent behavior and more
informative diagnostics when retrieving connection
information fails.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Use shell_error() instead of shell_print() when
bt_conn_get_info() fails and include the returned
error code in the log.
This makes failures easier to diagnose.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Coverity (CID 525133) reported that the return
value of bt_conn_get_info() was not checked in
disconnected(), which could lead to use of
uninitialized data.
Fix this by validating the return value before
using the connection info structure.
If retrieving the information fails, fall back to
using the generic connection type to preserve the
existing behavior.
This prevents undefined behavior while maintaining
the original logic.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Coverity (CID 333394) reported that the return
value of bt_conn_get_info() was not checked in
remote_info_available(), which could lead to use
of uninitialized data.
Fix this by checking the return value and aborting
early in case of error, ensuring that the
connection info structure is valid before use.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
net_virtual_set_name already makes sure,
that the string ends with 0, therefore
we can directly provide the constant string.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
because these 2 bools are after a uint16_t, that itself is after
a pointer, there should be space for 16 bit, so we can have the
bools regular instead of bit-fields.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
process_stored_dump() uses data_read() without checking the return value.
The function then uses a potentially uninitialized hdr variable.
Check data_read() return value and return the value if negative.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
DTE's can unconditionally emit a `NO CARRIER` event on the DLCI which
indicates that the channel has moved back into the command state. This
functionally means the PPP link is dead, as no more valid data will ever
be received on the channel.
Add the logic to detect this event in `modem_ppp`.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Reset the receive frame state on pipe attach, and re-attach the pipe
before each PPP test to ensure a clean state.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Move subsys/demand_paging/ to subsys/mem_mgmt/demand_paging/ to
better reflect that demand paging is a memory management feature.
Also replacing source with rsource in Kconfig so top location
no longer matters.
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The `max_input` variable gets reduced by 3 bytes to make room for the
size header in the first frame; it does not however get reset to its
previous value in the following frame, which permanently reduces
the frame size by three bytes.
Signed-off-by: Martin Stumpf <finomnis@gmail.com>
`MBEDTLS_SSL_PROTO_DTLS` depends on `MBEDTLS_SSL_PROTO_TLS1_2`, so if
we are selecting the former, we must also select the later.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Cancellation can run on timeout paths where a context-based buffer
allocation timeout can expire immediately.
- allocate the temporary packed-name net_buf with K_FOREVER
- keep existing ENOMEM handling for pool exhaustion
Assisted-by: Codex:gpt-5.3-codex
Signed-off-by: Adam Szewczyk <a.szewczyk@cthings.co>
Treat resolver-side -EAGAIN as a temporary DNS condition and return
DNS_EAI_AGAIN instead of DNS_EAI_SYSTEM so callers can handle retries
consistently.
Assisted-by: Codex:gpt-5.3-Codex
Signed-off-by: Adam Szewczyk <a.szewczyk@cthings.co>
Cancel each timed-out DNS request before retrying and reset the local
semaphore state between attempts. This prevents stale delayed callbacks
from touching stack-backed getaddrinfo state after timeout progression.
Assisted-by: Codex:gpt-5.3-Codex
Signed-off-by: Adam Szewczyk <a.szewczyk@cthings.co>
The scan parameter is in units of 10ms in the Zephyr API, however the same
value was being treated differently for active and passive scanning. For
passive scanning the value got passed to the timeout as 10ms units, however
with active scanning it was treated as seconds by passing it to the
K_SECONDS() macro. Fix this by treating it as 10ms units in both cases.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Convert the scan command parameters to use getopt. While we're at it, get
rid of the confusing "dups" "nodups" options which actually behaved in the
inverse to their names ("nodups" would give you duplicate results while
"dups" would not). The new parameter is called the same as in the Zephyr
API and HCI, namely --filter-dups.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Add support for specifying the exact advertising interval for the
"advertise" shell command. The new support is done with the help of
getopt, and since this is the first user of it in the Bluetooth shell the
appropriate select statement is added in Kconfig.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Add Message Access Profile (MAP) shell command support to the
Bluetooth shell module.
Add map.c to the CMakeLists.txt build configuration when
CONFIG_BT_MAP is enabled, allowing MAP shell commands to be
compiled into the shell module.
Enable MAP configuration options in the Bluetooth shell test
configuration, including both MCE (Messaging Client Equipment)
and MSE (Messaging Server Equipment) functionality.
This enables testing and demonstration of MAP profile features
through the Bluetooth shell interface.
Signed-off-by: Can Wang <can.wang@nxp.com>
Add source files and Kconfig options for Bluetooth Message Access
Profile (MAP) support.
MAP enables remote access to messages stored on a Messaging Server
Equipment (MSE) device from a Messaging Client Equipment (MCE) device.
The profile supports browsing folder hierarchies, listing messages,
retrieving message content, sending messages, and receiving event
notifications.
Add Kconfig options to enable MAP profile with separate options for
MCE and MSE functions.
Add logging configuration for MAP module.
Signed-off-by: Can Wang <can.wang@nxp.com>
Remove casting of the attr->user_data for short vendor value and
instead directly use the defined `vnd_value`.
Use the same defined max length for the long_vnd functions, instead
of the sizeof operator on one of the arrays.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Fix issue with hardware `crc16()` calculation using the hardcoded value of
CRC16_POLY instead of the user's argument.
Signed-off-by: Guy Shilman <shilmanguy@gmail.com>
Add Phone Book Access Profile (PBAP) implementation for Bluetooth Classic,
supporting both Phone Book Client Equipment (PCE) and Phone Book Server
Equipment (PSE) roles.
PBAP enables remote access to phone book data stored on a device,
allowing clients to retrieve contact information, call history, and
other phonebook-related data.
Key features:
- PCE (client) and PSE (server) role support
- RFCOMM and L2CAP transport layer support
- Pull phone book, vCard listing, and vCard entry operations
- Set phone book navigation (up/down/root)
- Abort operation support
- OBEX authentication (challenge-response with MD5)
- Application parameters for filtering and formatting
- SDP service registration and discovery
- Single Response Mode (SRM) support for GOEP v2
- Configurable PSE features (download, browsing, database identifier,
folder version counters, vCard selector, enhanced missed calls, etc.)
- Configurable PSE repositories (local phonebook, SIM, speed dial,
favorites)
The implementation includes:
- Core PBAP protocol handling (subsys/bluetooth/host/classic/pbap.c)
- Public API header (include/zephyr/bluetooth/classic/pbap.h)
- Internal definitions (subsys/bluetooth/host/classic/pbap_internal.h)
- Shell commands for testing and demonstration
(subsys/bluetooth/host/classic/shell/pbap.c)
- Comprehensive shell documentation with usage examples
(doc/connectivity/bluetooth/shell/classic/pbap.rst)
- Kconfig options for feature and repository configuration
- Build system integration (CMakeLists.txt)
- Logging support
Authentication uses PSA Crypto API (MD5) for nonce generation and
response digest calculation.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
Decouple NET_HOSTNAME_MAX_LEN from NET_HOSTNAME_DYNAMIC to resolve
Kconfig conflict when using POSIX networking with unique hostname
updates. This restores functionality that worked in Zephyr 3.6.
- Remove forced selection of NET_HOSTNAME_DYNAMIC from POSIX_NETWORKING
- Make NET_HOSTNAME_MAX_LEN available independently
- Add build assertions for hostname length validation
- Update test configurations for new dependency structure
Fixes: zephyrproject-rtos#95811
Signed-off-by: Pragati Garg <pragatigarg@eaton.com>
Add ZSOCK_QUIC_SO_CERT_CHAIN_DEL socket option that can be used
to delete the CA cert chain from the connection socket.
Add a test to verify that the deletion works as expected.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Change the code so that user does not set intermediate cert chain
directly by ZSOCK_QUIC_SO_CERT_CHAIN_ADD, but the setsockopt() is
given a sec_tag_t type value. Then when building the certificate
message, we resolve the actual cert from certificate storage using
the given security tag value.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>