summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2020-05-08 17:00:21 -0700
committerAbhay Agarwal <ay.agarwal@samsung.com>2020-05-22 09:53:43 +0530
commit16f6fc05cf123491873484075f1d98c0882347c5 (patch)
tree57967904de0b6561761cca12a9f400c38cdfbc36
parent3e06627d0ff4d47f13d0433456f052c408d2066c (diff)
downloadbluez-16f6fc05cf123491873484075f1d98c0882347c5.tar.gz
bluez-16f6fc05cf123491873484075f1d98c0882347c5.tar.bz2
bluez-16f6fc05cf123491873484075f1d98c0882347c5.zip
mesh: On node attach, verify element/model composition only
When attaching an existing node, verify only the "elements" part of device composition, i.e., skip verification of CID/PID/VID, CRPL and features. Change-Id: I0cc22ce1fe0128bdbb93abe2811ef5558807b2c4 Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
-rw-r--r--mesh/node.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/mesh/node.c b/mesh/node.c
index 07620335..179552e8 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -1378,7 +1378,7 @@ static bool check_req_node(struct managed_obj_request *req)
{
uint8_t node_comp[MAX_MSG_LEN - 2];
uint8_t attach_comp[MAX_MSG_LEN - 2];
-
+ uint16_t offset = 10;
uint16_t node_len = node_generate_comp(req->node, node_comp,
sizeof(node_comp));
@@ -1389,12 +1389,10 @@ static bool check_req_node(struct managed_obj_request *req)
uint16_t attach_len = node_generate_comp(req->attach,
attach_comp, sizeof(attach_comp));
- /* Ignore feature bits in Composition Compare */
- node_comp[8] = 0;
- attach_comp[8] = 0;
-
+ /* Verify only element/models composition */
if (node_len != attach_len ||
- memcmp(node_comp, attach_comp, node_len)) {
+ memcmp(&node_comp[offset], &attach_comp[offset],
+ node_len - offset)) {
l_debug("Failed to verify app's composition data");
return false;
}