mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-17 22:49:55 +00:00
mesh: cfg_srv: Ignore Prohibited element addresses
The Configuration Model specification states that all non-unicast addresses given as the address of an element are Prohibited. The correct action for Prohibited parameter values is to ignore the message. As of writing this patch the PTS does not enforce this, but it might in the future (as it does for many other Prohibited values).
This commit is contained in:
@@ -1089,6 +1089,11 @@ static void mod_pub_get(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
mod_id = buf->om_data;
|
||||
|
||||
BT_DBG("elem_addr 0x%04x", elem_addr);
|
||||
@@ -1132,6 +1137,11 @@ static void mod_pub_set(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
pub_addr = net_buf_simple_pull_le16(buf);
|
||||
pub_app_idx = net_buf_simple_pull_le16(buf);
|
||||
cred_flag = ((pub_app_idx >> 12) & BIT_MASK(1));
|
||||
@@ -1270,6 +1280,11 @@ static void mod_pub_va_set(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
label_uuid = buf->om_data;
|
||||
net_buf_simple_pull(buf, 16);
|
||||
|
||||
@@ -1338,6 +1353,11 @@ static void mod_pub_va_set(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
net_buf_simple_pull(buf, 16);
|
||||
mod_id = net_buf_simple_pull(buf, 4);
|
||||
|
||||
@@ -1414,6 +1434,11 @@ static void mod_sub_add(struct bt_mesh_model *model,
|
||||
int i;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
sub_addr = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("elem_addr 0x%04x, sub_addr 0x%04x", elem_addr, sub_addr);
|
||||
@@ -1484,6 +1509,11 @@ static void mod_sub_del(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
sub_addr = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("elem_addr 0x%04x sub_addr 0x%04x", elem_addr, sub_addr);
|
||||
@@ -1544,6 +1574,11 @@ static void mod_sub_overwrite(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
sub_addr = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("elem_addr 0x%04x sub_addr 0x%04x", elem_addr, sub_addr);
|
||||
@@ -1608,6 +1643,10 @@ static void mod_sub_del_all(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
BT_DBG("elem_addr 0x%04x", elem_addr);
|
||||
|
||||
@@ -1657,6 +1696,11 @@ static void mod_sub_get(struct bt_mesh_model *model,
|
||||
int i;
|
||||
|
||||
addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("addr 0x%04x id 0x%04x", addr, id);
|
||||
@@ -1712,6 +1756,11 @@ static void mod_sub_get_vnd(struct bt_mesh_model *model,
|
||||
int i;
|
||||
|
||||
addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
company = net_buf_simple_pull_le16(buf);
|
||||
id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
@@ -1773,6 +1822,11 @@ static void mod_sub_va_add(struct bt_mesh_model *model,
|
||||
int i;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
label_uuid = buf->om_data;
|
||||
net_buf_simple_pull(buf, 16);
|
||||
|
||||
@@ -1846,6 +1900,11 @@ static void mod_sub_va_del(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
label_uuid = buf->om_data;
|
||||
net_buf_simple_pull(buf, 16);
|
||||
|
||||
@@ -1909,6 +1968,11 @@ static void mod_sub_va_overwrite(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
label_uuid = buf->om_data;
|
||||
net_buf_simple_pull(buf, 16);
|
||||
mod_id = buf->om_data;
|
||||
@@ -1970,6 +2034,11 @@ static void mod_sub_va_add(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
net_buf_simple_pull(buf, 16);
|
||||
|
||||
mod_id = buf->om_data;
|
||||
@@ -2006,6 +2075,11 @@ static void mod_sub_va_del(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
net_buf_simple_pull(buf, 16);
|
||||
|
||||
mod_id = buf->om_data;
|
||||
@@ -2040,6 +2114,11 @@ static void mod_sub_va_overwrite(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
net_buf_simple_pull(buf, 18);
|
||||
|
||||
mod_id = buf->om_data;
|
||||
@@ -2453,6 +2532,11 @@ static void mod_app_bind(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
key_app_idx = net_buf_simple_pull_le16(buf);
|
||||
mod_id = buf->om_data;
|
||||
|
||||
@@ -2508,6 +2592,11 @@ static void mod_app_unbind(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
key_app_idx = net_buf_simple_pull_le16(buf);
|
||||
mod_id = buf->om_data;
|
||||
|
||||
@@ -2557,6 +2646,11 @@ static void mod_app_get(struct bt_mesh_model *model,
|
||||
bool vnd;
|
||||
|
||||
elem_addr = net_buf_simple_pull_le16(buf);
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(elem_addr)) {
|
||||
BT_WARN("Prohibited element address");
|
||||
return;
|
||||
}
|
||||
|
||||
mod_id = buf->om_data;
|
||||
|
||||
BT_DBG("elem_addr 0x%04x", elem_addr);
|
||||
|
||||
Reference in New Issue
Block a user