summaryrefslogtreecommitdiff
path: root/mesh
diff options
context:
space:
mode:
authorIsak Westin <isak.westin@loytec.com>2022-10-06 16:59:24 +0200
committerBrian Gix <brian.gix@intel.com>2022-10-06 13:56:21 -0700
commit77da94eb7a8c8cbeb6db0e0ce31501d08f02ca86 (patch)
tree14836332f57eef1fd377edc008c00a72b1691f86 /mesh
parentc1f1a49aeb1518fa8a808e107573399acab2bd86 (diff)
downloadbluez-77da94eb7a8c8cbeb6db0e0ce31501d08f02ca86.tar.gz
mesh: provisionee: Handle failed provisioning
When a provisioning fails, all additionally received PDU should be unexpected until link is closed by provisioner. See MshPRFv1.0.1 section 5.4.4.
Diffstat (limited to 'mesh')
-rw-r--r--mesh/prov-acceptor.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mesh/prov-acceptor.c b/mesh/prov-acceptor.c
index ac257b170..0cefb2fa9 100644
--- a/mesh/prov-acceptor.c
+++ b/mesh/prov-acceptor.c
@@ -70,6 +70,7 @@ struct mesh_prov_acceptor {
uint8_t material;
uint8_t expected;
int8_t previous;
+ bool failed;
struct conf_input conf_inputs;
uint8_t calc_key[16];
uint8_t salt[16];
@@ -408,7 +409,8 @@ static void acp_prov_rx(void *user_data, const uint8_t *data, uint16_t len)
if (type == prov->previous) {
l_error("Ignore repeated %2.2x packet", type);
return;
- } else if (type > prov->expected || type < prov->previous) {
+ } else if (prov->failed || type > prov->expected ||
+ type < prov->previous) {
l_error("Expected %2.2x, Got:%2.2x", prov->expected, type);
fail.reason = PROV_ERR_UNEXPECTED_PDU;
goto failure;
@@ -648,6 +650,8 @@ static void acp_prov_rx(void *user_data, const uint8_t *data, uint16_t len)
failure:
fail.opcode = PROV_FAILED;
prov_send(prov, &fail, sizeof(fail));
+ prov->failed = true;
+ prov->previous = -1;
if (prov->cmplt)
prov->cmplt(prov->caller_data, fail.reason, NULL);
prov->cmplt = NULL;
@@ -707,6 +711,7 @@ bool acceptor_start(uint8_t num_ele, uint8_t uuid[16],
prov->cmplt = complete_cb;
prov->ob = l_queue_new();
prov->previous = -1;
+ prov->failed = false;
prov->out_opcode = PROV_NONE;
prov->caller_data = caller_data;