diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-12-19 17:05:35 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-12-20 02:29:49 -0500 |
commit | 50b5b952b7c2bf2c75c257a62a6c456a0bbfdfa3 (patch) | |
tree | b376883509c7dd65755926d6a13f0cff323a8511 /net/bluetooth/hci_request.c | |
parent | cd1c56653a65e5559cf48effe8864ff6df4b4430 (diff) |
Bluetooth: Support static address when BR/EDR has been disabled
Every BR/EDR/LE dual-mode controller requires to have a public address
and so far that has become the identity address and own address. The
only way to change that behavior was with a force_static_address
debugfs option.
However the host can actually disable the BR/EDR part of a dual-mode
controller and turn into a single mode LE controller. In that case
it makes perfect sense for a host to use a chosen static address
instead of the public address.
So if the host disables BR/EDR and configures a static address, then
that static address is used as identity address and own address. If
the host does not configure a static address, then the public address
is used as before.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_request.c')
-rw-r--r-- | net/bluetooth/hci_request.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 5e64ea70a106..324c6418b17c 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c | |||
@@ -378,9 +378,15 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, | |||
378 | * address use the static address as random address (but skip | 378 | * address use the static address as random address (but skip |
379 | * the HCI command if the current random address is already the | 379 | * the HCI command if the current random address is already the |
380 | * static one. | 380 | * static one. |
381 | * | ||
382 | * In case BR/EDR has been disabled on a dual-mode controller | ||
383 | * and a static address has been configured, then use that | ||
384 | * address instead of the public BR/EDR address. | ||
381 | */ | 385 | */ |
382 | if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) || | 386 | if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) || |
383 | !bacmp(&hdev->bdaddr, BDADDR_ANY)) { | 387 | !bacmp(&hdev->bdaddr, BDADDR_ANY) || |
388 | (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) && | ||
389 | bacmp(&hdev->static_addr, BDADDR_ANY))) { | ||
384 | *own_addr_type = ADDR_LE_DEV_RANDOM; | 390 | *own_addr_type = ADDR_LE_DEV_RANDOM; |
385 | if (bacmp(&hdev->static_addr, &hdev->random_addr)) | 391 | if (bacmp(&hdev->static_addr, &hdev->random_addr)) |
386 | hci_req_add(req, HCI_OP_LE_SET_RANDOM_ADDR, 6, | 392 | hci_req_add(req, HCI_OP_LE_SET_RANDOM_ADDR, 6, |