Skip to content

Commit

Permalink
White/blacklist fix (#258)
Browse files Browse the repository at this point in the history
* White/blacklist fix

White/blacklist fix to also allow for empty whitelist, and positioned after the Identity MAC/IRK section to allow for Identity MACs to be included in white or blacklists

* Whitelist prioritisation
  • Loading branch information
DigiH authored Apr 23, 2024
1 parent cd46bdc commit 3b88898
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions TheengsGateway/ble_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,18 @@ def detection_callback(
"""Detect device in received advertisement data."""
logger.debug("%s:%s", device.address, advertisement_data)

# Try to resolve private addresses with known IRKs
address = self.rpa2id(device.address)

if (
device.address not in self.configuration["whitelist"]
or device.address in self.configuration["blacklist"]
address not in self.configuration["whitelist"]
and self.configuration["whitelist"] != []
) or (
address in self.configuration["blacklist"]
and address not in self.configuration["whitelist"]
):
return

# Try to resolve private addresses with known IRKs
address = self.rpa2id(device.address)

# Try to add the device to dictionary of clocks to synchronize time.
self.add_clock(address)

Expand Down

0 comments on commit 3b88898

Please sign in to comment.