zephyr/subsys/bluetooth/host
Dan Erichsen 6a12a2dbe1 bluetooth: host: Do not send unwanted SC indicate
Fixes #23485

When we create a GATT table dynamically, we also create a hash
identifying this table. This hash can be stored in persistent memory and
we can thus determine after recreating the GATT table whether the
services have changed or not from before the reboot.

When these hashes are identical, it implies that the table has not
changed, wherefore a service changed indication should not be sent to
any bonded clients. The method for achieving this was to remove the
gatt_sc.work entry from the work queue. This work queue entry was to
send an indication to the clients when the table had been allocated.
If the final entry then caused the hashes to match, the indication
would be cancelled.

On unit testing this behaviour in simulation and in practice, we found
that the indication was sent nonetheless, and the issue was located to
be tied to the SERVICE_RANGE_CHANGED flag which is set when the services
are changed and is cleared when the indications are being sent out.

It was the job of the work queue entry to clear this flag, and as the
entry was never serviced, the flag was never cleared, and when
sc_commit() is called at the end of the process, it believes that there
is a new service change pending and therefore starts the job over, thus
creating a redundant indication to the clients.

This commit fixes the issue by clearing the flag when the work entry
is removed due to a hash match. This has been unittested in a live
environment, in a simulation environment, and sanitycheck has been run
on it.

Signed-off-by: Dan Erichsen <daee@demant.com>
2020-03-16 21:09:24 +02:00
..
a2dp_internal.h
a2dp.c cleanup: include/: move misc/util.h to sys/util.h 2019-06-27 22:55:49 -04:00
aes_ccm.c Bluetooth: Move Mesh CCM into a separate module 2020-01-30 12:41:45 +02:00
at.c
at.h
att_internal.h Bluetooth: GATT: Allocate request from a memory slab 2020-01-09 19:20:21 +01:00
att.c Bluetooth: ATT: Fix ATT corrupting mem_slab structure after free 2020-01-28 17:55:38 +02:00
avdtp_internal.h
avdtp.c Bluetooth: L2CAP: Make channel ops const 2019-12-19 11:28:24 +02:00
CMakeLists.txt Bluetooth: Move Mesh CCM into a separate module 2020-01-30 12:41:45 +02:00
conn_internal.h Bluetooth: host: Fix missing connection id checks 2020-02-21 21:28:30 +02:00
conn.c Bluetooth: smp: Adding Legacy OOB only mode and no JW/Passkey mode 2020-03-12 12:30:15 +02:00
crypto.c Bluetooth: Fix infinite recursion in host-based bt_rand 2020-01-31 18:33:06 +01:00
crypto.h
ecc.h
gatt_internal.h Bluetooth: GATT: Use check_perm to check CCC permission 2019-09-19 21:12:39 +03:00
gatt.c bluetooth: host: Do not send unwanted SC indicate 2020-03-16 21:09:24 +02:00
hci_core.c Bluetooth: host: Allow get local OOB data while advertiser is enabled 2020-03-13 17:16:51 +02:00
hci_core.h Bluetooth: host: Handle starting roles with different random address 2020-01-20 18:58:02 +02:00
hci_ecc.c kernel: overhaul unused stack measurement 2020-02-08 10:02:35 +02:00
hci_ecc.h
hci_raw_internal.h
hci_raw.c Bluetooth: Always use full path to hci_driver.h 2020-01-16 19:20:39 -05:00
hfp_hf.c Bluetooth: Remove usage of BT_BUF_USER_DATA_MIN 2019-11-28 13:35:11 +02:00
hfp_internal.h
Kconfig Bluetooth: Kconfig: Fix BT_ECC defaults 2020-03-16 14:26:08 +02:00
Kconfig.gatt Bluetooth: GATT: Allocate request from a memory slab 2020-01-09 19:20:21 +01:00
Kconfig.l2cap kconfig: Replace some single-symbol 'if's with 'depends on' 2020-02-08 08:32:42 -05:00
keys_br.c cleanup: include/: move misc/util.h to sys/util.h 2019-06-27 22:55:49 -04:00
keys.c bluetooth: host: Fix simultaneous pairings getting the same keys slot 2020-01-31 12:50:03 +02:00
keys.h Bluetooth: host: Rethink how unpair all works 2020-01-04 14:10:46 +01:00
l2cap_br.c Bluetooth: Always use full path to hci_driver.h 2020-01-16 19:20:39 -05:00
l2cap_internal.h Bluetooth: L2CAP: Add destroy callback to fixed L2CAP channels 2020-01-28 17:55:38 +02:00
l2cap.c Bluetooth: L2CAP: Fix not queueing in case there are no credits 2020-02-10 22:08:14 +02:00
monitor.c bluetooth: monitor: don't build backend if minimal 2019-10-01 09:24:02 -04:00
monitor.h
rfcomm_internal.h Bluetooth: hci_raw: Add support for specifying buffer headroom 2019-11-20 19:29:06 +01:00
rfcomm.c kernel: overhaul unused stack measurement 2020-02-08 10:02:35 +02:00
sdp_internal.h
sdp.c Bluetooth: L2CAP: Make channel ops const 2019-12-19 11:28:24 +02:00
settings.c Bluetooth: Setting: Make bt_settings_encode_key take a const address 2020-02-14 14:15:11 +02:00
settings.h Bluetooth: Setting: Make bt_settings_encode_key take a const address 2020-02-14 14:15:11 +02:00
smp_null.c Bluetooth: L2CAP: Add destroy callback to fixed L2CAP channels 2020-01-28 17:55:38 +02:00
smp.c Bluetooth: host: Allow to initiate pairing without OOB present 2020-03-13 14:18:48 +02:00
smp.h Bluetooth: smp: Adding Legacy OOB pairing support 2020-03-12 12:30:15 +02:00
testing.c
testing.h
uuid.c Bluetooth: UUID: Expose bt_uuid_to_str to application 2019-12-09 17:15:05 +02:00