-
Notifications
You must be signed in to change notification settings - Fork 615
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
ESP32: Unexpected BNEP_EVENT_CHANNEL_CLOSED after ~40 sec with esp-idf v4.x and BR/EDR Secure Connections #594
Comments
No obvious idea. Could you post the full HCI Packet Log after converting it with tool/create_packet_log.py? |
Here's the Wireshark packet log. |
I see. Nothing else is happening really. The disconnect is caused by a Link Layer time out, it would be different if iOS disconnects actively. Only idea: disable BR/EDR Secure Connections by calling gap_secure_connections_enable(false) before connecting. |
Looks like calling I'm not sure I understand why this works, was iOS waiting for a special response related to this security setting and because it never arrived the connection was closed? Also, I don't know nearly enough about Bluetooth to understand what the (security) implications are of doing this. Can you elaborate a bit? |
It's not related to iOS. In the past, there have been a number of issues in the BR/EDR Secure Connection implementation on the ESP32. Here's the latest one: espressif/esp-idf#13661 The security implications are minor. As far as I know, the legacy pairing is not less secure than the newer one. It's just that the legacy one is a a custom mechanism that was created for Bluetooth only, while the new one uses standard cryptographic algorithms (AES-CCM). Still, there hasn't been an academic paper that claimed that the older mechanism is insecure. Could you retest your use case with the test libdtm_app from the other issue with BR/EDR Secure Connections enabled? |
Thanks for clarifying! I tried to build with the test lib in espressif/esp-idf#13661 but the linker complains about 2 undefined references, likely because this project is still on esp-idf 4.x. I won't be upgrading this project to v5 anytime soon since it's quite involved because of the netif changes in esp-idf v5. This project ran fine the last couple of years by the way, using BTStack 1.3.2, it was only because apparently after a certain iOS update it refused to connect that I started investigating. Tried upgrading to BTStack 1.6, but that didn't improve things until I tried your I'll revisit this if I ever come around to upgrading this project to esp-idf v5. |
how to use ESP32 run as a NAP role? |
I'm using btstack 1.6 on an ESP32. It's used to tether to an iPhone (iOS 17.5), the ESP32 takes on the PANU role.
Everything seems to work fine, I periodically (every 12 sec.) do an HTTP request from the ESP32 and get a response, but it seems like the iPhone/iOS insists on closing the connection after 40 sec. regardless of activity.
Without fail I get a
BNEP_EVENT_CHANNEL_CLOSED
in the BNEP handler around 40 sec. after theBNEP_EVENT_CHANNEL_OPENED
event.Any ideas?
The text was updated successfully, but these errors were encountered: