`struct acl_data` is used even when Host flow control is not enabled.
It is written to through the `acl(buf)` accessor in `conn.c:hci_acl()`.
Hopefully no netbufs were harmed by that :/
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Add missing documentation for some defintions in tbs.h
Moved some internal definitions to tbs_internal.h
Removed invalid TBS technology BT_TBS_TECHNOLOGY_IP that
doesn't exist.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
It was pointed out in a future PR that they should have
a corresponding experimental Kconfig entry.
See PR #73795.
This updates the APIs added in PR #73826 and PR #74295.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
After configuration, the stream instance is valid and stream's
local_ep valid. bt_a2dp_stream_establish's parameter is stream
too. So in bt_a2dp_stream_establish, stream->local_ep should be
used to tell lower level (AVDTP) the sep.
set_config_param is used by copy-paste mistake.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
If the callbacks are not set, then we cannot do the requested actions
from the broadcast assistant. Since this is a significant issue,
that may prevent the role from working as intended,
LOG_WRN is used other LOG_DBG.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The scan_delegator_security_changed function had a few issues
that were addressed:
1) It used an internal field to check level rather than the
value provided by the API
2) It did not treat bt_addr_le_is_bonded as a boolean return value
3) It did not properly truncate the recv state (fixed by using the
proper function bass_notify_receive_state)
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
BT_TBS_TECHNOLOGY_IP is not a valid technology value
for TBS since it's not defined by the spec.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the `include/zephyr/bluetooth` and `subsys/bluetooth`
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Some of the A2DP interfaces are not defined if the corresponding feature
is not enabled, and therefore shall not be initialized.
This patchs include the interfaces/variables by the configurations to
go through the compiling stage.
Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
When using an encrypted broadcast, the previous value is no
longer enough and caused a stack overflow.
Slightly increased the value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When syncing to a PA using PAST then the sync_info.recv_enabled
was always just set to true, regardless of what mode was set
during the subscribe parameters.
The mode(s) are now stored in an array (with the default value
as well) so that we can retrieve that information when the PA
has synced via PAST.
It was considered to put the `mode` value into the `bt_conn`
struct, but that would require an API change as the `bt_conn`
parameter for the subcribe function uses `const`.
This commit also modifies the guard for PAST to be the more
correct value CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER instead
of just CONFIG_BT_CONN.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The checks for callbacks in bt_ots_init did not correctly take the
ots_init->features.oacp into account for all callbacks, which
caused some issues.
Slightly optimized the check for ots->cb->obj_read by moving the check
and reducing the number of places the code calls oacp_read_proc_cb.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Several log statements were using the regualar LOG_DBG,
but when ISO is actually used, those were called every TX
which at 10ms SDU intervals would fill up the log really fast
and not provided much value outside of some specific debugging.
Modified those logs to use BT_ISO_DATA_DBG which is another
log level for ISO data.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The rationale behind that change is that the Application can use the
`bt_conn_le_param_update()` API to signal the controller to reschedule
the link.
Even if the new connection params are within the old ones, the
controller would be free to choose an e.g. smaller interval. The host
API should not prevent this usage.
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/74292
Co-authored-by: Knut Eldhuset <knut.eldhuset@nordicsemi.no>
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The existing state checks for both the broadcast sink
and broadcast source only ever checked the first BIS.
This sort of made sense, since they are all linked by HCI
(i.e. they share the same state), but there is a race condition
in the ISO and BAP callbacks that could allow applications
to delete sinks and sources before all the ISO callbacks
had been handled.
By treating the sink and source states as the highest value
of the BIS, then we better treat all BIS the same.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This is a bug-fix:
When upper layers want to send something, they add a `conn` object to a
list. They do so by adding a node on `struct conn` rather than the object
itself.
We forgot to increase the reference count of the connection object when
doing so. This means that there can be a scenario where the conn object is
destroyed and re-used while still being on the TX list/queue.
This is bad for obvious reasons.
This patch fixes that by:
- increasing the refcount when putting on the TX list
- decreasing the refcount *only* when popping off the TX list
- passing a new reference from `get_conn_ready` into `bt_conn_tx_processor`
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
If the metadata length is 0 in the mod source operation,
we set the length to 0 and memset the stored value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add validation of the number of ASEs in control point
write requests.
This validates that the number of ASEs
in the control point is not greater than the total number
of ASEs we support.
This also validates that the GATT MTU is large enough to
hold all the responses from the write since those can only be
sent as notifications and never be truncated.
Finally this validates and updates the size of the buffer used to
hold the responses, which may be an optimization for some builds.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The `type` parameter of `struct bt_le_scan_param` is documented as
taking a `BT_LE_SCAN_TYPE_*` value, not a `BT_HCI_LE_SCAN_*` value.
In practice this makes no difference as the values are defined as the
same integer, but does result in `<zephyr/bluetooth/hci.h>` not needing
to be included.
Signed-off-by: Jordan Yates <jordan@embeint.com>
When `buf->len` is 0, the function of the while-loop
will be returned with error code `-ENOTSUP`.
The code block after while-loop cannot be reached
event though it is a correct command.
Use `buf->len` as the end condition of the while-loop.
Fixes#74730.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
`bt_le_ext_adv_start` does not modify the `param` argument, which can
therefore be marked as `const`. This allows the struct to exist purely
in ROM.
Signed-off-by: Jordan Yates <jordan@embeint.com>
If the CIG only contains C to P CISes, then we should allow
setting the P to C interval and latency to 0, and vice versa.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In practice this allocation is very unlikely to fail, however being
consistent with checking for a failure keeps Coverity happy.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the subsys/bluetooth/(common, crypto, service, shell).
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the subsys/bluetooth/mesh directory.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the subsys/bluetooth/host directory.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the subsys/bluetooth/controller directory.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the subsys/bluetooth/audio directory.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit fixes compilation warnings that are present when compiling
with CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY as can be seen in this
compiler log:
"""
In file included from /zephyr-sdk-0.16.1/arm-zephyr-eabi/picolibc/
include/string.h:215,
from /zephyr/subsys/bluetooth/host/smp.c:15:
In function '__memcpy_ichk',
inlined from 'sc_send_public_key' at /zephyr/subsys/bluetooth/host/
smp.c:3006:2:
/zephyr-sdk-0.16.1/arm-zephyr-eabi/picolibc/include/ssp/string.h:83:1:
warning: argument 2 null where non-null expected [-Wnonnull]
83 | __ssp_bos_icheck3_restrict(memcpy, void *, const void *)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr-sdk-0.16.1/arm-zephyr-eabi/picolibc/include/ssp/string.h:83:1:
note: in a call to built-in function '__builtin_memcpy'
/zephyr/subsys/bluetooth/host/smp.c: In function 'smp_public_key':
/zephyr/subsys/bluetooth/host/smp.c:4214:21: warning: argument 2
null where non-null expected [-Wnonnull]
4214 | memcmp(smp->pkey, sc_public_key, BT_PUB_KEY_COORD_LEN) == 0) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/zephyr-sdk-0.16.1/arm-zephyr-eabi/picolibc/include/string.h:62:10: note:
in a call to function 'memcmp' declared 'nonnull'
62 | int memcmp (const void *, const void *, size_t);
| ^~~~~~
"""
The warning is caused by the potential use of NULL "sc_public_key"
global pointer that is not assigned a value in "smp_init()" if
CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY is enabled. This commit
conditionally changes the behavior of function "smp_public_key()"
if CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY is activated to simply return
and not use the "sc_public_key" variable. Other functions that are not
called anymore by "smp_public_key()" are also conditionally
deactivated when CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY is enabled
Signed-off-by: Sebastian Panceac <sebastian.panceac@ext.grandcentrix.net>
Modified to check the length of the remaining data in buffer
before processing the next report. The length check is missing
in the cont routine.
Signed-off-by: Eunkyu Lee <mochaccino.00.00@gmail.com>
Check whether the received frame is complete by
comparing the length of the received data with
the frame data.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Fix Bluetooth initialization problem caused by PR#72090
for at least ST boards that are using BlueNRG BLE modules.
For more information, please refer to issue #74528.
Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>