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>
This commit is contained in:
Johan Hedberg 2017-11-12 21:38:21 +02:00 committed by Johan Hedberg
commit 9cbb979db7

View file

@ -454,6 +454,11 @@ static int model_send(struct bt_mesh_model *model,
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;