From 335440d8ad1b21429af4c191951dc87bbe4bdfd8 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 15 Oct 2020 11:49:42 +0200 Subject: [PATCH] node: ensure unique UUID for simple websocket nodes --- common | 2 +- lib/node.cpp | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/common b/common index dfd8bb232..3f3296e01 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit dfd8bb23202c554b74d622dff40fb1bf16ced6c8 +Subproject commit 3f3296e01752eddc02c077cb9a7e43171f69c75e diff --git a/lib/node.cpp b/lib/node.cpp index 230721e2a..c5650f503 100644 --- a/lib/node.cpp +++ b/lib/node.cpp @@ -166,14 +166,9 @@ int node_parse(struct vnode *n, json_t *json, const char *name) if (ret) throw ConfigError(json, "node-config-node-uuid", "Failed to parse UUID: {}", uuid); } - else { - /* Generate UUID from hashed config */ - char *json_str = json_dumps(json, JSON_COMPACT | JSON_SORT_KEYS); - - MD5((unsigned char*) json_str, strlen(json_str), (unsigned char*) &n->uuid); - - free(json_str); - } + else + /* Generate UUID from hashed config including node name */ + uuid_generate_from_json(n->uuid, json, name); if (json_netem) { #ifdef WITH_NETEM