ble_mesh: Provisioner ignores msg from removed node

This commit is contained in:
lly 2020-02-19 18:16:16 +08:00
parent f3c3605fc2
commit cc19e1da9b

View file

@ -1394,6 +1394,24 @@ static bool ready_to_recv(void)
return false;
}
static bool ignore_net_msg(u16_t src, u16_t dst)
{
if (IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) &&
bt_mesh_is_provisioner_en() &&
BLE_MESH_ADDR_IS_UNICAST(dst) &&
bt_mesh_elem_find(dst)) {
/* If the destination address of the message is the element
* address of Provisioner, but Provisioner fails to find the
* node in its provisioning database, then this message will
* be ignored.
*/
if (!bt_mesh_provisioner_get_node_with_addr(src)) {
return true;
}
}
return false;
}
void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi,
enum bt_mesh_net_if net_if)
{
@ -1411,6 +1429,10 @@ void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi,
return;
}
if (ignore_net_msg(rx.ctx.addr, rx.ctx.recv_dst)) {
return;
}
/* Save the state so the buffer can later be relayed */
net_buf_simple_save(&buf, &state);