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 <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-09-28 18:05:01 +03:00 committed by Johan Hedberg
commit 4d3a2c66d1

View file

@ -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");
}
}