From bcc140dbe65d67ab728a06986cadfb98bf1a006c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 2 Nov 2017 15:44:02 +0200 Subject: [PATCH] Bluetooth: Mesh: Fix sending heartbeat only when relay state changes The heartbeat should only be sent in case the relay state actually changes. This fixes MESH/NODE/CFG/HBP/BV-03-C. Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/mesh/cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/mesh/cfg.c b/subsys/bluetooth/host/mesh/cfg.c index e9f54abc399..ec5363d296e 100644 --- a/subsys/bluetooth/host/mesh/cfg.c +++ b/subsys/bluetooth/host/mesh/cfg.c @@ -894,6 +894,7 @@ static void relay_set(struct bt_mesh_model *model, if (!cfg) { BT_WARN("No Configuration Server context available"); } else if (buf->data[0] == 0x00 || buf->data[0] == 0x01) { + bool change = (cfg->relay != buf->data[0]); struct bt_mesh_subnet *sub; cfg->relay = buf->data[0]; @@ -905,7 +906,7 @@ static void relay_set(struct bt_mesh_model *model, TRANSMIT_INT(cfg->relay_retransmit)) sub = bt_mesh_subnet_get(cfg->hb_pub.net_idx); - if ((cfg->hb_pub.feat & BT_MESH_FEAT_RELAY) && sub) { + if ((cfg->hb_pub.feat & BT_MESH_FEAT_RELAY) && sub && change) { hb_send(model); } } else {