From 5df9521ce4d50ffa48153503bc5156c11e6ed26b Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 26 Mar 2025 11:52:07 -0400 Subject: [PATCH] device: Elevate bt_att security if bonding is in progress When bonding is in progress it means Device.Pair has been called thus the user indicated the intend to pair/bond from the start so the security of bt_att shall be set in order for it to wait until pairing process complete before attempting to proceed with GATT discovery and any other traffic. Fixes: https://github.com/bluez/bluez/issues/1125 --- src/device.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/device.c b/src/device.c index 034491b59..057d116be 100644 --- a/src/device.c +++ b/src/device.c @@ -5797,6 +5797,11 @@ static void gatt_client_init(struct btd_device *device) if (btd_opts.gatt_channels > 1) features |= BT_GATT_CHRC_CLI_FEAT_EATT; + if (device->bonding) { + DBG("Elevating security level since bonding is in progress"); + bt_att_set_security(device->att, BT_ATT_SECURITY_MEDIUM); + } + device->client = bt_gatt_client_new(device->db, device->att, device->att_mtu, features); if (!device->client) { -- 2.47.3