Bluetooth: Mesh: Fix DST field check when send
Add check for dst field in transport layer tx function. Fixes: #29868 Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
This commit is contained in:
parent
a2aad2b3f8
commit
7e302979f3
1 changed files with 13 additions and 0 deletions
|
@ -638,6 +638,13 @@ int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg,
|
|||
tx->ctx->send_rel = true;
|
||||
}
|
||||
|
||||
if (tx->ctx->addr == BT_MESH_ADDR_UNASSIGNED ||
|
||||
(!BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr) &&
|
||||
BT_MESH_IS_DEV_KEY(tx->ctx->app_idx))) {
|
||||
BT_ERR("Invalid destination address");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
BT_DBG("net_idx 0x%04x app_idx 0x%04x dst 0x%04x", tx->sub->net_idx,
|
||||
tx->ctx->app_idx, tx->ctx->addr);
|
||||
BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len));
|
||||
|
@ -1005,6 +1012,12 @@ int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data,
|
|||
|
||||
tx->ctx->app_idx = BT_MESH_KEY_UNUSED;
|
||||
|
||||
if (tx->ctx->addr == BT_MESH_ADDR_UNASSIGNED ||
|
||||
BT_MESH_ADDR_IS_VIRTUAL(tx->ctx->addr)) {
|
||||
BT_ERR("Invalid destination address");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
BT_DBG("src 0x%04x dst 0x%04x ttl 0x%02x ctl 0x%02x", tx->src,
|
||||
tx->ctx->addr, tx->ctx->send_ttl, ctl_op);
|
||||
BT_DBG("len %zu: %s", data_len, bt_hex(data, data_len));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue