• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

Revisión06dd68690a893a906f4c40d245b531f77d741e6f (tree)
Tiempo2019-08-08 00:09:29
AutorJakub Pawlowski <jpawlowski@goog...>
CommiterVasyl Gello

Log Message

DO NOT MERGE Fix for Bluetooth connection being dropped after HCI Read Encryption Key Size

If remote device stop the encryption before we call "Read Encryption Key Size",
we might receive Insufficient Security, which means that link is no longer
encrypted.

In such cases we should stay connected, rather than disconnecting the
link.

Test: Connect to device that stop encryption right after encryption is
complete, i.e. to change roles.
Bug: 124301137
Bug: 132626699

Change-Id: Iab0fd9f357d18a6b048b971d0393fbb47fd4d793
Merged-In: Iab0fd9f357d18a6b048b971d0393fbb47fd4d793
(cherry picked from commit c5aa5feebf558df160772fefaf271a6f3251e261)

Cambiar Resumen

Diferencia incremental

--- a/stack/btu/btu_hcif.c
+++ b/stack/btu/btu_hcif.c
@@ -611,6 +611,15 @@ bool read_key_send_from_key_refresh = false;
611611
612612 static void read_encryption_key_size_complete_after_key_refresh(
613613 uint8_t status, uint16_t handle, uint8_t key_size) {
614+ if (status == HCI_ERR_INSUFFCIENT_SECURITY) {
615+ /* If remote device stop the encryption before we call "Read Encryption Key
616+ * Size", we might receive Insufficient Security, which means that link is
617+ * no longer encrypted. */
618+ HCI_TRACE_WARNING("%s encryption stopped on link: 0x%02x", __func__,
619+ handle);
620+ return;
621+ }
622+
614623 if (status != HCI_SUCCESS) {
615624 HCI_TRACE_WARNING("%s: disconnecting, status: 0x%02x", __func__, status);
616625 btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER);
@@ -633,6 +642,15 @@ static void read_encryption_key_size_complete_after_key_refresh(
633642
634643 static void read_encryption_key_size_complete_after_encryption_change(
635644 uint8_t status, uint16_t handle, uint8_t key_size) {
645+ if (status == HCI_ERR_INSUFFCIENT_SECURITY) {
646+ /* If remote device stop the encryption before we call "Read Encryption Key
647+ * Size", we might receive Insufficient Security, which means that link is
648+ * no longer encrypted. */
649+ HCI_TRACE_WARNING("%s encryption stopped on link: 0x%02x", __func__,
650+ handle);
651+ return;
652+ }
653+
636654 if (status != HCI_SUCCESS) {
637655 HCI_TRACE_WARNING("%s: disconnecting, status: 0x%02x", __func__, status);
638656 btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER);