@@ -1066,7 +1066,7 @@ int hci_update_random_address_sync(struct hci_dev *hdev, bool require_privacy,
1066
1066
/* If Controller supports LL Privacy use own address type is
1067
1067
* 0x03
1068
1068
*/
1069
- if (use_ll_privacy (hdev ))
1069
+ if (ll_privacy_capable (hdev ))
1070
1070
* own_addr_type = ADDR_LE_DEV_RANDOM_RESOLVED ;
1071
1071
else
1072
1072
* own_addr_type = ADDR_LE_DEV_RANDOM ;
@@ -2162,7 +2162,7 @@ static int hci_le_set_scan_enable_sync(struct hci_dev *hdev, u8 val,
2162
2162
2163
2163
static int hci_le_set_addr_resolution_enable_sync (struct hci_dev * hdev , u8 val )
2164
2164
{
2165
- if (!use_ll_privacy (hdev ))
2165
+ if (!ll_privacy_capable (hdev ))
2166
2166
return 0 ;
2167
2167
2168
2168
/* If controller is not/already resolving we are done. */
@@ -2254,7 +2254,7 @@ static int hci_le_del_resolve_list_sync(struct hci_dev *hdev,
2254
2254
struct hci_cp_le_del_from_resolv_list cp ;
2255
2255
struct bdaddr_list_with_irk * entry ;
2256
2256
2257
- if (!use_ll_privacy (hdev ))
2257
+ if (!ll_privacy_capable (hdev ))
2258
2258
return 0 ;
2259
2259
2260
2260
/* Check if the IRK has been programmed */
@@ -2319,7 +2319,7 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
2319
2319
struct bdaddr_list_with_irk * entry ;
2320
2320
struct hci_conn_params * p ;
2321
2321
2322
- if (!use_ll_privacy (hdev ))
2322
+ if (!ll_privacy_capable (hdev ))
2323
2323
return 0 ;
2324
2324
2325
2325
/* Attempt to program local identity address, type and irk if params is
@@ -2332,7 +2332,8 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
2332
2332
hci_copy_identity_address (hdev , & cp .bdaddr , & cp .bdaddr_type );
2333
2333
memcpy (cp .peer_irk , hdev -> irk , 16 );
2334
2334
goto done ;
2335
- }
2335
+ } else if (!(params -> flags & HCI_CONN_FLAG_ADDRESS_RESOLUTION ))
2336
+ return 0 ;
2336
2337
2337
2338
irk = hci_find_irk_by_addr (hdev , & params -> addr , params -> addr_type );
2338
2339
if (!irk )
@@ -2379,6 +2380,10 @@ static int hci_le_set_privacy_mode_sync(struct hci_dev *hdev,
2379
2380
struct hci_cp_le_set_privacy_mode cp ;
2380
2381
struct smp_irk * irk ;
2381
2382
2383
+ if (!ll_privacy_capable (hdev ) ||
2384
+ !(params -> flags & HCI_CONN_FLAG_ADDRESS_RESOLUTION ))
2385
+ return 0 ;
2386
+
2382
2387
/* If device privacy mode has already been set there is nothing to do */
2383
2388
if (params -> privacy_mode == HCI_DEVICE_PRIVACY )
2384
2389
return 0 ;
@@ -2428,11 +2433,6 @@ static int hci_le_add_accept_list_sync(struct hci_dev *hdev,
2428
2433
if (* num_entries >= hdev -> le_accept_list_size )
2429
2434
return - ENOSPC ;
2430
2435
2431
- /* Accept list can not be used with RPAs */
2432
- if (!use_ll_privacy (hdev ) &&
2433
- hci_find_irk_by_addr (hdev , & params -> addr , params -> addr_type ))
2434
- return - EINVAL ;
2435
-
2436
2436
/* Attempt to program the device in the resolving list first to avoid
2437
2437
* having to rollback in case it fails since the resolving list is
2438
2438
* dynamic it can probably be smaller than the accept list.
@@ -2567,7 +2567,7 @@ static int hci_pause_addr_resolution(struct hci_dev *hdev)
2567
2567
{
2568
2568
int err ;
2569
2569
2570
- if (!use_ll_privacy (hdev ))
2570
+ if (!ll_privacy_capable (hdev ))
2571
2571
return 0 ;
2572
2572
2573
2573
if (!hci_dev_test_flag (hdev , HCI_LL_RPA_RESOLUTION ))
@@ -2671,12 +2671,12 @@ static int hci_le_clear_accept_list_sync(struct hci_dev *hdev)
2671
2671
*
2672
2672
* Update is done using the following sequence:
2673
2673
*
2674
- * use_ll_privacy ((Disable Advertising) -> Disable Resolving List) ->
2674
+ * ll_privacy_capable ((Disable Advertising) -> Disable Resolving List) ->
2675
2675
* Remove Devices From Accept List ->
2676
- * (has IRK && use_ll_privacy (Remove Devices From Resolving List))->
2676
+ * (has IRK && ll_privacy_capable (Remove Devices From Resolving List))->
2677
2677
* Add Devices to Accept List ->
2678
- * (has IRK && use_ll_privacy (Remove Devices From Resolving List)) ->
2679
- * use_ll_privacy (Enable Resolving List -> (Enable Advertising)) ->
2678
+ * (has IRK && ll_privacy_capable (Remove Devices From Resolving List)) ->
2679
+ * ll_privacy_capable (Enable Resolving List -> (Enable Advertising)) ->
2680
2680
* Enable Scanning
2681
2681
*
2682
2682
* In case of failure advertising shall be restored to its original state and
@@ -2697,7 +2697,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)
2697
2697
/* Pause advertising if resolving list can be used as controllers
2698
2698
* cannot accept resolving list modifications while advertising.
2699
2699
*/
2700
- if (use_ll_privacy (hdev )) {
2700
+ if (ll_privacy_capable (hdev )) {
2701
2701
err = hci_pause_advertising_sync (hdev );
2702
2702
if (err ) {
2703
2703
bt_dev_err (hdev , "pause advertising failed: %d" , err );
@@ -2842,7 +2842,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)
2842
2842
bt_dev_err (hdev , "Unable to enable LL privacy: %d" , err );
2843
2843
2844
2844
/* Resume advertising if it was paused */
2845
- if (use_ll_privacy (hdev ))
2845
+ if (ll_privacy_capable (hdev ))
2846
2846
hci_resume_advertising_sync (hdev );
2847
2847
2848
2848
/* Select filter policy to use accept list */
@@ -3100,7 +3100,7 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
3100
3100
* If there are devices to scan:
3101
3101
*
3102
3102
* Disable Scanning -> Update Accept List ->
3103
- * use_ll_privacy ((Disable Advertising) -> Disable Resolving List ->
3103
+ * ll_privacy_capable ((Disable Advertising) -> Disable Resolving List ->
3104
3104
* Update Resolving List -> Enable Resolving List -> (Enable Advertising)) ->
3105
3105
* Enable Scanning
3106
3106
*
@@ -3454,7 +3454,7 @@ int hci_update_name_sync(struct hci_dev *hdev)
3454
3454
*
3455
3455
* HCI_SSP_ENABLED(Enable SSP)
3456
3456
* HCI_LE_ENABLED(Enable LE)
3457
- * HCI_LE_ENABLED(use_ll_privacy (Add local IRK to Resolving List) ->
3457
+ * HCI_LE_ENABLED(ll_privacy_capable (Add local IRK to Resolving List) ->
3458
3458
* Update adv data)
3459
3459
* Enable Authentication
3460
3460
* lmp_bredr_capable(Set Fast Connectable -> Set Scan Type -> Set Class ->
@@ -4229,6 +4229,14 @@ static int hci_le_set_event_mask_sync(struct hci_dev *hdev)
4229
4229
if (use_enhanced_conn_complete (hdev ))
4230
4230
events [1 ] |= 0x02 ; /* LE Enhanced Connection Complete */
4231
4231
4232
+ /* Mark Device Privacy if Privacy Mode is supported */
4233
+ if (privacy_mode_capable (hdev ))
4234
+ hdev -> conn_flags |= HCI_CONN_FLAG_DEVICE_PRIVACY ;
4235
+
4236
+ /* Mark Address Resolution if LL Privacy is supported */
4237
+ if (ll_privacy_capable (hdev ))
4238
+ hdev -> conn_flags |= HCI_CONN_FLAG_ADDRESS_RESOLUTION ;
4239
+
4232
4240
/* If the controller supports Extended Scanner Filter
4233
4241
* Policies, enable the corresponding event.
4234
4242
*/
@@ -5385,7 +5393,7 @@ int hci_stop_discovery_sync(struct hci_dev *hdev)
5385
5393
}
5386
5394
5387
5395
/* Resume advertising if it was paused */
5388
- if (use_ll_privacy (hdev ))
5396
+ if (ll_privacy_capable (hdev ))
5389
5397
hci_resume_advertising_sync (hdev );
5390
5398
5391
5399
/* No further actions needed for LE-only discovery */
@@ -5897,7 +5905,7 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval)
5897
5905
5898
5906
failed :
5899
5907
/* Resume advertising if it was paused */
5900
- if (use_ll_privacy (hdev ))
5908
+ if (ll_privacy_capable (hdev ))
5901
5909
hci_resume_advertising_sync (hdev );
5902
5910
5903
5911
/* Resume passive scanning */
@@ -6673,7 +6681,7 @@ int hci_get_random_address(struct hci_dev *hdev, bool require_privacy,
6673
6681
/* If Controller supports LL Privacy use own address type is
6674
6682
* 0x03
6675
6683
*/
6676
- if (use_ll_privacy (hdev ))
6684
+ if (ll_privacy_capable (hdev ))
6677
6685
* own_addr_type = ADDR_LE_DEV_RANDOM_RESOLVED ;
6678
6686
else
6679
6687
* own_addr_type = ADDR_LE_DEV_RANDOM ;
0 commit comments