From: Luiz Augusto von Dentz Date: Tue, 2 Nov 2021 00:08:15 +0000 (-0700) Subject: device: Fix not updating the auto-connect/accept list X-Git-Tag: submit/tizen/20220313.220938~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a11a006078e506e30390422ee1e548a55aebb208;p=platform%2Fupstream%2Fbluez.git 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. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- diff --git a/src/device.c b/src/device.c index e99824aa..bb267243 100644 --- a/src/device.c +++ b/src/device.c @@ -6968,6 +6968,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; @@ -6977,6 +6979,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; @@ -6986,6 +6994,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)