Bluetooth: host: Optionally disable GATT sec re-establishment
Some centrals deal poorly with receiving a security request immediately after reconnection whenever reconnecting with characteristics that are notifiable or indicatable and requiring security. In particular, Android 9 and earlier devices may lose bond information when this happens, some Microsoft Surface devices will enter an invalid state and, on top of that, Apple's Bluetooth Low Energy guidelines explicitly discourage this behavior. In order to allow interoperability with those devices, make the GATT automatic security request sending as a peripheral optional by introducing a new Kconfig option, BT_GATT_AUTO_SEC_REQ. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
4f0c52c2c5
commit
d9848b155d
2 changed files with 20 additions and 0 deletions
|
@ -4861,6 +4861,8 @@ void bt_gatt_connected(struct bt_conn *conn)
|
|||
* enabling encryption will fail.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_BT_SMP) &&
|
||||
(conn->role == BT_HCI_ROLE_MASTER ||
|
||||
IS_ENABLED(CONFIG_BT_GATT_AUTO_SEC_REQ)) &&
|
||||
bt_conn_get_security(conn) < data.sec) {
|
||||
int err = bt_conn_set_security(conn, data.sec);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue