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

pkg/nimble:derive peer address type from peer address #18474

Merged
merged 2 commits into from
Aug 20, 2022

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Aug 18, 2022

Contribution description

This PR fixes a problem when using nimble_statconn.

nimble_statconn master has to define the peer address type of the slave node to which the connection is established by the master. Using a BLE_ADDR_RANDOM as the peer address type allows connecting only to peers that have a static random address. Deriving the peer address type from the peer address is simple and allows connections to be established with peers that have either a public or static random address.

Furthermore, to see which type of address is used as own address, the output of the ble info command has been extended by the address type info.

The problem was found when investigating in PR #18439 the reason why tests/nimble_statconn_gnrc* failed.

Testing procedure

Use two BLE nodes and flash tests/nimble_statconn_gnrc and check that the test still works. Execeute the ble info command.

Node 1:

> ble info 
Own Address: DD:67:34:05:2D:D6 (static random) -> [FE80::DD67:34FF:FE05:2DD6]
Supported PHY modes: 1M 2M CODED
 Free slots: 3/3
Advertising: no
Connections: 0
Slots:
[ 0] state: 0x8000 - unused
[ 1] state: 0x8000 - unused
[ 2] state: 0x8000 - unused

> statconn addm 60:55:F9:6E:6E:69
success: connecting to peer as slave
> 
> [ble] CONNECTED slave (0|60:55:F9:6E:6E:69)

Node 2:

> ble info
Own Address: 60:55:F9:6E:6E:69 (public) -> [FE80::6055:F9FF:FE6E:6E69]
Supported PHY modes: 1M
 Free slots: 3/3
Advertising: no
Connections: 0
Slots:
[ 0] state: 0x8000 - unused
[ 1] state: 0x8000 - unused
[ 2] state: 0x8000 - unused

> statconn adds DD:67:34:05:2D:D6
success: connecting to peer as master
[ble] CONNECTED master (0|DD:67:34:05:2D:D6)

Issues/PRs references

Prerequisite for PR #18439

Using a `BLE_ADDR_RANDOM` as the peer address type allows connecting only to peers that have a static random address. Deriving the peer address type from the peer address is simple and allows connections to be established with peers that have either a public or
static random address.
@github-actions github-actions bot added Area: BLE Area: Bluetooth Low Energy support Area: pkg Area: External package ports Area: sys Area: System labels Aug 18, 2022
@gschorcht gschorcht added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 18, 2022
@benpicco benpicco enabled auto-merge August 20, 2022 15:17
@benpicco benpicco merged commit a4564df into RIOT-OS:master Aug 20, 2022
@gschorcht
Copy link
Contributor Author

@benpicco Thanks for reviewing and merging.

@gschorcht gschorcht deleted the pkg/nimble/fix_statconn_peer_type branch August 31, 2022 08:39
@maribu maribu added this to the Release 2022.10 milestone Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BLE Area: Bluetooth Low Energy support Area: pkg Area: External package ports Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants