Diff between 06c8b17448b0b35e71c394a33ae84029a21c2700 and 726058e39f7ab7afa7f62489f0a912ff2b658531

Changed Files

File Additions Deletions Status
src/device.c +11 -0 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index fdc2d50..1b4dae6 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)