From ebf1a3c661678cbd1781e951a628623a1b735f50 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 2 Nov 2017 15:20:07 +0200 Subject: [PATCH] Bluetooth: Mesh: Fix ignoring all prohibited sub_dst in HB Sub Set Section 4.2.18.2 in the Mesh Profile Specification states: "The Heartbeat Subscription Destination shall be the unassigned address, the primary unicast address of the node, or a group address, all other values are Prohibited." Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/mesh/cfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/mesh/cfg.c b/subsys/bluetooth/host/mesh/cfg.c index 509db7caa8e..818597ba32e 100644 --- a/subsys/bluetooth/host/mesh/cfg.c +++ b/subsys/bluetooth/host/mesh/cfg.c @@ -2820,7 +2820,9 @@ static void heartbeat_sub_set(struct bt_mesh_model *model, return; } - if (BT_MESH_ADDR_IS_VIRTUAL(sub_dst)) { + if (BT_MESH_ADDR_IS_VIRTUAL(sub_dst) || BT_MESH_ADDR_IS_RFU(sub_dst) || + (BT_MESH_ADDR_IS_UNICAST(sub_dst) && + sub_dst != bt_mesh_primary_addr())) { BT_WARN("Prohibited destination address"); return; }