Thread (25 messages) flat view 25 messages, 4 authors, 2021-09-27
STALE1819d

[PATCH BlueZ 03/20] tools/mesh-cfgclient: Update stored NetKey and AppKey

From: Inga Stotland <hidden>
Date: 2021-09-23 03:27:14
Subsystem: the rest · Maintainer: Linus Torvalds

NetKeys:
- Record additional properties: "name", "minSecurity", "timestamp"

AppKeys:
- Record additional property: "name"
---
 tools/mesh/mesh-db.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c
index d42587da8..5b3c4b2f7 100644
--- a/tools/mesh/mesh-db.c
+++ b/tools/mesh/mesh-db.c
@@ -517,6 +517,7 @@ static void load_remotes(json_object *jcfg)
 static bool add_app_key(json_object *jobj, uint16_t net_idx, uint16_t app_idx)
 {
 	json_object *jkey, *jarray;
+	char buf[12];
 
 	json_object_object_get_ex(jobj, "appKeys", &jarray);
 	if (!jarray || json_object_get_type(jarray) != json_type_array)
@@ -524,6 +525,11 @@ static bool add_app_key(json_object *jobj, uint16_t net_idx, uint16_t app_idx)
 
 	jkey = json_object_new_object();
 
+	snprintf(buf, 12, "AppKey %4.4x", app_idx);
+
+	if (!add_string(jkey, "name", buf))
+		goto fail;
+
 	if (!write_int(jkey, "boundNetKey", (int)net_idx))
 		goto fail;
 
@@ -721,6 +727,7 @@ static bool load_keys(json_object *jobj)
 bool mesh_db_net_key_add(uint16_t net_idx)
 {
 	json_object *jkey, *jarray;
+	char buf[12];
 
 	if (!cfg || !cfg->jcfg)
 		return false;
@@ -734,12 +741,20 @@ bool mesh_db_net_key_add(uint16_t net_idx)
 
 	jkey = json_object_new_object();
 
+	snprintf(buf, 12, "Subnet %4.4x", net_idx);
+
+	if (!add_string(jkey, "name", buf))
+		goto fail;
+
 	if (!write_int(jkey, "index", net_idx))
 		goto fail;
 
 	if (!write_int(jkey, "phase", KEY_REFRESH_PHASE_NONE))
 		goto fail;
 
+	if (!add_string(jkey, "minSecurity", "secure"))
+		goto fail;
+
 	if (!set_timestamp(jkey))
 		goto fail;
 
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help