aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-10-18 16:38:09 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-19 16:28:06 +0300
commit79830f66e3cbd224bcf697b032dce9828b5a3c9e (patch)
tree420c67d76a63acee3b8996d36683325e5fc6cb32 /net/bluetooth/hci_core.c
parentBluetooth: Expose current list of long term keys via debugfs (diff)
downloadlinux-dev-79830f66e3cbd224bcf697b032dce9828b5a3c9e.tar.xz
linux-dev-79830f66e3cbd224bcf697b032dce9828b5a3c9e.zip
Bluetooth: Select the own address type during initial setup phase
The own address type is based on the fact if the controller has a public address or not. This means that this detail can be just configured once during setup phase. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 6b1844f00fbf..c130a239c0de 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1053,8 +1053,19 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
if (hdev->commands[5] & 0x10)
hci_setup_link_policy(req);
- if (lmp_le_capable(hdev))
+ if (lmp_le_capable(hdev)) {
+ /* If the controller has a public BD_ADDR, then by
+ * default use that one. If this is a LE only
+ * controller without one, default to the random
+ * address.
+ */
+ if (bacmp(&hdev->bdaddr, BDADDR_ANY))
+ hdev->own_addr_type = ADDR_LE_DEV_PUBLIC;
+ else
+ hdev->own_addr_type = ADDR_LE_DEV_RANDOM;
+
hci_set_le_support(req);
+ }
/* Read features beyond page 1 if available */
for (p = 2; p < HCI_MAX_PAGES && p <= hdev->max_page; p++) {