diff mbox series

[BlueZ,v2,5/5] device: Elevate bt_att security if bonding is in progress

Message ID 20250326193133.2718934-5-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v2,1/5] device: Attempt to elevate security on Pair while connected | expand

Commit Message

Luiz Augusto von Dentz March 26, 2025, 7:31 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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 mbox series

Patch

diff --git a/src/device.c b/src/device.c
index 034491b59d30..057d116be6fc 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) {