RFU bits has to be ignored according to the spec; In addition,
some MediaTek devices seems to have it set (by mistake I assume),
so having the check means we cannot sync to these devices
Signed-off-by: Troels Nilsson <trnn@demant.com>
This commit adds a warning and a Kconfig option to `bt_conn_le_create`
and `bt_conn_le_create_synced` functions which are meant to warn a user
of a potential leakage of an active connection object.
This change is implemented due to frequent incorrect use of the
connection pointer where a pointer to an existing connection object
is overwritten by `bt_conn_le_create` and `bt_conn_le_create_synced`
functions which in turns leads to sporadic critical bugs. See
https://github.com/zephyrproject-rtos/zephyr/pull/78284#discussion_r1754304535
for more details.
The Kconfig option is introduced instead of always returning the error
to not affect current implementations. However, it is recommended to
keep this option enabled to avoid potential bugs.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds HCI support for:
- LE CS Security Enable
- LE CS Procedure Enable
- LE CS Set Procedure Parameters
- LE CS Set Channel Classification
- LE CS Read Local Supported Capabilities
- LE CS Write Cached Remote Supported Capabilities
- LE CS Write Cached Remote FAE Table
Signed-off-by: Adam Cavender <adam.cavender@nordicsemi.no>
Fix to setup correct short prepare timeout when preempt
callback does not find the prepare in the head of the
pipeline. In this case, find the short prepare and setup
a fresh preempt timeout for the determined short prepare
present in the pipeline.
Relates to commit 7d1bc1789e ("Bluetooth: Controller: Fix
short prepare preempt timeout start").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix delayed ULL scheduling an auxiliary PDU reception by
skipping it. When many bufferred ADV_EXT_IND are to be
processed, the ULL scheduling could get late and then cause
the scan aux LLL to detect increased overhead start timing.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix to reschedule at window start when there are no more
tickers in the list to check for overlap.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove ticks_elapsed use in reschedule_in_window as it has
already been used in the bottom half processing.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
During use of tests/bluetooth/shell application to perform
extended scanning with periodic advertising and broadcast
audio source devices around, it was observed that the
application crashed due to too low BT_RX_STACK_SIZE, hence
increase by 128 bytes.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix implementation of single switch timer minimum compare
value requirement. Do not always add the maximum possible
radio latency duration, but check if the required compare
value is smaller, then use the remainder required as the
extra compare value. This fix reduces latencies to setup
radio receptions and fixes an assertion in lll_scan_aux
when radio_tmr_start_us() is checked for latencies.
Relates to commit bcd28e0a86 ("Bluetooth: Controller:
Fix sw switch single timer for spurious TXEN/RXEN").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Like 2ca179c, check and warn if incoming HCI event parameters exceed
the specification. This helps debugging controllers by detecting the
out-of-spec value that shouldn't appear.
Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
This allows to select if device appearance requires encryption or
authentication or none. This makes it similar to what is implemented
for device name characteristic.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This makes it clear on how security requirements are set and avoid
confusion on how encryption and authentication are handled.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Regardless IO capabilities, clear MITM flag for pairing
initiator if the required security level is less than
BT_SECURITY_L3.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
When Proxy advertising or PB-GATT Advertising Enabled and use a same
advertising sets.
As adv\_start will call multi HCI Command will cause syswork_q yield.
At same time, if another thread(BT RX) all schedule\_send will cause
unable send mesh message, because ADV\_FLAG\_ACTIVE was be set, but
ADV\_FLAG\_PROXY not set currentlly.
Add ADV\_FLAG\_SCHEDULE\_PENDING indicate mesh buf has been pendings
but not scheduled, so when proxy advertising enable, let's take again,
as we can't break or terminated adv\_start, so we must waiting proxy
advertising enabled.
But after https://github.com/zephyrproject-rtos/zephyr/pull/68558
The `k_work_is_pending` always true in `send_pending_adv`, which cause
unable to send more mesh message until more mesh message comming
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Adds HCI support for LE CS subevent result continue
event and the reassembly logic for the partial results.
When subevent results are completed or the subevent is
aborted, the user callback is invoked with a buffer
pointing to the HCI event buffer, so no copy is done.
When subevent results are incomplete, then a reassembly
buffer is allocated from a fixed sized pool. This buffer
is used for the reassembling of the subevent result
containing all of the step data, which is then passed
to the user via the callback. kconfigs have been added
to set the size and the count of the reassembly buffer.
Signed-off-by: Burak Gorduk <burak.gorduk@nordicsemi.no>
Move the CCID header to the include directory
to make it public.
This also compiles the ccid.c file whenver CONFIG_BT_CONN
is enabled, rather than having an additional Kconfig for it,
since the API is now public and may be used by other than
our internal services.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rather than throwing an assert, it will now do a better
check for already-allocated CCIDs and return an error instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
alloc_value is more correct as it does allocate a new
value, rather than just returning/getting a value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This change makes sure that when a call to `bt_id_set_scan_own_addr` is
sucessful, i.e., the return value is 0, the `own_addr_type` will
be set by the `bt_id_set_scan_own_addr`.
Not setting the `own_addr_type` in a successful call to
`bt_id_set_scan_own_addr` causes, for example,
the `start_le_scan_ext` method in `scan.c` to use an
uninitialized `own_addr_type`.
Eventually this results in an unexpected failure further down in
`start_le_scan_ext`, when sending HCI command to controller with
an uninitialized `own_addr_type`.
Signed-off-by: Erik Sandgren <erik.sandgren@nordicsemi.no>
If the Broadcast ID is initially set to 0x000000,
which is valid, comparison logic on add of an
actual Broadcast ID of 0x000000 fails.
Likewise for SID.
Moving INVALID_BROADCAST_ID define to bap.h
Signed-off-by: Lars Knudsen <LAKD@demant.com>
Use a separate workqueue instead of system workqueue for connection TX
notify processing. This makes Bluetooth stack more independent from the
system workqueue.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Notifying users that the supplied timeout is being ignored is worthy of
a higher log level than debug. Any such usage should be changed at the
application level.
Signed-off-by: Jordan Yates <jordan@embeint.com>
In case of UATT, if a connection was lost while user was holding a read
or write attribute callback, `bt_l2cap_send_pdu` (called from
`att.c::chan_send`) will anyway queue a PDU and trigger tx work. The PDU
won't be sent eventually, but neither will hold an error code, which
will allow it to bypass the error check in `att_on_sent_cb` and call
`att_sent` function.
For EATT `bt_l2cap_chan_send` is used which already handles this case
and the error code is passed to `att_on_sent_cb`.
This change adds connection state check to `bt_l2cap_send_pdu`
preventing from unnecessary code execution when connection does not
exist anymore.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The timeout state is local and can block new ATT operations, but does
not affect the remote side. Disconnecting the GATT connection upon ATT
timeout simplifies error handling for developers. This reduces rare
failure conditions to a common one, without needing special cases for
ATT timeouts.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Add scan cb to scan delegator so that Application
can be notified when assistant starts or stops
scanning.
Also state information of Broadcast Assistant
is removed as info is not used.
Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
Fix incorrect elapsed events value when event prepare are
aborted in the pipeline. This caused premature supervision
timeouts.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN such that event is not
aborted when near supervision timeout conditions.
Relates to commit ddf04997a5 ("Bluetooth: Controller: Add
abort fairness in overlapping Periodic Sync").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX Kconfig option
so that disabling this option will use minimum time
reservation and exercise the peripheral ISO connection event
continuation using is_abort_cb mechanism.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX Kconfig option so
that disabling this option will use minimum time reservation
and exercise the peripheral connection event continuation
using is_abort_cb mechanism.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
* Setting the adv data, scan rsp and adv aux ad data can happen on
overlapping buffers
* There can be other memcpy's that need to be changed to memmove but
these are the only ones I could reproduce the issue and since memmove
has a performance penalty, I left the others as is.
Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
Modify the BAP unicast client callback structure to be a
linked list. The purpose of this is to have multiple listeners
of the unicast client changes and notifications.
This is needed for the CAP initiatior.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix of the subnet bridging table function to only
compact the table if elements has been removed, and
fixing the compact function to compact the table if
several elemnts has been removed at the same time.
Fixes zephyrproject-rtos#78794
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
The checks did not properly take into account
that the pref_pd_min and pref_pd_max could have valid
0 values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The host-based adv auto-resume function has both a problematic
implementation and disagreement in the community around how it should
behave. See the issue linked resolved below for details.
This patch makes the deprecation visible to the user. The user will be
better served by a auto-resume tailored their applications use case,
based on more primitive host API like `conn_cb.recycled`, which has
obvious behavior that is unlikely to change.
Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/72567
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Some enums have been renamed:
- NRF_CCM_EVENT_ENDCRYPT -> NRF_CCM_EVENT_END
- NRF_CCM_TASK_CRYPT -> NRF_CCM_TASK_START
Also adjust some TX power level settings (26/28dBm not always available
depending on the SoC revision).
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Fix assertion when enabling simultaneous multiple Extended
Advertising chain reception that is enabled by increasing
supported auxiliary scan contexts.
ULL sets the association of aux context to scan and sync
context, and LLL resets the association; this is safer
compared to earlier implementation where ULL did both the
association and reset which caused aux context memory
leak.
Supported auxiliary scan contexts can be increased using
CONFIG_BT_CTLR_SCAN_AUX_SET value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The `ident` of L2CAP BR connection req will be cleared if
function l2cap_br_conn_req_reply called to send L2CAP BR
connection rsp with result `BT_L2CAP_BR_PENDING`.
Then the invalid `ident` (it is zero) will be filled in
the L2CAP BR connection rsp after the ACL connection is
encrypted.
Recover `ident` if the result of the connection rsp is
`BT_L2CAP_BR_PENDING`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Currently, error code `-ENOTSUP` will be
returned if start security with security
level 4.
For SC supported case, level 4 for ssp
should be supported.
Remove the code limitation to support
security level 4.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The flags of L2CAP_CONFIGURATION_REQ are set.
But in L2CAP_CONFIGURATION_RSP, all bits of
flags are cleared.
When used in the L2CAP_CONFIGURATION_RSP
packet, the continuation flag shall be set
to one if the flag is set to one in the
Request.
Copy flags from Request to Response if it
is a successful result.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>