summaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-11-01 17:08:15 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-11-01 21:37:24 -0700
commit726058e39f7ab7afa7f62489f0a912ff2b658531 (patch)
tree8e3411e35580acedd9cd9340ed5541a438790b73 /src/device.c
parent06c8b17448b0b35e71c394a33ae84029a21c2700 (diff)
downloadbluez-726058e39f7ab7afa7f62489f0a912ff2b658531.tar.gz
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.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c11
1 files changed, 11 insertions, 0 deletions
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)