Bluetooth: Mesh: Fix sending messages when not provisioned
The message sending APIs should fail cleanly if we are not yet
provisioned.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
diff --git a/subsys/bluetooth/host/mesh/access.c b/subsys/bluetooth/host/mesh/access.c
index 082db51..1c13b83 100644
--- a/subsys/bluetooth/host/mesh/access.c
+++ b/subsys/bluetooth/host/mesh/access.c
@@ -454,6 +454,11 @@
ctx->app_idx, ctx->addr);
BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len));
+ if (!bt_mesh_is_provisioned()) {
+ BT_ERR("Local node is not yet provisioned");
+ return -EAGAIN;
+ }
+
if (net_buf_simple_tailroom(msg) < 4) {
BT_ERR("Not enough tailroom for TransMIC");
return -EINVAL;