When the L2CAP channel connection is in none basic mode, the
`seg_recv` cannot work properly if the configuration
`CONFIG_BT_L2CAP_SEG_RECV` is enabled. And the L2CAP channel
connection will be broken incorrectly.
Check whether the received data len exceeds the SDU length if the
`SAR` is `BT_L2CAP_CONTROL_SAR_END` or `BT_L2CAP_CONTROL_SAR_CONTI`.
And check whether the SDU length is valid if the `SAR` is
`BT_L2CAP_CONTROL_SAR_UNSEG` or `BT_L2CAP_CONTROL_SAR_START`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The cap_initiator_broadcast_to_bap_broadcast_param function
did not properly relay the ISO test parameters from the CAP
parameters to the BAP parameters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some in-the-wild devices use SDU interval of 0 when BN == 0; This
is not allowed by BT Core Spec v6.0, but is not specifically
mentioned in v5.4 and earlier. To allow connecting a CIS to these
devices, relax the check on SDU interval
Note: LL/CIS/PER/BI-07-C only checks rejection of invalid SDU interval
with BN > 0, so it still passes with this change
Signed-off-by: Troels Nilsson <trnn@demant.com>
The response L2CAP_COMMAND_REJECT_RSP(BT_L2CAP_REJ_NOT_UNDERSTOOD)
should be replied if the received L2CAP command is a invalid L2CAP
signaling command packets with extra data in the Information Payload.
Send L2CAP_COMMAND_REJECT_RSP(BT_L2CAP_REJ_NOT_UNDERSTOOD) if it a
small L2CAP signaling PDU or it has short length.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The bt_recv() and bt_recv_prio() APIs don't exist anymore, so remove any
references to them from the Kconfig help texts.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The parameter length for this command was missing the additional
length from the arrayed parameters.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
This non-standard feature never had any proper host side implementation
(e.g. it was never upstreamed to BlueZ), and since it comes with notable
maintenance overhead it's fair to just remove it.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Update all HCI drivers to use the new H:4 encoding for buffers passing
to/from drivers.
One behavioral change that's done in favor of simplicity, is that where
there's previously been switch statements that could return an error for
unsupported packet types now simply pass any received packet unchanged to
lower layers of the controller (or the HCI transport). Handling this is
now the responsibility of the lower layers, however in practice hitting
such scenarios means that there's a mismatch between configured host and
controller features.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Encode the packet type as a H:4 payload prefix for buffers passing to &
from HCI drivers. The existing bt_buf_set/get_type functions are
deprecated, but kept compatible with the change, except that they can only
be called once, since they modify the buffer payload.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The TBS spec states that if a value is changed during a
long read procedure, then the server shall reject
read requests with offset != 0 with a specific TBS GATT
error until the value has been read from the beginning again
(i.e. with offset = 0).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for Remote Port Negotiation (RPN) commands in the RFCOMM.
This allows applications to configure the serial port parameters
over RFCOMM connections, such as baud rate, data bits, stop bits, parity
and flow control.
Changes include:
- Add enumerations for RPN parameters (baud rate, data bits, stop bits,
parity)
- Add a public API function bt_rfcomm_send_rpn_cmd() to send RPN
commands
- Add shell command to test RPN with default parameters
This functionality is required by certain Bluetooth profiles that use
RFCOMM and need to configure serial port parameters.
Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
In retransmission mode and flow control mode, the TxWindow size should
be same on both sides.
When one side is updated, also update the other side.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
When creating a broadcast source with
bt_cap_initiator_broadcast_audio_create there was no check if
all broadcast sources were already allocated, which could cause
a NULL pointer dereference.
Add a check, a test and documentation about possibly
error codes of the function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
A bonding issue is found with following conditions,
a. Local is a SSP initiator and it is in non-bondable mode,
b. Peer is in bondable mode,
c. The bonding flag in Authentication_Requirements of local IOCAP is
`No Bonding`,
d. the bonding flag in Authentication_Requirements of peer IOCAP is
`Bonding`.
The bonding information will be exchanged and stored. It is incorrect
behavior.
Fix the issue by reporting a pairing failure and disconnecting the ACL
connection with error `BT_HCI_ERR_AUTH_FAIL`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
The local device shall only set the MITM protection required flag if
the local device itself requires MITM protection.
Only set MITM flag when the required security level is more than 2 and
pairing method is not `JUST_WORKS`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Bluetooth had two public types with similar name _bt_gatt_ccc and
bt_gatt_ccc, but for absolutely different purposes.
That caused misunderstanding of relationship of them and cases
where to use which one.
Commit changes name of _bt_gatt_ccc to more suitable by usage and
improves documentation of it.
Additionally, it changes name of BT_GATT_CCC_INITIALIZER
to correspond the type name.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The start_simple_cs_test and stop_cs_test depends on
CONFIG_BT_CHANNEL_SOUNDING_TEST and could cause build errors if that
is disabled while CONFIG_BT_CHANNEL_SOUNDING=y in the shell.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Update `bt_irk_eq` to use `util_memeq` instead of `memcmp` and the
"disconnect" BabbleSim test to use `util_eq` instead of a first
assertion on the size followed by a `memcmp`.
This is done as an example usage of the two new functions.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
If the SLC is broken, all saved calls should be cleared.
Clear all calls in the callback `hf_disconnected()` and
`ag_disconnected()`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the active/hold call will be terminated
and notify the upper layer the status change of calls when the SLC
is broken. But the calls should not be terminated in this case.
Do not terminate the calls and only clear the status of all calls.
And disconnect the SCO connection if it is established.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Validate that a received LL_CIS_REQ is valid and reject if it is not
Fixes EBQ test failure in LL/CIS/PER/BI-07-C
Signed-off-by: Troels Nilsson <trnn@demant.com>
Add bt_ccp_client_get_bearers that will return the bearers of
a client so that the application can always retrieve them if they
do not store them from the discovery callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Private Node Identity advertisement on a subnet should stop as soon as
the network is removed.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
Fixed the bt_pacs_get_available_context API to return values of type
bt_audio_context instead of an error type.
Signed-off-by: Dereje Wassie <deiw@demant.com>
Rewrote places in the bluetooth code that converts objects
larger than one byte by taking the address of an unaligned struct
member and changed it to a function that takes the value directly
and converts it to big endian.
Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>