Diff between 341456b547620f8062cfb439f4f7ecdc51eb3fa8 and cee1218397a633500cef9f51ee2b292748494770

Changed Files

File Additions Deletions Status
doc/mesh-api.txt +4 -0 modified
mesh/node.c +13 -5 modified

Full Patch

diff --git a/doc/mesh-api.txt b/doc/mesh-api.txt
index 4e0a8bf..893a1a6 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, optional]
+
+		A 16-bit minimum number of replay protection list entries
+
 
 Mesh Element Hierarchy
 ======================
diff --git a/mesh/node.c b/mesh/node.c
index 7383793..adc2aa9 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -1312,10 +1312,6 @@ static bool create_node_config(struct mesh_node *node)
 static void set_defaults(struct mesh_node *node)
 {
 	/* TODO: these values should come from mesh.conf */
-	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;
@@ -1338,8 +1334,10 @@ static bool get_app_properties(struct mesh_node *node, const char *path,
 
 	l_debug("path %s", path);
 
-	if (is_new)
+	if (is_new) {
 		node->comp = l_new(struct node_composition, 1);
+		node->comp->crpl = DEFAULT_CRPL;
+	}
 
 	while (l_dbus_message_iter_next_entry(properties, &key, &variant)) {
 
@@ -1372,6 +1370,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;
 		}
 	}