2020-03-13 18:10:12

by Stotland, Inga

[permalink] [raw]
Subject: [PATCH BlueZ 0/2] Remote node reset implementation

This set of patches provides complete implementation of sending
and processing of Config Node Reset and Config Node Reset Status
messages

Inga Stotland (2):
tools/mesh-cfgclient: Implement node-reset command
mesh: Fix processing of Config Node Reset message

mesh/cfgmod-server.c | 14 ++++----
tools/mesh-cfgclient.c | 77 ++++++++++++++++--------------------------
tools/mesh/cfgcli.c | 60 ++++++++++++++++++++++++++++----
tools/mesh/cfgcli.h | 4 ++-
tools/mesh/mesh-db.c | 39 +++++++++++++++++++++
tools/mesh/remote.c | 20 +++++++++++
tools/mesh/remote.h | 1 +
7 files changed, 154 insertions(+), 61 deletions(-)

--
2.21.1


2020-03-13 18:11:59

by Stotland, Inga

[permalink] [raw]
Subject: [PATCH BlueZ 2/2] mesh: Fix processing of Config Node Reset message

This fixes a condition when a node continues processing messages
after it has been reset by a remote configuration client.
Upon receiving Config Node Reset message, a node deregisters it's
message receive callbacks and a complete node removal happens after
a grace interval to allow sending of Config Node Reset Status reply.
---
mesh/cfgmod-server.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index a1f682765..6499c3f2f 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -1223,20 +1223,20 @@ static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx,

case OP_NODE_RESET:
n = mesh_model_opcode_set(OP_NODE_RESET_STATUS, msg);
- /*
- * Delay node removal to give it a chance to send back the
- * status
- */
+
+ /* After reset, node is not processing any incoming messages */
+ mesh_net_detach(net);
+
+ /* Delay node removal to give it a chance to send the status */
l_timeout_create(1, node_reset, node, NULL);
break;
}

- if (n) {
- /* print_packet("App Tx", long_msg ? long_msg : msg, n); */
+ if (n)
mesh_model_send(node, dst, src,
APP_IDX_DEV_LOCAL, net_idx, DEFAULT_TTL,
long_msg ? long_msg : msg, n);
- }
+
l_free(long_msg);

return true;
--
2.21.1