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

Nimble Static Random Address is not persisted after reboot (IDFGH-14516) #15282

Open
3 tasks done
vandy opened this issue Jan 25, 2025 · 0 comments
Open
3 tasks done

Nimble Static Random Address is not persisted after reboot (IDFGH-14516) #15282

vandy opened this issue Jan 25, 2025 · 0 comments
Assignees
Labels
Status: Opened Issue is new

Comments

@vandy
Copy link

vandy commented Jan 25, 2025

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I'm using the Nimble stack and several functions in nimble_callback_on_sync but get an unexpected result for me.

I want to get the same Static Random Address once I've set it up, but after each restart it's updated to a different one. My code is something like this:

// on_sync
int rc = ble_hs_id_copy_addr(BLE_ADDR_RANDOM, address, NULL);
if (rc) {
    ESP_LOGI(TAG, "Random address is not set, rc: %d", rc); // rc == 21 (BLE_HS_ENOADDR)
    esp_ble_addr_t addr;
    rc = esp_ble_hw_get_static_addr(&addr);
    if (rc) {
        ESP_LOGI(TAG, "Error in esp_ble_hw_get_static_addr, rc: %d", rc); // always -1
    }
}
rc = ble_hs_util_ensure_addr(1);

What I expect is that on the first start there is no Static Random Address set. I call ble_hs_util_ensure_addr(1) which generates Static Random Address and set it via ble_hs_id_set_rnd (which sends an HCI command to the Controller (ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_SET_RAND_ADDR), &cmd, sizeof(cmd), NULL, 0)). From that point on I think that Controller should store the set address and give it back on the next restart, when ble_hs_util_ensure_addr loads it with ble_hs_util_load_rand_addr -> esp_ble_hw_get_static_addr. But it's not the case and a new address is generated each time.

Is it expected behavior? Why?

I want to a create random address (set it as Static Random Address) and use it as Identity Address for RPA. I believe this Static Random Address should be the same on each start for RPA to work (if I've bonded some devices).

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 25, 2025
@github-actions github-actions bot changed the title Nimble Static Random Address is not persisted after reboot Nimble Static Random Address is not persisted after reboot (IDFGH-14516) Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

3 participants