aboutsummaryrefslogtreecommitdiff
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorGravatar Johan Hedberg <johan.hedberg@intel.com> 2014-02-18 21:41:37 +0200
committerGravatar Marcel Holtmann <marcel@holtmann.org> 2014-02-18 11:48:55 -0800
commit5cedbb8d7aee79a8bbfc8e5b91bc1353ffb0f7b0 (patch)
treea43dc37dab3df907f5af7e4ec7fa53fe45995261 /net/bluetooth/mgmt.c
parentBluetooth: Look up RPA for connection requests with Identity Address (diff)
downloadlinux-5cedbb8d7aee79a8bbfc8e5b91bc1353ffb0f7b0.tar.gz
linux-5cedbb8d7aee79a8bbfc8e5b91bc1353ffb0f7b0.tar.bz2
linux-5cedbb8d7aee79a8bbfc8e5b91bc1353ffb0f7b0.zip
Bluetooth: Use Identity Address in Device Found event
Whenever a device uses an RPA we want to have user space identify it by its Identity Address if we've got an IRK available for it. This patch updates the Device Found mgmt event to contain the Identity Address if an IRK is available for the device in question. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 24a85fe76cd8..747cb9bbc331 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5325,6 +5325,7 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
{
char buf[512];
struct mgmt_ev_device_found *ev = (void *) buf;
+ struct smp_irk *irk;
size_t ev_size;
if (!hci_discovery_active(hdev))
@@ -5336,8 +5337,15 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
memset(buf, 0, sizeof(buf));
- bacpy(&ev->addr.bdaddr, bdaddr);
- ev->addr.type = link_to_bdaddr(link_type, addr_type);
+ irk = hci_get_irk(hdev, bdaddr, addr_type);
+ if (irk) {
+ bacpy(&ev->addr.bdaddr, &irk->bdaddr);
+ ev->addr.type = link_to_bdaddr(link_type, irk->addr_type);
+ } else {
+ bacpy(&ev->addr.bdaddr, bdaddr);
+ ev->addr.type = link_to_bdaddr(link_type, addr_type);
+ }
+
ev->rssi = rssi;
if (cfm_name)
ev->flags |= __constant_cpu_to_le32(MGMT_DEV_FOUND_CONFIRM_NAME);