Skip to content

Commit 24d7e9e

Browse files
Johan Hedbergnashif
authored andcommitted
Bluetooth: Mesh: Fix provisioning send error handling
Log all send errors, but don't try to call e.g. prov_send_fail_msg() since that'll almost certainly fail as well. Signed-off-by: Johan Hedberg <[email protected]>
1 parent d4fd267 commit 24d7e9e

File tree

1 file changed

+11
-6
lines changed
  • subsys/bluetooth/host/mesh

1 file changed

+11
-6
lines changed

subsys/bluetooth/host/mesh/prov.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,10 @@ static void prov_send_fail_msg(u8_t err)
522522

523523
prov_buf_init(&buf, PROV_FAILED);
524524
net_buf_simple_add_u8(&buf, err);
525-
prov_send(&buf);
525+
526+
if (prov_send(&buf)) {
527+
BT_ERR("Failed to send Provisioning Failed message");
528+
}
526529

527530
atomic_set_bit(link.flags, LINK_INVALID);
528531
}
@@ -569,7 +572,6 @@ static void prov_invite(const u8_t *data)
569572

570573
if (prov_send(&buf)) {
571574
BT_ERR("Failed to send capabilities");
572-
prov_send_fail_msg(PROV_ERR_RESOURCES);
573575
return;
574576
}
575577

@@ -808,7 +810,6 @@ static void send_confirm(void)
808810

809811
if (prov_send(&cfm)) {
810812
BT_ERR("Failed to send Provisioning Confirm");
811-
prov_send_fail_msg(PROV_ERR_RESOURCES);
812813
return;
813814
}
814815

@@ -820,7 +821,9 @@ static void send_input_complete(void)
820821
PROV_BUF(buf, 1);
821822

822823
prov_buf_init(&buf, PROV_INPUT_COMPLETE);
823-
prov_send(&buf);
824+
if (prov_send(&buf)) {
825+
BT_ERR("Failed to send Provisioning Input Complete");
826+
}
824827
}
825828

826829
int bt_mesh_input_number(u32_t num)
@@ -1019,7 +1022,6 @@ static void prov_random(const u8_t *data)
10191022

10201023
if (prov_send(&rnd)) {
10211024
BT_ERR("Failed to send Provisioning Random");
1022-
prov_send_fail_msg(PROV_ERR_RESOURCES);
10231025
return;
10241026
}
10251027

@@ -1103,7 +1105,10 @@ static void prov_data(const u8_t *data)
11031105
net_idx, iv_index, addr);
11041106

11051107
prov_buf_init(&msg, PROV_COMPLETE);
1106-
prov_send(&msg);
1108+
if (prov_send(&msg)) {
1109+
BT_ERR("Failed to send Provisioning Complete");
1110+
return;
1111+
}
11071112

11081113
/* Ignore any further PDUs on this link */
11091114
link.expect = 0U;

0 commit comments

Comments
 (0)