diff options
-rw-r--r-- | net/bluetooth/hci_core.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8710d1febee7..6b1844f00fbf 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -385,6 +385,36 @@ static const struct file_operations static_address_fops = { | |||
385 | .release = single_release, | 385 | .release = single_release, |
386 | }; | 386 | }; |
387 | 387 | ||
388 | static int long_term_keys_show(struct seq_file *f, void *ptr) | ||
389 | { | ||
390 | struct hci_dev *hdev = f->private; | ||
391 | struct list_head *p, *n; | ||
392 | |||
393 | hci_dev_lock(hdev); | ||
394 | list_for_each_safe(p, n, &hdev->link_keys) { | ||
395 | struct smp_ltk *ltk = list_entry(p, struct smp_ltk, list); | ||
396 | seq_printf(f, "%pMR (type %u) %u %u %u %.4x %*phN %*phN\\n", | ||
397 | <k->bdaddr, ltk->bdaddr_type, ltk->authenticated, | ||
398 | ltk->type, ltk->enc_size, __le16_to_cpu(ltk->ediv), | ||
399 | 8, ltk->rand, 16, ltk->val); | ||
400 | } | ||
401 | hci_dev_unlock(hdev); | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | static int long_term_keys_open(struct inode *inode, struct file *file) | ||
407 | { | ||
408 | return single_open(file, long_term_keys_show, inode->i_private); | ||
409 | } | ||
410 | |||
411 | static const struct file_operations long_term_keys_fops = { | ||
412 | .open = long_term_keys_open, | ||
413 | .read = seq_read, | ||
414 | .llseek = seq_lseek, | ||
415 | .release = single_release, | ||
416 | }; | ||
417 | |||
388 | /* ---- HCI requests ---- */ | 418 | /* ---- HCI requests ---- */ |
389 | 419 | ||
390 | static void hci_req_sync_complete(struct hci_dev *hdev, u8 result) | 420 | static void hci_req_sync_complete(struct hci_dev *hdev, u8 result) |
@@ -1121,6 +1151,8 @@ static int __hci_init(struct hci_dev *hdev) | |||
1121 | &hdev->le_white_list_size); | 1151 | &hdev->le_white_list_size); |
1122 | debugfs_create_file("static_address", 0444, hdev->debugfs, | 1152 | debugfs_create_file("static_address", 0444, hdev->debugfs, |
1123 | hdev, &static_address_fops); | 1153 | hdev, &static_address_fops); |
1154 | debugfs_create_file("long_term_keys", 0400, hdev->debugfs, | ||
1155 | hdev, &long_term_keys_fops); | ||
1124 | } | 1156 | } |
1125 | 1157 | ||
1126 | return 0; | 1158 | return 0; |