[PATCH] mesh: Allow to set-up the CRPL with application

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux