esp-idf: Whitelisting still does not allow connections (IDFGH-322)

Environment

  • Core : [ESP-WROOM32]
  • IDF version: 1c7a8b3b712c4020562551f692d0ced8f7470d2c
  • Development Env: [msys32]
  • Operating System: [Windows]
  • Power Supply: [external 3.3V]

Problem Description

Whitelist does not work as expected, all connection attempts timeout when set to only allow whitelist connections.

I am trying to get the whitelist to work on my code which is based on Secure Gatt Server example. When I set advertising parameters to be:

data_adv_params.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_WLST;

or

data_adv_params.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_WLST_CON_WLST;

all connections timeout even from whitelisted devices. No GAP events are handled. When the device is bonded at ESP_GAP_BLE_AUTH_CMPL_EVT event I add it to the whitelist.

Debug Logs

Here is a sample log. “Pairing mode” is just a change in advertising to allow any scan any connection for a set period of time. After the advertising is set back to whitelist, all Gatt connections timeout, even from the newly bonded / whitelisted device.

I (10330) GATT SERVER: Entering Pairing Mode
I (10334) GATT SERVER: Removed all bonded devices
I (10347) GATT SERVER: GAP_EVT, event 17
I (10347) GATT SERVER: GAP_EVT, event 6
I (10347) GATT SERVER: advertising start success
I (10349) GATT SERVER: GAP_EVT, event 23
I (10353) GATT SERVER: ESP_GAP_BLE_REMOVE_BOND_DEV
I (10358) GATT SERVER: -----ESP_GAP_BLE_REMOVE_BOND_DEV----
I (10363) GATT SERVER: 61 86 f0 64 a9 f7 
I (10367) GATT SERVER: ------------------------------------
I (13906) GATT SERVER: ESP_GATTS_CONNECT_EVT
I (13907) GATT SERVER: ESP_GATTS_CONNECT_EVT
E (13909) BT_APPL: earlier enc was not done for same device

I (14115) GATT SERVER: GAP_EVT, event 20
W (15705) BT_SMP: FOR LE SC LTK IS USED INSTEAD OF STK
I (15826) GATT SERVER: GAP_EVT, event 9
I (15827) GATT SERVER: key type = ESP_LE_KEY_LENC
I (15827) GATT SERVER: GAP_EVT, event 9
I (15827) GATT SERVER: key type = ESP_LE_KEY_PENC
I (15831) GATT SERVER: GAP_EVT, event 9
I (15835) GATT SERVER: key type = ESP_LE_KEY_LID
I (16002) GATT SERVER: GAP_EVT, event 9
I (16002) GATT SERVER: key type = ESP_LE_KEY_PID
I (16002) GATT SERVER: GAP_EVT, event 8
I (16003) GATT SERVER: remote BD_ADDR: 44c553f4daed
I (16007) GATT SERVER: address type = 1
I (16011) GATT SERVER: pair status = success
I (16016) GATT SERVER: Bonded devices number : 1
I (16019) GATT SERVER: Bonded devices list : 1
I (16023) GATT SERVER: 44 c5 53 f4 da ed 
I (16028) GATT SERVER: GAP_EVT, event 27
I (16031) GATT SERVER: Whitelist updated
I (16037) GATT SERVER: GAP_EVT, event 20
I (19306) GATT SERVER: ESP_GATTS_DISCONNECT_EVT
I (19306) GATT SERVER: ESP_GATTS_DISCONNECT_EVT
I (19310) GATT SERVER: GAP_EVT, event 6
I (19311) GATT SERVER: advertising start success
I (19312) GATT SERVER: GAP_EVT, event 6
I (19315) GATT SERVER: advertising start success
I (40323) GATT SERVER: bt_pairing_timer_callback
I (40331) GATT SERVER: Stopping Pairing Mode
I (40334) GATT SERVER: GAP_EVT, event 17
(advertising set back to whitelist only connection)
I (40334) GATT SERVER: GAP_EVT, event 6
I (40334) GATT SERVER: advertising start success
(at this point there are no GAP events when trying to connnect, just timeouts)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 38 (10 by maintainers)

Most upvoted comments

Sorry, the whitelist only support public address and static random address without encryption.We will find a way to fix this bug, but we are still not sure how long it will take.

I think this is very important comment to note:

/* Controller do not support resolvable address now, only support public address and static random address */ https://github.com/espressif/esp-idf/blob/master/components/bt/host/bluedroid/stack/btm/btm_ble_bgconn.c#L202

Its important because most devices, for example all smartphones, are using resolvable private address, even esp32 in private addressing mode is using RPA, not static random address.

@jkhax0r Sorry, this is caused by a hardware problem, we are thinking about a solution, it will take some time.

After short investigation i found that with device whitelisted and advertising set to connect whitelisted only i am getting GATT ERROR 0x85 on android. http://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/534737#

Maybe its not esp32 issue at the end, i will try to connect with another esp32.

@jkhax0r any movement on this ticket? Has anyone else implemented a manual whitelisting in the meantime?

hi all: Sorry, whitelist have a bug. We will find the cause and fix it.