Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2068824ybi; Mon, 1 Jul 2019 05:40:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYyzHGH/v0lt7y+OxE0kCjWQOyzXZyveBEVn9sKa8/6VWFExgeza6VNUzbqlPjJeXS3P3g X-Received: by 2002:a63:1c09:: with SMTP id c9mr25321881pgc.63.1561984849267; Mon, 01 Jul 2019 05:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561984849; cv=none; d=google.com; s=arc-20160816; b=k2puvDeTlXydT3mp37gYkOr9s4L03e7tCXthq1hll0tCsMuNlYiE+AEKjQH0BUr0xa zGtBF4tUAbP6mrTvyTKDLCBAOKwr1QzC3688RSkISKz4rrPWjsqBHL0YovKjVcTZ3vWV YgXmUpvraqEKBCnsT8+XUB8J93IEcOrpwaXSeLVcfkX9EwUj2CSJDB+QYuEnZptX4hfM s8N6o1zfGTVL1ZR26fsTgmLpzqd6hBMNVQHsFof7RaeXXqiLyMCpkkcD7IT/h+0AeRqm sWByELXUqzCvmAxS2VUsR3RC6+4BYcH5fouCWFEyuGiecJyEm8Uzb5sSsWLnKaJGpU8v 1aTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Rk1hxN298wSgW38dEL3iCkPIATZDRLPpC+yUXoOiHfU=; b=BlhAxKD425hBjzIVfhE3jKUp65AWf9NlHJngi7ovtf08PeoIQ2zx7O4rflPZ5+zwPn 8lGHcweq4W8XYzfn68GKDg51nqBb89YIltbs7YpLqvGOzR4FXLgOsvvqT+4ZDtaeNEni FD4BnI7T2/9xfMTb+ciPYQ7GvrJwe7NyzIyc3+efxMtl4zzkzvTNwco/T4Rt+skZfH2i NZ+wXWL9gXH6iCkRmQswm8LZ3wfdaI+i5L+HakJcX+5jJBDfOjOYE4bNu/OF40DDQ4aR LUTlrZoRvmIvuknRzWrRHRIYK25k8KWTgdhv/xz3sDIfxUQRZBCdPLnYscOuEkDdpbud 1njw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=YNPeSJ3T; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g69si10131566pgc.159.2019.07.01.05.40.28; Mon, 01 Jul 2019 05:40:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=YNPeSJ3T; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728533AbfGALmt (ORCPT + 99 others); Mon, 1 Jul 2019 07:42:49 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:44552 "EHLO mail-wr1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727296AbfGALmt (ORCPT ); Mon, 1 Jul 2019 07:42:49 -0400 Received: by mail-wr1-f48.google.com with SMTP id e3so3931360wrs.11 for ; Mon, 01 Jul 2019 04:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silvair-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Rk1hxN298wSgW38dEL3iCkPIATZDRLPpC+yUXoOiHfU=; b=YNPeSJ3Tlj9ZrClSldeD7fHW/Sc2V6UsZy46HEp9mT1kMO4J26sWGd+yAKeSqVwFpz CrsQ/sahVDM2gaNFmG0Q6VgeK09ktPrk2rHmVOppaaVx/YcjblK+KDDrqFqia/9pqcYF n/slY8g1h7CGrpprVyfJOuopcOH9OZf7/3Zs7FEM3h2ub2NaS9PqdDmPrfl1PhVd1qQ2 +ukISlv/qxW1WCqkk1nw0j4Aq1+SuEul9pOwiSLRBVxG3JaepQ4WwtgVNh+cHZeUKORR gCIxygGOwGoPi3Md4WyX5hNfAluqQ1xDT9pNwESB5l9QyjtD6xwJExivEXl9vtbjSr/L cOWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Rk1hxN298wSgW38dEL3iCkPIATZDRLPpC+yUXoOiHfU=; b=kNg2dbs7D8//lQsQ1MGQimRX5lbFyPW0wcKZw+mKHMcq4Q/UUYresFWx6BeDOa8jYf PgJrcyFCf4XqcqxicF0ojTurH01Q6/CFwiXndwj0X6LP1QSqr0qkKOXFJ0oHfXZbl1F0 WncpQEtpJ63PtUi2uYXu4D91TMH6OmoRBzPhXWf5MFiqC5zh3i8RYwOldfb99zKPC0Ve rmM4PNSfFuzDadzMXUVB7nlQUckw9D+68bxlkW0Ej4qNuOKwyT8M6I1XB/xyWKDBrd5H 3h3EpVpDRgnbF/d4GD3Ry/lAV6Ui2t8eKVT+ZrvANV7zL2bmv4zc+tqlnmqCzzYB+pro hZFQ== X-Gm-Message-State: APjAAAW/qPROpnqEpaEmoVFAj69BtFhJ+FtV6h7JFFjBNemR9szdXvcp Jz+v8AVcZJ6X/9Uf1Oj5Wf0TmJA9/tg= X-Received: by 2002:a5d:4484:: with SMTP id j4mr9649006wrq.143.1561981366592; Mon, 01 Jul 2019 04:42:46 -0700 (PDT) Received: from localhost.localdomain ([217.153.94.18]) by smtp.gmail.com with ESMTPSA id w6sm8921268wrp.67.2019.07.01.04.42.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 01 Jul 2019 04:42:46 -0700 (PDT) From: Jakub Witowski To: linux-bluetooth@vger.kernel.org Cc: Inga Stotland Subject: [PATCH] mesh: Allow to set-up the CRPL with application Date: Mon, 1 Jul 2019 13:42:39 +0200 Message-Id: <20190701114239.8792-1-jakub.witowski@silvair.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This implementation adds possibility of adding CRPL to the node via application in the same way as CIP VID or PID. --- doc/mesh-api.txt | 4 ++++ mesh/node.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/mesh-api.txt b/doc/mesh-api.txt index 4e0a8bff1..45fc431fa 100644 --- a/doc/mesh-api.txt +++ b/doc/mesh-api.txt @@ -724,6 +724,10 @@ Properties: A 16-bit vendor-assigned product version identifier + uint16 CRPL [read-only] + + A 16-bit reply protection value + Mesh Element Hierarchy ====================== diff --git a/mesh/node.c b/mesh/node.c index 4e35bb3ff..9372d540a 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -55,7 +55,6 @@ /* Default element location: unknown */ #define DEFAULT_LOCATION 0x0000 -#define DEFAULT_CRPL 10 #define DEFAULT_SEQUENCE_NUMBER 0 #define REQUEST_TYPE_JOIN 0 @@ -1302,7 +1301,6 @@ static void set_defaults(struct mesh_node *node) if (!node->comp) node->comp = l_new(struct node_composition, 1); - node->comp->crpl = DEFAULT_CRPL; node->lpn = MESH_MODE_UNSUPPORTED; node->proxy = MESH_MODE_UNSUPPORTED; node->friend = MESH_MODE_UNSUPPORTED; @@ -1359,6 +1357,16 @@ static bool get_app_properties(struct mesh_node *node, const char *path, return false; node->comp->vid = value; + + } else if (!strcmp(key, "CRPL")) { + if (!l_dbus_message_iter_get_variant(&variant, "q", + &value)) + return false; + + if (!is_new && node->comp->crpl != value) + return false; + + node->comp->crpl = value; } } -- 2.20.1