linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Inga Stotland <inga.stotland@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: brian.gix@intel.com, Inga Stotland <inga.stotland@intel.com>
Subject: [PATCH BlueZ 1/4] mesh: On node attach, verify element/model composition only
Date: Fri,  8 May 2020 17:00:21 -0700	[thread overview]
Message-ID: <20200509000024.5704-2-inga.stotland@intel.com> (raw)
In-Reply-To: <20200509000024.5704-1-inga.stotland@intel.com>

When attaching an existing node, verify only the "elements" part
of device composition, i.e., skip verification of CID/PID/VID, CRPL
and features.
---
 mesh/node.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index acda6d472..e3f9e52e3 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;
 		}
-- 
2.21.3


  reply	other threads:[~2020-05-09  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  0:00 [PATCH BlueZ 0/4] Allow some composition fields update Inga Stotland
2020-05-09  0:00 ` Inga Stotland [this message]
2020-05-09 13:49   ` [PATCH BlueZ 1/4] mesh: On node attach, verify element/model composition only Gix, Brian
2020-05-14 17:05   ` Gix, Brian
2020-05-09  0:00 ` [PATCH BlueZ 2/4] mesh: Avoid saving duplicate fields in node config Inga Stotland
2020-05-09  0:00 ` [PATCH BlueZ 3/4] mesh: Allow updating CID, PID, VID & CRPL on node attach Inga Stotland
2020-05-09  0:00 ` [PATCH BlueZ 4/4] mesh: Remove redundant call to save node configuration Inga Stotland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200509000024.5704-2-inga.stotland@intel.com \
    --to=inga.stotland@intel.com \
    --cc=brian.gix@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).