diff options
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 32575b49f4a0..bf9f8a801a2e 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -719,6 +719,13 @@ done: | |||
719 | hci_dev_unlock(hdev); | 719 | hci_dev_unlock(hdev); |
720 | } | 720 | } |
721 | 721 | ||
722 | static bool conn_use_rpa(struct hci_conn *conn) | ||
723 | { | ||
724 | struct hci_dev *hdev = conn->hdev; | ||
725 | |||
726 | return hci_dev_test_flag(hdev, HCI_PRIVACY); | ||
727 | } | ||
728 | |||
722 | static void hci_req_add_le_create_conn(struct hci_request *req, | 729 | static void hci_req_add_le_create_conn(struct hci_request *req, |
723 | struct hci_conn *conn) | 730 | struct hci_conn *conn) |
724 | { | 731 | { |
@@ -726,14 +733,15 @@ static void hci_req_add_le_create_conn(struct hci_request *req, | |||
726 | struct hci_dev *hdev = conn->hdev; | 733 | struct hci_dev *hdev = conn->hdev; |
727 | u8 own_addr_type; | 734 | u8 own_addr_type; |
728 | 735 | ||
729 | memset(&cp, 0, sizeof(cp)); | ||
730 | |||
731 | /* Update random address, but set require_privacy to false so | 736 | /* Update random address, but set require_privacy to false so |
732 | * that we never connect with an non-resolvable address. | 737 | * that we never connect with an non-resolvable address. |
733 | */ | 738 | */ |
734 | if (hci_update_random_address(req, false, &own_addr_type)) | 739 | if (hci_update_random_address(req, false, conn_use_rpa(conn), |
740 | &own_addr_type)) | ||
735 | return; | 741 | return; |
736 | 742 | ||
743 | memset(&cp, 0, sizeof(cp)); | ||
744 | |||
737 | /* Set window to be the same value as the interval to enable | 745 | /* Set window to be the same value as the interval to enable |
738 | * continuous scanning. | 746 | * continuous scanning. |
739 | */ | 747 | */ |
@@ -774,7 +782,8 @@ static void hci_req_directed_advertising(struct hci_request *req, | |||
774 | /* Set require_privacy to false so that the remote device has a | 782 | /* Set require_privacy to false so that the remote device has a |
775 | * chance of identifying us. | 783 | * chance of identifying us. |
776 | */ | 784 | */ |
777 | if (hci_update_random_address(req, false, &own_addr_type) < 0) | 785 | if (hci_update_random_address(req, false, conn_use_rpa(conn), |
786 | &own_addr_type) < 0) | ||
778 | return; | 787 | return; |
779 | 788 | ||
780 | memset(&cp, 0, sizeof(cp)); | 789 | memset(&cp, 0, sizeof(cp)); |