aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--net/bluetooth/hci_core.c8
-rw-r--r--net/bluetooth/mgmt.c9
3 files changed, 9 insertions, 10 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 5366dc9e25eb..8ca95e5e3765 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1211,7 +1211,7 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1211void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1211void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1212int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1212int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1213int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1213int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1214void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1214void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key);
1215void mgmt_reenable_advertising(struct hci_dev *hdev); 1215void mgmt_reenable_advertising(struct hci_dev *hdev);
1216void mgmt_smp_complete(struct hci_conn *conn, bool complete); 1216void mgmt_smp_complete(struct hci_conn *conn, bool complete);
1217 1217
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e23c718d668b..60c875267c19 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2768,7 +2768,6 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
2768{ 2768{
2769 struct smp_ltk *key, *old_key; 2769 struct smp_ltk *key, *old_key;
2770 bool master = ltk_type_master(type); 2770 bool master = ltk_type_master(type);
2771 u8 persistent;
2772 2771
2773 old_key = hci_find_ltk_by_addr(hdev, bdaddr, addr_type, master); 2772 old_key = hci_find_ltk_by_addr(hdev, bdaddr, addr_type, master);
2774 if (old_key) 2773 if (old_key)
@@ -2792,13 +2791,8 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
2792 if (!new_key) 2791 if (!new_key)
2793 return key; 2792 return key;
2794 2793
2795 if (addr_type == ADDR_LE_DEV_RANDOM && (bdaddr->b[5] & 0xc0) != 0xc0)
2796 persistent = 0;
2797 else
2798 persistent = 1;
2799
2800 if (type == HCI_SMP_LTK || type == HCI_SMP_LTK_SLAVE) 2794 if (type == HCI_SMP_LTK || type == HCI_SMP_LTK_SLAVE)
2801 mgmt_new_ltk(hdev, key, persistent); 2795 mgmt_new_ltk(hdev, key);
2802 2796
2803 return key; 2797 return key;
2804} 2798}
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 747cb9bbc331..ad51da1b6dc2 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4765,13 +4765,18 @@ void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
4765 mgmt_event(MGMT_EV_NEW_LINK_KEY, hdev, &ev, sizeof(ev), NULL); 4765 mgmt_event(MGMT_EV_NEW_LINK_KEY, hdev, &ev, sizeof(ev), NULL);
4766} 4766}
4767 4767
4768void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent) 4768void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key)
4769{ 4769{
4770 struct mgmt_ev_new_long_term_key ev; 4770 struct mgmt_ev_new_long_term_key ev;
4771 4771
4772 memset(&ev, 0, sizeof(ev)); 4772 memset(&ev, 0, sizeof(ev));
4773 4773
4774 ev.store_hint = persistent; 4774 if (key->bdaddr_type == ADDR_LE_DEV_RANDOM &&
4775 (key->bdaddr.b[5] & 0xc0) != 0xc0)
4776 ev.store_hint = 0x00;
4777 else
4778 ev.store_hint = 0x01;
4779
4775 bacpy(&ev.key.addr.bdaddr, &key->bdaddr); 4780 bacpy(&ev.key.addr.bdaddr, &key->bdaddr);
4776 ev.key.addr.type = link_to_bdaddr(LE_LINK, key->bdaddr_type); 4781 ev.key.addr.type = link_to_bdaddr(LE_LINK, key->bdaddr_type);
4777 ev.key.type = key->authenticated; 4782 ev.key.type = key->authenticated;