• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

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

system/bt


Commit MetaInfo

修訂461f0b4739967d60a3c6ee2b03ad86fc5abb2e99 (tree)
時間2019-06-06 23:11:15
作者Jakub Pawlowski <jpawlowski@goog...>
CommiterJakub Pawlowski

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

Change Summary

差異

--- a/stack/btu/btu_hcif.cc
+++ b/stack/btu/btu_hcif.cc
@@ -719,6 +719,15 @@ constexpr uint8_t MIN_KEY_SIZE = 7;
719719
720720 static void read_encryption_key_size_complete_after_encryption_change(
721721 uint8_t status, uint16_t handle, uint8_t key_size) {
722+ if (status == HCI_ERR_INSUFFCIENT_SECURITY) {
723+ /* If remote device stop the encryption before we call "Read Encryption Key
724+ * Size", we might receive Insufficient Security, which means that link is
725+ * no longer encrypted. */
726+ HCI_TRACE_WARNING("%s encryption stopped on link: 0x%02x", __func__,
727+ handle);
728+ return;
729+ }
730+
722731 if (status != HCI_SUCCESS) {
723732 HCI_TRACE_WARNING("%s: disconnecting, status: 0x%02x", __func__, status);
724733 btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER);
@@ -1679,6 +1688,15 @@ static void btu_hcif_enhanced_flush_complete_evt(void) {
16791688
16801689 static void read_encryption_key_size_complete_after_key_refresh(
16811690 uint8_t status, uint16_t handle, uint8_t key_size) {
1691+ if (status == HCI_ERR_INSUFFCIENT_SECURITY) {
1692+ /* If remote device stop the encryption before we call "Read Encryption Key
1693+ * Size", we might receive Insufficient Security, which means that link is
1694+ * no longer encrypted. */
1695+ HCI_TRACE_WARNING("%s encryption stopped on link: 0x%02x", __func__,
1696+ handle);
1697+ return;
1698+ }
1699+
16821700 if (status != HCI_SUCCESS) {
16831701 HCI_TRACE_WARNING("%s: disconnecting, status: 0x%02x", __func__, status);
16841702 btsnd_hcic_disconnect(handle, HCI_ERR_PEER_USER);