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

[TW#16574] Bluetooth Controller: Link Key not emitted on re-pairing #1275

Closed
mringwal opened this issue Nov 15, 2017 · 9 comments
Closed

[TW#16574] Bluetooth Controller: Link Key not emitted on re-pairing #1275

mringwal opened this issue Nov 15, 2017 · 9 comments

Comments

@mringwal
Copy link
Contributor

The ESP32 Bluetooth Controller fails to emit a link key when the reconnecting and the remote has deleted its link key. Btw. this might be related to #1082 - more incorrect behaviour related to pairing/encryption.

Steps to reproduce

  • app creates an outgoing classic connection
  • as it has a stored link key, it requests authentication and provides the link key upon request
  • the remote device has deleted the link key for some reason and does not provide a link key
  • as there's no shared link key, pairing starts and succeed
    However, the Controller doesn't emit the new link key. In the next re-connect, both sides have a different link key (ESP32 the outdated one and the remote the current one) and the connection fails. It's crucial that the link key is emitted and this affect any Bluetooth stack running on the ESP32.

Here's the full log as
esp32-re-pair.txt (txt) and as
esp32-re-pair.pklg.zip (.pklg for Wireshark)

It can be reproduced e.g. using a patched version of spp_streamer_client of BTstack. You can change the BD Addr of the remote device in btstack_main and also the RFCOMM Channel.

spp_streamer_client.c.zip

@FayeY FayeY changed the title Bluetooth Controller: Link Key not emitted on re-pairing [TW#16574] Bluetooth Controller: Link Key not emitted on re-pairing Nov 21, 2017
@mringwal
Copy link
Contributor Author

Hello Espressiv. Any feedback on this bug in the Bluetooth Controller?

With this one and maybe #1082 fixed, I guess the ESP32 could be recommended for production use with Bluetooth Classic as long as Wifi isn't used.

@mywang-espressif
Copy link

Hi @mringwal , thanks for the detailed description and useful analysis. I can understand the scenario and I have reproduced the issue with your example. Next I will look into the logic and try to find out the cause.

@mringwal
Copy link
Contributor Author

Great news! Let me know when you have a version to test

@mywang-espressif
Copy link

Hello, I have found out the cause and attached is the library file for your test. Please let me know if it fixes this issue.
libbtdm_app.a.zip

@mywang-espressif
Copy link

BTW, this library works with current ESP-IDF master branch, commit 0a83733 and you don't need to patch other files.

@mringwal
Copy link
Contributor Author

excellent. I'll give it a try later and report back

@mringwal
Copy link
Contributor Author

hi @mywang-espressif I'm happy to confirm that the link key is emitted for repairing in the provided library. Thanks!

I'd leave this issue open until the fix is integrated on the esp32-bt-lib and available in esp-idf master.

@mywang-espressif
Copy link

Glad to hear that. I will further verify the change and put forward a merge request. I will let you know after it is integrated.

igrr pushed a commit that referenced this issue Mar 27, 2018
…for initiating side of simple pairing

In response to: #1275
@mywang-espressif
Copy link

Thanks @igrr. hi @mringwal , the patched library file is merged in to master branch. You can have a try.

igrr pushed a commit that referenced this issue Apr 2, 2018
…for initiating side of simple_pairing

In response to: #1275
@FayeY FayeY closed this as completed Apr 4, 2018
dconyers pushed a commit to bjntech/esp-idf that referenced this issue May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants