From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v3 01/13] Bluetooth: Ensure hci_conn always contains the local identity address
Date: Sun, 23 Feb 2014 19:42:17 +0200 [thread overview]
Message-ID: <1393177349-361-1-git-send-email-johan.hedberg@gmail.com> (raw)
From: Johan Hedberg <johan.hedberg@intel.com>
To be consistent with the remote address info in hci_conn we want it to
also contain the local identity address information. This patch updates
the code to use the hci_copy_identity_address function to copy the right
values in place whenever an LE connection has been established.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/hci_event.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4327b129d38e..84a475ac2e7f 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3625,6 +3625,26 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
}
}
+ /* Ensure that the hci_conn contains the identity address type
+ * regardless of which address the connection was made with.
+ *
+ * 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 random address.
+ *
+ * For debugging purposes it is possible to force
+ * controllers with a public address to use the
+ * random address instead.
+ */
+ if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dev_flags) ||
+ !bacmp(&hdev->bdaddr, BDADDR_ANY)) {
+ bacpy(&conn->src, &hdev->static_addr);
+ conn->src_type = ADDR_LE_DEV_RANDOM;
+ } else {
+ bacpy(&conn->src, &hdev->bdaddr);
+ conn->src_type = ADDR_LE_DEV_PUBLIC;
+ }
+
/* Lookup the identity address from the stored connection
* address and address type.
*
--
1.8.5.3
next reply other threads:[~2014-02-23 17:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-23 17:42 johan.hedberg [this message]
2014-02-23 17:42 ` [PATCH v3 02/13] Bluetooth: Set the correct values for Identity Address Information johan.hedberg
2014-02-23 17:42 ` [PATCH v3 03/13] Bluetooth: Add SMP function for generating RPAs johan.hedberg
2014-02-23 17:42 ` [PATCH v3 04/13] Bluetooth: Add timer for regenerating local RPA johan.hedberg
2014-02-23 17:42 ` [PATCH v3 05/13] Bluetooth: Add hci_update_random_address() convenience function johan.hedberg
2014-02-23 17:42 ` [PATCH v3 06/13] Bluetooth: Use hci_update_random_address() when connecting LE johan.hedberg
2014-02-23 17:42 ` [PATCH v3 07/13] Bluetooth: Use hci_update_random_address() for enabling advertising johan.hedberg
2014-02-23 17:42 ` [PATCH v3 08/13] Bluetooth: Use hci_update_random_address() for initiating LE scan johan.hedberg
2014-02-23 17:42 ` [PATCH v3 09/13] Bluetooth: Don't write static address during power on johan.hedberg
2014-02-23 17:42 ` [PATCH v3 10/13] Bluetooth: Add debugfs entry for RPA regeneration timeout johan.hedberg
2014-02-23 17:42 ` [PATCH v3 11/13] Bluetooth: Add support for Set Privacy command johan.hedberg
2014-02-23 17:42 ` [PATCH v3 12/13] Bluetooth: Fix setting correct src_type when connecting LE johan.hedberg
2014-02-23 17:42 ` [PATCH v3 13/13] Bluetooth: Remove unneeded hdev->own_addr_type johan.hedberg
2014-02-23 20:07 ` [PATCH v4] Bluetooth: Ensure hci_conn always contains the local identity address johan.hedberg
2014-02-23 20:44 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393177349-361-1-git-send-email-johan.hedberg@gmail.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox