diff --git a/apps/mesh_badge/src/mesh.c b/apps/mesh_badge/src/mesh.c index b19eeafbc..ee999172b 100644 --- a/apps/mesh_badge/src/mesh.c +++ b/apps/mesh_badge/src/mesh.c @@ -27,8 +27,6 @@ static struct ble_npl_callout hello_work; static struct ble_npl_callout mesh_start_work; -struct bt_mesh_hb_cb hb_cb; - static void heartbeat(const struct bt_mesh_hb_sub *sub, uint8_t hops, uint16_t feat) { diff --git a/nimble/host/mesh/src/net.c b/nimble/host/mesh/src/net.c index 5db7b50bc..c19a53570 100644 --- a/nimble/host/mesh/src/net.c +++ b/nimble/host/mesh/src/net.c @@ -456,10 +456,6 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct os_mbuf *buf, BT_DBG("Payload len %u: %s", buf->om_len, bt_hex(buf->om_data, buf->om_len)); BT_DBG("Seq 0x%06x", bt_mesh.seq); - if (tx->ctx->send_ttl == BT_MESH_TTL_DEFAULT) { - tx->ctx->send_ttl = bt_mesh_default_ttl_get(); - } - cred = net_tx_cred_get(tx); err = net_header_encode(tx, cred->nid, buf); if (err) { diff --git a/nimble/host/mesh/src/transport.c b/nimble/host/mesh/src/transport.c index c4ed5954a..66e1982f4 100644 --- a/nimble/host/mesh/src/transport.c +++ b/nimble/host/mesh/src/transport.c @@ -488,11 +488,7 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct os_mbuf *sdu, tx->started = 0; tx->ctl = !!ctl_op; - if (net_tx->ctx->send_ttl == BT_MESH_TTL_DEFAULT) { - tx->ttl = bt_mesh_default_ttl_get(); - } else { - tx->ttl = net_tx->ctx->send_ttl; - } + tx->ttl = net_tx->ctx->send_ttl; BT_DBG("SeqZero 0x%04x (segs: %u)", (uint16_t)(tx->seq_auth & TRANS_SEQ_ZERO_MASK), tx->nack_count); @@ -627,6 +623,13 @@ int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct os_mbuf *msg, return -EINVAL; } + if (tx->ctx->send_ttl == BT_MESH_TTL_DEFAULT) { + tx->ctx->send_ttl = bt_mesh_default_ttl_get(); + } else if (tx->ctx->send_ttl > BT_MESH_TTL_MAX) { + BT_ERR("TTL too large (max 127)"); + return -EINVAL; + } + if (msg->om_len > BT_MESH_SDU_UNSEG_MAX) { tx->ctx->send_rel = 1; tx->ctx->send_rel = true; @@ -988,6 +991,13 @@ int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data, net_buf_simple_init_with_data(buf, data, data_len); + if (tx->ctx->send_ttl == BT_MESH_TTL_DEFAULT) { + tx->ctx->send_ttl = bt_mesh_default_ttl_get(); + } else if (tx->ctx->send_ttl > BT_MESH_TTL_MAX) { + BT_ERR("TTL too large (max 127)"); + return -EINVAL; + } + if (data_len > BT_MESH_SDU_UNSEG_MAX) { tx->ctx->send_rel = true; } diff --git a/nimble/host/mesh/syscfg.yml b/nimble/host/mesh/syscfg.yml index e7a3289e5..4a9fd40a1 100644 --- a/nimble/host/mesh/syscfg.yml +++ b/nimble/host/mesh/syscfg.yml @@ -473,34 +473,30 @@ syscfg.defs: Controls whether the Friend feature is enabled by default. Can be changed through runtime configuration. value: 1 - restrictions: BLE_MESH_FRIEND BLE_MESH_FRIEND_RECV_WIN: description: > Receive Window in milliseconds supported by the Friend node. value: 255 - restrictions: BLE_MESH_FRIEND BLE_MESH_FRIEND_QUEUE_SIZE: description: > Minimum number of buffers available to be stored for each local Friend Queue. value: 16 - restrictions: BLE_MESH_FRIEND BLE_MESH_FRIEND_SUB_LIST_SIZE: description: > Size of the Subscription List that can be supported by a Friend node for a Low Power node. value: 3 - restrictions: BLE_MESH_FRIEND BLE_MESH_FRIEND_LPN_COUNT: description: > Number of Low Power Nodes the Friend can have a Friendship with simultaneously. value: 2 - restrictions: BLE_MESH_FRIEND + BLE_MESH_FRIEND_SEG_RX: description: > @@ -509,7 +505,7 @@ syscfg.defs: many elements we can simultaneously be receiving segmented messages from when the messages are going into the Friend queue. value: 1 - restrictions: BLE_MESH_FRIEND + BLE_MESH_CFG_CLI: description: >