Skip to content

bluetooth: host: smp: Don't try to add peer to Resolving List when Privacy feature is disabled #93821

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

Conversation

PavelVPV
Copy link
Contributor

@PavelVPV PavelVPV commented Jul 29, 2025

If the Privacy feature is disabled, drop the IdKey flag in the Initiator Key Distribution/Generation field in the Pairing Response.

It was observed that when built without the Privacy feature and bonding with a Central device that supports Privacy, the Central device will send the IRK and BD_ADDR through the Identity Information and Identity Address Information commands.

This causes the Host to attempt to add the Peer IRK and Peer Identity Address to the Controller's Resolving List. However, this operation will fail because the Privacy feature is disabled.

Additionally, the Host will attempt to check for conflicting IRKs. If such a conflict exists, it will either reject the pairing or remove the conflicting IRK based on its configuration. This behavior is unnecessary since the Privacy feature is disabled and IRKs are not used.

@PavelVPV PavelVPV marked this pull request as ready for review July 29, 2025 13:08
@zephyrbot zephyrbot added area: Bluetooth area: Bluetooth Host Bluetooth Host (excluding BR/EDR) labels Jul 29, 2025
cvinayak
cvinayak previously approved these changes Jul 29, 2025
Copy link
Contributor

@cvinayak cvinayak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Related corollary RFC: #89408

@sjanc
Copy link
Contributor

sjanc commented Jul 29, 2025

Shouldn't ID key be disabled in distribution list instead of this (ie IRK should not be allowed in first place)? Otherwise peer may use RPAs and thus will never be able to reconnect?

@PavelVPV PavelVPV force-pushed the dont_invalidate_bonding_if_privacy_disable branch from 24a34d9 to 91ae0f2 Compare July 30, 2025 11:12
@PavelVPV
Copy link
Contributor Author

Shouldn't ID key be disabled in distribution list instead of this (ie IRK should not be allowed in first place)? Otherwise peer may use RPAs and thus will never be able to reconnect?

You seem to be right. I've updated the code to reject IRK and address distribution of privacy is disabled.

If the Privacy feature is disabled, drop the IdKey flag in the Initiator
Key Distribution/Generation field in the Pairing Response.

It was observed that when built without the Privacy feature and bonding
with a Central device that supports Privacy, the Central device will
send the IRK and BD_ADDR through the Identity Information and Identity
Address Information commands.

This causes the Host to attempt to add the Peer IRK and Peer Identity
Address to the Controller's Resolving List. However, this operation will
fail because the Privacy feature is disabled.

Additionally, the Host will attempt to check for conflicting IRKs. If
such a conflict exists, it will either reject the pairing or remove the
conflicting IRK based on its configuration. This behavior is unnecessary
since the Privacy feature is disabled and IRKs are not used.

Signed-off-by: Pavel Vasilyev <[email protected]>
@PavelVPV PavelVPV force-pushed the dont_invalidate_bonding_if_privacy_disable branch from 91ae0f2 to 9182d23 Compare July 30, 2025 11:15
@PavelVPV PavelVPV requested review from cvinayak and zycz July 30, 2025 11:18
Copy link

Comment on lines +4067 to 4068
#if defined(CONFIG_BT_PRIVACY)
static uint8_t smp_ident_info(struct bt_smp *smp, struct net_buf *buf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have any specific guidelines for this, but I do have a slight preference of using IS_ENABLED(CONFIG_BT_PRIVACY) inside smp_ident_info to handle the return value, instead of guarding the entire function.

Ditto for smp_ident_addr_info

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just followed the same pattern as other command handlers have in the file.

@@ -71,7 +71,7 @@ LOG_MODULE_REGISTER(bt_smp);
#define LINK_DIST 0
#endif

#define RECV_KEYS (BT_SMP_DIST_ENC_KEY | BT_SMP_DIST_ID_KEY | SIGN_DIST |\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, but I do wonder if this change belongs in the release notes or migration guides? This is a functional change in some way, but I don't see why it should a problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add this to the release notes as this changes Host behavior (though not sure if anyone relied on this).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like there is no place for such change in the new format of release notes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah. The new format does somewhat discourage documentation functional changes that does not require a migration guide entry (if there's nothing to migrate to)

@alwa-nordic
Copy link
Contributor

alwa-nordic commented Jul 31, 2025

I'm confused. I thought CONFIG_BT_PRIVACY selects whether the local device is using a private address, not whether we are able to receive an IRK during pairing and later resolve the peer's address. Look at the help text of CONFIG_BT_PRIVACY:

config BT_PRIVACY
bool "Device privacy"
help
Enable privacy for the local device. This makes the device use Resolvable
Private Addresses (RPAs) by default.
Note:
Establishing connections as a directed advertiser, or to a directed
advertiser is only possible if the controller also supports privacy.

This PR seems to modify CONFIG_BT_PRIVACY to also control the system's ability to resolve private peers.

@PavelVPV
Copy link
Contributor Author

I'm confused. I thought CONFIG_BT_PRIVACY selects whether the local device is using a private address, not whether we are able to receive an IRK during pairing and later resolve the peer's address. Look at the help text of CONFIG_BT_PRIVACY:

config BT_PRIVACY
bool "Device privacy"
help
Enable privacy for the local device. This makes the device use Resolvable
Private Addresses (RPAs) by default.
Note:
Establishing connections as a directed advertiser, or to a directed
advertiser is only possible if the controller also supports privacy.

This PR seems to modify CONFIG_BT_PRIVACY to also control the system's ability to resolve private peers.

Fair point, I missed that. Then I need to think about another solution for this issue.

@PavelVPV PavelVPV closed this Jul 31, 2025
@PavelVPV PavelVPV deleted the dont_invalidate_bonding_if_privacy_disable branch July 31, 2025 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants