Skip to content

Commit 3a7fdfb

Browse files
committed
Bluetooth: hci_event: Fix handling of HCI_EV_LE_DIRECT_ADV_REPORT
Some controllers seems to generate HCI_EV_LE_DIRECT_ADV_REPORT even when scan_filter is not set to 0x02 or 0x03, which indicates that local privacy is enabled, causing them to be ignored thus breaking auto-connect logic: < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7 Type: Passive (0x00) Interval: 60.000 msec (0x0060) Window: 30.000 msec (0x0030) Own address type: Public (0x00) Filter policy: Ignore not in accept list (0x01) ... > HCI Event: LE Meta Event (0x3e) plen 18 LE Direct Advertising Report (0x0b) Num reports: 1 Event type: Connectable directed - ADV_DIRECT_IND (0x01) Address type: Random (0x01) Address: XX:XX:XX:XX:XX:XX (Static) Direct address type: Random (0x01) Direct address: XX:XX:XX:XX:XX:XX (Non-Resolvable) RSSI: -54 dBm (0xca) So this attempts to mitigate the above problem by skipping checking of direct_addr if local privacy is not enabled. Link: bluez/bluez#1138 Fixes: e209e5c ("Bluetooth: MGMT: Mark LL Privacy as stable") Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 1f77c05 commit 3a7fdfb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

net/bluetooth/hci_event.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6060,8 +6060,17 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
60606060
* a LE Direct Advertising Report event. In that case it is
60616061
* important to see if the address is matching the local
60626062
* controller address.
6063+
*
6064+
* If local privacy is not enable the controller shall not be
6065+
* generating such event since according to its documentation it is only
6066+
* valid for filter_policy 0x02 and 0x03, but the fact that it did
6067+
* generate LE Direct Advertising Report means it is probably broken and
6068+
* won't generate any other event which can potentially break
6069+
* auto-connect logic so in case local privacy is not enable this
6070+
* ignores the direct_addr so it works as a regular report.
60636071
*/
6064-
if (!hci_dev_test_flag(hdev, HCI_MESH) && direct_addr) {
6072+
if (!hci_dev_test_flag(hdev, HCI_MESH) && direct_addr &&
6073+
hci_dev_test_flag(hdev, HCI_PRIVACY)) {
60656074
direct_addr_type = ev_bdaddr_type(hdev, direct_addr_type,
60666075
&bdaddr_resolved);
60676076

@@ -6071,12 +6080,6 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
60716080
if (!hci_bdaddr_is_rpa(direct_addr, direct_addr_type))
60726081
return;
60736082

6074-
/* If the controller is not using resolvable random
6075-
* addresses, then this report can be ignored.
6076-
*/
6077-
if (!hci_dev_test_flag(hdev, HCI_PRIVACY))
6078-
return;
6079-
60806083
/* If the local IRK of the controller does not match
60816084
* with the resolvable random address provided, then
60826085
* this report can be ignored.

0 commit comments

Comments
 (0)