From 4d3a2c66d158b801a794bab21ccf204e3754bcf5 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 28 Sep 2017 18:05:01 +0300 Subject: [PATCH] Bluetooth: Mesh: Fix Set LPNTimeout message handling We should ignore invalid addresses (helps pass MESH/NODE/CFG/LPNPT/BI-01-C). Also fix a copy-paste issue in an error log. Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/mesh/cfg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/mesh/cfg.c b/subsys/bluetooth/host/mesh/cfg.c index 02f573a966a..23047eba252 100644 --- a/subsys/bluetooth/host/mesh/cfg.c +++ b/subsys/bluetooth/host/mesh/cfg.c @@ -2489,12 +2489,17 @@ static void lpn_timeout_get(struct bt_mesh_model *model, BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x lpn_addr 0x%02x", ctx->net_idx, ctx->app_idx, ctx->addr, lpn_addr); + if (!BT_MESH_ADDR_IS_UNICAST(lpn_addr)) { + BT_WARN("Invalid LPNAddress; ignoring msg"); + return; + } + bt_mesh_model_msg_init(msg, OP_LPN_TIMEOUT_STATUS); net_buf_simple_add_le16(msg, lpn_addr); memset(net_buf_simple_add(msg, 3), 0, 3); if (bt_mesh_model_send(model, ctx, msg, NULL, NULL)) { - BT_ERR("Unable to send Friend Status"); + BT_ERR("Unable to send LPN PollTimeout Status"); } }