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

BLE Security parameter "AuthOpt_u8" doesn't get reset after the BLE was disabled/re-enabled. (IDFGH-12909) #13869

Closed
3 tasks done
sergiutigu opened this issue May 28, 2024 · 5 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@sergiutigu
Copy link

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.

IDF version.

v4.3

Espressif SoC revision.

ESP32

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

None

Development Kit.

custom board

Power Supply used.

USB

What is the expected behavior?

the value of the BLE security parameter "AuthOpt_u8" should be cleared after cycles of BLE enable/disable.

What is the actual behavior?

the value of the BLE security parameter "AuthOpt_u8" is stored between cycles of BLE enabling /disabling.

Steps to reproduce.

  1. Enable BLE
    esp_bt_controller_config_t NPI_BT_ControllerConfig_st = BT_CONTROLLER_INIT_CONFIG_DEFAULT();

    ErrorCode_s32 = esp_bt_controller_init(&NPI_BT_ControllerConfig_st);
    if (ErrorCode_s32 != ESP_OK) {
    //error message
    }

    ErrorCode_s32 = esp_bt_controller_enable(ESP_BT_MODE_BLE);
    if (ErrorCode_s32 != ESP_OK) {
    //error message
    }

    ErrorCode_s32 = esp_ble_config_file_path_update((char_t*)NPI_BT_Filename_pac);
    if (ErrorCode_s32 != ESP_OK) {
    //error message
    }

    ErrorCode_s32 = esp_bluedroid_init();
    if (ErrorCode_s32 != ESP_OK) {
    //error message
    }

    ErrorCode_s32 = esp_bluedroid_enable();
    if (ErrorCode_s32 != ESP_OK) {
    //error message
    }

  2. Set AuthOpt_u8 = ESP_BLE_ONLY_ACCEPT_SPECIFIED_AUTH_ENABLE;

  3. Disable BLE

  4. esp_err_t ErrorCode_s32;
    

    // Before deinit, disable ble first
    ErrorCode_s32 = esp_bluedroid_disable();
    if (ErrorCode_s32 != ESP_OK) {
    //error message
    }
    // Deinit and free the stack for ble
    ErrorCode_s32 = esp_bluedroid_deinit();
    if (ErrorCode_s32 != ESP_OK) {
    //error message }
    // Disable the bt controller
    ErrorCode_s32 = esp_bt_controller_disable();
    if (ErrorCode_s32 != ESP_OK) {
    //error message }
    // Deinit the bt controller
    ErrorCode_s32 = esp_bt_controller_deinit();
    if (ErrorCode_s32 != ESP_OK) {
    //error message }

  5. Enable BLE again like in step 1.

  6. The value of AuthOpt_u8 = ESP_BLE_ONLY_ACCEPT_SPECIFIED_AUTH_ENABLE is still as set before.

  7. This is not the case if you reboot the board.

  8. In order to fix this you need to explicit clear this settings.
    ...

Debug Logs.

No response

More Information.

No response

@sergiutigu sergiutigu added the Type: Bug bugs in IDF label May 28, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label May 28, 2024
@github-actions github-actions bot changed the title BLE Security parameter "AuthOpt_u8" doesn't get reset after the BLE was disabled/re-enabled. BLE Security parameter "AuthOpt_u8" doesn't get reset after the BLE was disabled/re-enabled. (IDFGH-12909) May 28, 2024
@esp-zhp
Copy link
Collaborator

esp-zhp commented May 29, 2024

The BLE security parameter "AuthOpt_u8" does not get reset after the BLE is disabled and then re-enabled.

Could you please explain what impact this might have on usage if the security parameter "AuthOpt_u8" is not cleared?

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Opened Issue is new labels Jun 13, 2024
@exilat
Copy link

exilat commented Jun 14, 2024

Well actually it is a problem. For instance you can run as a server and then you run as a client. Now the AuthOpt_u8 from the server are applied to the Client also. And also i am no longer confident that like disabling and enabling again the BLE stack is actually reseting to initial configuration. This is clearly software bug since it disapears if you do a hardware reset.
I do not consider that this issue is done

@esp-zhp
Copy link
Collaborator

esp-zhp commented Jun 14, 2024

Thank you for your report. We have now fixed the issue.

The fix has been committed to the master branch with commit ID: 42ca04b.

Once testing is complete, we will sync it to GitHub and other branch(don‘t include v4.3)

image

@esp-zhp
Copy link
Collaborator

esp-zhp commented Jun 14, 2024

you can use the git am command to apply this patch.
0001-fix-ble-bluedroid-Fixed-BLE-set-adv-param-check.zip

@Indastri
Copy link
Collaborator

Indastri commented Jul 1, 2024

Closing the issue as the user did not reply. If you will encounter any problems, feel free to reopen this one or create a new issues.

Cheers!

@Indastri Indastri closed this as completed Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

5 participants