Skip to content

Is the ESP32-S3 cannot support adding random IP addresses from Android phones to the whitelist? #1108

@LusterWong

Description

@LusterWong

Thank you for providing such a powerful library.

I am currently using the ESP32-S3 as a GATT server. I need to limit the connection to a maximum of two specific clients to prevent unauthorized access. My current approach is as follows:

In the onAuthenticationComplete callback, I use NimBLEDevice::whiteListAdd(connInfo.getAddress()) to add the Android phone's address to the whitelist.

Once two phones have been bonded, I enable whitelist filtering for advertising.

The Problem:
After an Android phone disconnects and attempts to reconnect, it fails to establish a connection indefinitely. Does NimBLE support the resolution of Random Addresses?

I am using the latest library version v2.3.9. How can I properly restrict clients when they use Random Resolvable Addresses?

NimBLEDevice::whiteListAdd(connInfo.getAddress());
NimBLEDevice::whiteListAdd(connInfo.getIdAddress());
bool bonded = connInfo.isBonded();
int bonds = NimBLEDevice::getNumBonds();

if(bonds >= MAX_BONDS) {
      NimBLEAdvertising* pAdvertising = NimBLEDevice::getAdvertising();
      pAdvertising->stop();
      pAdvertising->setScanFilter(true, true);
      pAdvertising->start();
      return;
      }

Furthermore, if the whitelist function fails to work, I think it is also possible to determine in the onConnect callback function whether the device making this connection has been bound. Unfortunately, in the onConnect function, for Android phones, connInfo.isBonded() is always equal to false. Only in the onAuthenticationComplete callback function does connInfo.isBonded() have an effect, but the timing for the judgment has been missed.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions