Closed alstrzebonski closed 1 year ago
Hi @alstrzebonski! We appreciate you submitting your first issue for our open-source project. 🌟
Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙
I agree that the same result should be expected regardless of CONFIG_BT_SETTINGS_CCC_LAZY_LOADING.
Might be fixed by https://github.com/zephyrproject-rtos/zephyr/pull/62985
Might be fixed by #62985
Yes, it fixes this issue, because now CCC cfg can be overwritten by peer that doesn't reestablish security which was not allowed earlier.
Describe the bug When previously bonded GATT client reconnects and
CONFIG_BT_SETTINGS_CCC_LAZY_LOADING
is enabled, CCC configuration is loaded from Settings. If GATT client had lost bond andCONFIG_BT_GATT_AUTO_SEC_REQ
is disabled, GATT client can stay connected without reestablishing security. However, when this GATT client tries to write CCC on previously used Attribute it can't do that and following log message appears:LOG_WRN("No space to store CCC cfg");
. It happens because thefind_ccc_cfg
function insubsys/bluetooth/host/gatt.c
returns error. That's because the existing CCC for the GATT client can't be overwritten as the security is not reestablished (as expected) and also there is no space to store new CCC configuration, becausecfg
array length instruct _bt_gatt_ccc
is set toCONFIG_BT_MAX_CONN
which is often equal to 1. WhenCONFIG_BT_SETTINGS_CCC_LAZY_LOADING
is disabled, thecfg
array length is set toCONFIG_BT_MAX_PAIRED + CONFIG_BT_MAX_CONN
and the issue doesn't replicate, because there is enough space to store new CCC configuration.To Reproduce Steps to reproduce the behavior:
zephyr/samples/bluetooth/peripheral
sample withBT_GATT_AUTO_SEC_REQ
disabled.No space to store CCC cfg
.You can verify that it doesn't reproduce if
CONFIG_BT_SETTINGS_CCC_LAZY_LOADING
is disabled.Expected behavior The CCC write should succeed regardless of
CONFIG_BT_SETTINGS_CCC_LAZY_LOADING
being enabled or no. The phone doesn't want to overwrite the existing CCC. It wants to write new one as it has lost bond.Impact Google Fast Pair Service protocol (https://developers.google.com/nearby/fast-pair/specifications/introduction) requires using GATT before bonding. Because of that, if a Phone loses bond, it is unable to bond again using Fast Pair, because it is unable to write CCC when
CONFIG_BT_SETTINGS_CCC_LAZY_LOADING
is enabled.Environment (please complete the following information):