Bluetooth: Mesh: Drop invalid destination addresses
This is required to pass certain PTS tests. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
95d28e53bb
commit
5363f6e765
|
@ -12,6 +12,7 @@
|
|||
#define BT_MESH_ADDR_IS_UNICAST(addr) ((addr) && (addr) < 0x8000)
|
||||
#define BT_MESH_ADDR_IS_GROUP(addr) ((addr) >= 0xc000 && (addr) <= 0xff00)
|
||||
#define BT_MESH_ADDR_IS_VIRTUAL(addr) ((addr) >= 0x8000 && (addr) < 0xc000)
|
||||
#define BT_MESH_ADDR_IS_RFU(addr) ((addr) >= 0xff00 && (addr) <= 0xfffb)
|
||||
|
||||
struct bt_mesh_net;
|
||||
|
||||
|
|
|
@ -1135,6 +1135,16 @@ int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if,
|
|||
|
||||
BT_DBG("Decryption successful. Payload len %u", buf->len);
|
||||
|
||||
if (rx->dst == BT_MESH_ADDR_UNASSIGNED) {
|
||||
BT_ERR("Destination address is unassigned; dropping packet");
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
if (BT_MESH_ADDR_IS_RFU(rx->dst)) {
|
||||
BT_ERR("Destination address is RFU; dropping packet");
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
if (net_if != BT_MESH_NET_IF_LOCAL && bt_mesh_elem_find(rx->ctx.addr)) {
|
||||
BT_DBG("Dropping locally originated packet");
|
||||
return -EBADMSG;
|
||||
|
|
Loading…
Reference in a new issue