Skip to content

Bluetooth Server Pairing crash #1724

@axa88

Description

@axa88

Library/API/IoT binding

nanoFramework.Device.Bluetooth

Visual Studio version

18.4.3

.NET nanoFramework extension version

2022.14.1.5

Target name(s)

ESP32_PSRAM_BLE_GenericGraphic_REV3

Firmware version

1.15.0.361

Device capabilities

No response

Description

There seems to be malfunction in device pairing.
In summary when configured with a BLE server, when 2 consecutive pairing attempts are canceled by a initiating client, the server crashes.

Minimal Repo here if need be, but the configuration doesn't seem to matter.
In this example the ble server is configured with Pairing.IOCapabilities = DevicePairingIOCapabilities.NoInputNoOutput; and Pairing.ProtectionLevel = DevicePairingProtectionLevel.None for simplicity but the malfunction seems to happen regardless of config.

How to reproduce

  1. Load example
  2. Initiate Bluetooth pair from any cancelable client (android works well)
  3. cancel
  4. repeat step 2/3
  5. observe server crash.

Expected behaviour

It would be expected that a pairing initiator can be canceled

Screenshots

No information can be gathered while debugging.

Sample project or code

https://github.com/axa88/NfIssueTracker/tree/master/RePairingCrash

Aditional information

On a related note, while this should be more transparent, it appears in NF both LE Secure Connections and Man In the Middle flags are hard coded as enabled. Therefore, with the example configuration, it's expected any paring request negotiation gets 'downgraded' to DevicePairingKinds.ConfirmOnly

So, while i've not seen another implementation of NimBLE do it, i might expect the server would trigger Pairing.PairingRequested in this scenario if possible, so that programming could be informed of a pair request even if user interaction isn't expected, so that programmatic rejection can be made if conditions call for it.

It should be irrelevant here but fwiw I've initiated pairing from both Android, and custom pairing from windows SDK where various PairingKinds could be configured, and they both will induce the crash. I expect they all negotiated as ConfirmOnly but as there is PairingRequested trigger i can't confirm.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions