Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore invalid RPA #537

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion bumble/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -4281,6 +4281,12 @@ def _complete_le_extended_advertising_connection(
else self.public_address
)

if advertising_set.advertising_parameters.own_address_type in (
OwnAddressType.RANDOM,
OwnAddressType.PUBLIC,
):
connection.self_resolvable_address = None

# Setup auto-restart of the advertising set if needed.
if advertising_set.auto_restart:
connection.once(
Expand Down Expand Up @@ -4327,7 +4333,10 @@ def on_connection(
# Convert all-zeros addresses into None.
if self_resolvable_address == Address.ANY_RANDOM:
self_resolvable_address = None
if peer_resolvable_address == Address.ANY_RANDOM:
if (
peer_resolvable_address == Address.ANY_RANDOM
or not peer_address.is_resolved
):
peer_resolvable_address = None

logger.debug(
Expand Down Expand Up @@ -4361,6 +4370,7 @@ def on_connection(
peer_address = resolved_address

self_address = None
own_address_type: Optional[int] = None
if role == HCI_CENTRAL_ROLE:
own_address_type = self.connect_own_address_type
assert own_address_type is not None
Expand Down Expand Up @@ -4389,6 +4399,11 @@ def on_connection(
else self.random_address
)

# Some controllers may return local resolvable address even not using address
# generation offloading. Ignore the value to prevent SMP failure.
if own_address_type in (OwnAddressType.RANDOM, OwnAddressType.PUBLIC):
self_resolvable_address = None

# Create a connection.
connection = Connection(
self,
Expand Down
Loading