Code Monkey home page Code Monkey logo

Comments (7)

mringwal avatar mringwal commented on July 17, 2024

No obvious idea. Could you post the full HCI Packet Log after converting it with tool/create_packet_log.py?
Maybe something else is going on that causes the disconnect.

from btstack.

western-hoolock avatar western-hoolock commented on July 17, 2024

Here's the Wireshark packet log.
There's 4 successful HTTP requests in there, shortly after the last one succeeds, the channel is closed for some reason.
channel_closed.zip

from btstack.

mringwal avatar mringwal commented on July 17, 2024

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.

from btstack.

western-hoolock avatar western-hoolock commented on July 17, 2024

Looks like calling gap_secure_connections_enable(false) actually did the trick! It's been running for 10+ minutes now and it hasn't disconnected.

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?

from btstack.

mringwal avatar mringwal commented on July 17, 2024

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?
If it's fixed by that, please leave a comment there to let Espressif know. If not, please create a new issue and post logs files with the test library and comment that everything works without BR/EDR Secure Connections. Thanks!

from btstack.

western-hoolock avatar western-hoolock commented on July 17, 2024

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 gap_secure_connections_enable(false) suggestion. Then I added that call to the version that still used BTStack 1.3.2 and it also started working again!

I'll revisit this if I ever come around to upgrading this project to esp-idf v5.

from btstack.

youngitil avatar youngitil commented on July 17, 2024

how to use ESP32 run as a NAP role?

from btstack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.