|
@@ -582,21 +582,14 @@ DEFINE_SIMPLE_ATTRIBUTE(sniff_max_interval_fops, sniff_max_interval_get,
|
|
|
static int identity_show(struct seq_file *f, void *p)
|
|
|
{
|
|
|
struct hci_dev *hdev = f->private;
|
|
|
- bdaddr_t *addr;
|
|
|
+ bdaddr_t addr;
|
|
|
u8 addr_type;
|
|
|
|
|
|
hci_dev_lock(hdev);
|
|
|
|
|
|
- if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dev_flags) ||
|
|
|
- !bacmp(&hdev->bdaddr, BDADDR_ANY)) {
|
|
|
- addr = &hdev->static_addr;
|
|
|
- addr_type = ADDR_LE_DEV_RANDOM;
|
|
|
- } else {
|
|
|
- addr = &hdev->bdaddr;
|
|
|
- addr_type = ADDR_LE_DEV_PUBLIC;
|
|
|
- }
|
|
|
+ hci_copy_identity_address(hdev, &addr, &addr_type);
|
|
|
|
|
|
- seq_printf(f, "%pMR (type %u) %*phN %pMR\n", addr, addr_type,
|
|
|
+ seq_printf(f, "%pMR (type %u) %*phN %pMR\n", &addr, addr_type,
|
|
|
16, hdev->irk, &hdev->rpa);
|
|
|
|
|
|
hci_dev_unlock(hdev);
|
|
@@ -3636,6 +3629,28 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/* Copy the Identity Address of the controller.
|
|
|
+ *
|
|
|
+ * If the controller has a public BD_ADDR, then by default use that one.
|
|
|
+ * If this is a LE only controller without a public address, default to
|
|
|
+ * the static random address.
|
|
|
+ *
|
|
|
+ * For debugging purposes it is possible to force controllers with a
|
|
|
+ * public address to use the static random address instead.
|
|
|
+ */
|
|
|
+void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
|
|
+ u8 *bdaddr_type)
|
|
|
+{
|
|
|
+ if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dev_flags) ||
|
|
|
+ !bacmp(&hdev->bdaddr, BDADDR_ANY)) {
|
|
|
+ bacpy(bdaddr, &hdev->static_addr);
|
|
|
+ *bdaddr_type = ADDR_LE_DEV_RANDOM;
|
|
|
+ } else {
|
|
|
+ bacpy(bdaddr, &hdev->bdaddr);
|
|
|
+ *bdaddr_type = ADDR_LE_DEV_PUBLIC;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/* Alloc HCI device */
|
|
|
struct hci_dev *hci_alloc_dev(void)
|
|
|
{
|