Commit ef512f2a authored by Joakim Andersson's avatar Joakim Andersson Committed by Anas Nashif
Browse files

Bluetooth: host: Overwrite existing bond when IRK has been updated



Overwrite the existing bond when the IRK of the existing bond could not
resolve the RPA of the peer. This would happen if the peer has deleted
the bond and replaced the IRK that was used.

Signed-off-by: default avatarJoakim Andersson <joakim.andersson@nordicsemi.no>
parent 413eb08d
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3133,6 +3133,18 @@ static u8_t smp_ident_addr_info(struct bt_smp *smp, struct net_buf *buf)
		return BT_SMP_ERR_INVALID_PARAMS;
	}

	if (bt_addr_le_cmp(&conn->le.dst, &req->addr) != 0) {
		struct bt_keys *keys = bt_keys_find_addr(conn->id, &req->addr);

		if (keys) {
			if (!update_keys_check(smp, keys)) {
				return BT_SMP_ERR_UNSPECIFIED;
			}

			bt_keys_clear(keys);
		}
	}

	if (atomic_test_bit(smp->flags, SMP_FLAG_BOND)) {
		const bt_addr_le_t *dst;
		struct bt_keys *keys;