summaryrefslogtreecommitdiff
path: root/system/stack
diff options
context:
space:
mode:
author Himanshu Rawat <rwt@google.com> 2025-01-24 10:42:48 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-01-24 10:42:48 -0800
commitffb94de004e38f171820e3797438c572826c2591 (patch)
tree267e52077941e624bf8b361a278f19b2d3bd61f4 /system/stack
parent2ebacca9bc3c2a737cf674d673113a6237ae1cfe (diff)
parent91c01fbab71b44de2471d28d8bd45e4676f55141 (diff)
Merge "Reject SMP pairing SMP_BUSY error while host is in pairing with another device" into main
Diffstat (limited to 'system/stack')
-rw-r--r--system/stack/include/smp_status.h28
-rw-r--r--system/stack/smp/smp_api.cc4
-rw-r--r--system/stack/smp/smp_utils.cc2
-rw-r--r--system/stack/test/stack_smp_test.cc6
4 files changed, 23 insertions, 17 deletions
diff --git a/system/stack/include/smp_status.h b/system/stack/include/smp_status.h
index 86670a5161..1d222ab419 100644
--- a/system/stack/include/smp_status.h
+++ b/system/stack/include/smp_status.h
@@ -41,25 +41,27 @@ typedef enum : uint8_t {
SMP_NUMERIC_COMPAR_FAIL = 0x0C,
SMP_BR_PARING_IN_PROGR = 0x0D,
SMP_XTRANS_DERIVE_NOT_ALLOW = 0x0E,
- SMP_MAX_FAIL_RSN_PER_SPEC = SMP_XTRANS_DERIVE_NOT_ALLOW,
+ SMP_KEY_REJECTED = 0x0F,
+ SMP_BUSY = 0x10, /*device is not ready to perform a pairing procedure*/
+ SMP_MAX_FAIL_RSN_PER_SPEC = SMP_BUSY,
/* self defined error code */
- SMP_PAIR_INTERNAL_ERR = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x01), /* 0x0F */
+ SMP_PAIR_INTERNAL_ERR = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x01), /* 0x11 */
/* Unknown IO capability, unable to decide association model */
- SMP_UNKNOWN_IO_CAP = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x02), /* 0x10 */
+ SMP_UNKNOWN_IO_CAP = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x02), /* 0x12 */
- SMP_BUSY = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x05), /* 0x13 */
- SMP_ENC_FAIL = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x06), /* 0x14 */
- SMP_STARTED = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x07), /* 0x15 */
- SMP_RSP_TIMEOUT = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x08), /* 0x16 */
+ SMP_IMPL_BUSY = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x05), /* 0x15 */
+ SMP_ENC_FAIL = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x06), /* 0x16 */
+ SMP_STARTED = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x07), /* 0x17 */
+ SMP_RSP_TIMEOUT = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x08), /* 0x18 */
/* Unspecified failure reason */
- SMP_FAIL = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0A), /* 0x18 */
+ SMP_FAIL = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0A), /* 0x1A */
- SMP_CONN_TOUT = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0B), /* 0x19 */
- SMP_SIRK_DEVICE_INVALID = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0C), /* 0x1a */
- SMP_USER_CANCELLED = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0D), /* 0x1b */
+ SMP_CONN_TOUT = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0B), /* 0x1B */
+ SMP_SIRK_DEVICE_INVALID = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0C), /* 0x1C */
+ SMP_USER_CANCELLED = (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0D), /* 0x1D */
} tSMP_STATUS;
inline std::string smp_status_text(const tSMP_STATUS& status) {
@@ -79,9 +81,11 @@ inline std::string smp_status_text(const tSMP_STATUS& status) {
CASE_RETURN_TEXT(SMP_NUMERIC_COMPAR_FAIL);
CASE_RETURN_TEXT(SMP_BR_PARING_IN_PROGR);
CASE_RETURN_TEXT(SMP_XTRANS_DERIVE_NOT_ALLOW);
+ CASE_RETURN_TEXT(SMP_KEY_REJECTED);
+ CASE_RETURN_TEXT(SMP_BUSY);
CASE_RETURN_TEXT(SMP_PAIR_INTERNAL_ERR);
CASE_RETURN_TEXT(SMP_UNKNOWN_IO_CAP);
- CASE_RETURN_TEXT(SMP_BUSY);
+ CASE_RETURN_TEXT(SMP_IMPL_BUSY);
CASE_RETURN_TEXT(SMP_ENC_FAIL);
CASE_RETURN_TEXT(SMP_STARTED);
CASE_RETURN_TEXT(SMP_RSP_TIMEOUT);
diff --git a/system/stack/smp/smp_api.cc b/system/stack/smp/smp_api.cc
index 0d66b0a064..a46f113aec 100644
--- a/system/stack/smp/smp_api.cc
+++ b/system/stack/smp/smp_api.cc
@@ -89,7 +89,7 @@ tSMP_STATUS SMP_Pair(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type) {
if (p_cb->state != SMP_STATE_IDLE || p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD ||
p_cb->smp_over_br) {
/* pending security on going, reject this one */
- return SMP_BUSY;
+ return SMP_IMPL_BUSY;
} else {
p_cb->flags = SMP_PAIR_FLAGS_WE_STARTED_DD;
p_cb->pairing_bda = bd_addr;
@@ -135,7 +135,7 @@ tSMP_STATUS SMP_BR_PairWith(const RawAddress& bd_addr) {
if (p_cb->state != SMP_STATE_IDLE || p_cb->smp_over_br ||
p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD) {
/* pending security on going, reject this one */
- return SMP_BUSY;
+ return SMP_IMPL_BUSY;
}
p_cb->role = HCI_ROLE_CENTRAL;
diff --git a/system/stack/smp/smp_utils.cc b/system/stack/smp/smp_utils.cc
index 81b005a78c..e5aefe3c6a 100644
--- a/system/stack/smp/smp_utils.cc
+++ b/system/stack/smp/smp_utils.cc
@@ -1231,7 +1231,7 @@ void smp_reject_unexpected_pairing_command(const RawAddress& bd_addr) {
p = (uint8_t*)(p_buf + 1) + L2CAP_MIN_OFFSET;
UINT8_TO_STREAM(p, SMP_OPCODE_PAIRING_FAILED);
- UINT8_TO_STREAM(p, SMP_PAIR_NOT_SUPPORT);
+ UINT8_TO_STREAM(p, SMP_BUSY);
p_buf->offset = L2CAP_MIN_OFFSET;
p_buf->len = SMP_PAIR_FAIL_SIZE;
diff --git a/system/stack/test/stack_smp_test.cc b/system/stack/test/stack_smp_test.cc
index 41d61e738b..8f020ae1c5 100644
--- a/system/stack/test/stack_smp_test.cc
+++ b/system/stack/test/stack_smp_test.cc
@@ -375,11 +375,13 @@ TEST(SmpStatusText, smp_status_text) {
std::make_pair(SMP_NUMERIC_COMPAR_FAIL, "SMP_NUMERIC_COMPAR_FAIL"),
std::make_pair(SMP_BR_PARING_IN_PROGR, "SMP_BR_PARING_IN_PROGR"),
std::make_pair(SMP_XTRANS_DERIVE_NOT_ALLOW, "SMP_XTRANS_DERIVE_NOT_ALLOW"),
+ std::make_pair(SMP_KEY_REJECTED, "SMP_KEY_REJECTED"),
+ std::make_pair(SMP_BUSY, "SMP_BUSY"),
std::make_pair(SMP_MAX_FAIL_RSN_PER_SPEC,
- "SMP_XTRANS_DERIVE_NOT_ALLOW"), // NOTE: Dup
+ "SMP_BUSY"), // NOTE: Dup
std::make_pair(SMP_PAIR_INTERNAL_ERR, "SMP_PAIR_INTERNAL_ERR"),
std::make_pair(SMP_UNKNOWN_IO_CAP, "SMP_UNKNOWN_IO_CAP"),
- std::make_pair(SMP_BUSY, "SMP_BUSY"),
+ std::make_pair(SMP_IMPL_BUSY, "SMP_IMPL_BUSY"),
std::make_pair(SMP_ENC_FAIL, "SMP_ENC_FAIL"),
std::make_pair(SMP_STARTED, "SMP_STARTED"),
std::make_pair(SMP_RSP_TIMEOUT, "SMP_RSP_TIMEOUT"),