From 726058e39f7ab7afa7f62489f0a912ff2b658531 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 1 Nov 2021 17:08:15 -0700 Subject: [PATCH] device: Fix not updating the auto-connect/accept list When receiving a new IRK the device address is updated but the old address is not removed from the auto-connect/accept list. --- src/device.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/device.c b/src/device.c index fdc2d50a4..1b4dae685 100644 --- a/src/device.c +++ b/src/device.c @@ -4381,6 +4381,8 @@ void device_set_class(struct btd_device *device, uint32_t class) void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr, uint8_t bdaddr_type) { + bool auto_connect = device->auto_connect; + if (!bacmp(bdaddr, &device->bdaddr) && bdaddr_type == device->bdaddr_type) return; @@ -4390,6 +4392,12 @@ void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr, */ device->le = true; + /* Remove old address from accept/auto-connect list since its address + * will be changed. + */ + if (auto_connect) + device_set_auto_connect(device, FALSE); + bacpy(&device->bdaddr, bdaddr); device->bdaddr_type = bdaddr_type; @@ -4399,6 +4407,9 @@ void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr, DEVICE_INTERFACE, "Address"); g_dbus_emit_property_changed(dbus_conn, device->path, DEVICE_INTERFACE, "AddressType"); + + if (auto_connect) + device_set_auto_connect(device, TRUE); } void device_set_bredr_support(struct btd_device *device) -- 2.47.3