From 91acdc4a877f1c88f835320c02d5876cc50ae4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Thu, 5 Jul 2018 18:15:13 +0200 Subject: [PATCH] mesh: Fix checking for model subscription address Previously the code only checked if any of the models within an element had the destination address in their subscription list. After that check the specific model that the message was addressed to was not verified to have that address in it's subscription list. This patch fixes the problem. --- nimble/host/mesh/src/access.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nimble/host/mesh/src/access.c b/nimble/host/mesh/src/access.c index 753472677..b06234a46 100644 --- a/nimble/host/mesh/src/access.c +++ b/nimble/host/mesh/src/access.c @@ -547,9 +547,7 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct os_mbuf *buf) } } else if (BT_MESH_ADDR_IS_GROUP(rx->ctx.recv_dst) || BT_MESH_ADDR_IS_VIRTUAL(rx->ctx.recv_dst)) { - if (!bt_mesh_elem_find_group(elem, rx->ctx.recv_dst)) { - continue; - } + /* find_op() will do proper model/group matching */ } else if (i != 0 || !bt_mesh_fixed_group_match(rx->ctx.recv_dst)) { continue; @@ -567,8 +565,8 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct os_mbuf *buf) count = elem->vnd_model_count; } - op = find_op(models, count, rx->ctx.recv_dst, - rx->ctx.app_idx, opcode, &model); + op = find_op(models, count, rx->ctx.recv_dst, rx->ctx.app_idx, + opcode, &model); if (op) { struct net_buf_simple_state state;