summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-08 08:07:49 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-08 08:22:06 -0400
commit5ce194c4a751ac603966dd1567b62035a7dfbf89 (patch)
tree7ca6fbba2ac830ebfaba75d48f8d3247b0b963b7 /net
parentc93bd15033027928709ee15bab2ce1f5582085c6 (diff)
Bluetooth: Use real advertising state to random address update decision
Now that we have a flag for tracking the real advertising state we should use that to determine whether it's safe to update the random address or not. The couple of places that were clearing the flag due to a pending request need to be updated too. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_conn.c4
-rw-r--r--net/bluetooth/hci_core.c2
-rw-r--r--net/bluetooth/mgmt.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 16fd55da9c1d..0db2579ea6c6 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -671,12 +671,12 @@ static void hci_req_directed_advertising(struct hci_request *req,
671 enable = 0x00; 671 enable = 0x00;
672 hci_req_add(req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), &enable); 672 hci_req_add(req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), &enable);
673 673
674 /* Clear the HCI_ADVERTISING bit temporarily so that the 674 /* Clear the HCI_LE_ADV bit temporarily so that the
675 * hci_update_random_address knows that it's safe to go ahead 675 * hci_update_random_address knows that it's safe to go ahead
676 * and write a new random address. The flag will be set back on 676 * and write a new random address. The flag will be set back on
677 * as soon as the SET_ADV_ENABLE HCI command completes. 677 * as soon as the SET_ADV_ENABLE HCI command completes.
678 */ 678 */
679 clear_bit(HCI_ADVERTISING, &hdev->dev_flags); 679 clear_bit(HCI_LE_ADV, &hdev->dev_flags);
680 680
681 /* Set require_privacy to false so that the remote device has a 681 /* Set require_privacy to false so that the remote device has a
682 * chance of identifying us. 682 * chance of identifying us.
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index f1c5a077e558..8ffaca0290f8 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3746,7 +3746,7 @@ static void set_random_addr(struct hci_request *req, bdaddr_t *rpa)
3746 * In this kind of scenario skip the update and let the random 3746 * In this kind of scenario skip the update and let the random
3747 * address be updated at the next cycle. 3747 * address be updated at the next cycle.
3748 */ 3748 */
3749 if (test_bit(HCI_ADVERTISING, &hdev->dev_flags) || 3749 if (test_bit(HCI_LE_ADV, &hdev->dev_flags) ||
3750 hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) { 3750 hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) {
3751 BT_DBG("Deferring random address update"); 3751 BT_DBG("Deferring random address update");
3752 return; 3752 return;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index dda1eb124208..be589d8d437f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1046,12 +1046,12 @@ static void enable_advertising(struct hci_request *req)
1046 u8 own_addr_type, enable = 0x01; 1046 u8 own_addr_type, enable = 0x01;
1047 bool connectable; 1047 bool connectable;
1048 1048
1049 /* Clear the HCI_ADVERTISING bit temporarily so that the 1049 /* Clear the HCI_LE_ADV bit temporarily so that the
1050 * hci_update_random_address knows that it's safe to go ahead 1050 * hci_update_random_address knows that it's safe to go ahead
1051 * and write a new random address. The flag will be set back on 1051 * and write a new random address. The flag will be set back on
1052 * as soon as the SET_ADV_ENABLE HCI command completes. 1052 * as soon as the SET_ADV_ENABLE HCI command completes.
1053 */ 1053 */
1054 clear_bit(HCI_ADVERTISING, &hdev->dev_flags); 1054 clear_bit(HCI_LE_ADV, &hdev->dev_flags);
1055 1055
1056 connectable = get_connectable(hdev); 1056 connectable = get_connectable(hdev);
1057 1057