From 8ae642a27c8df40d671ccbc8a90b6b19f1cdc474 Mon Sep 17 00:00:00 2001 From: Max Wache <54880394+lelouch94@users.noreply.github.com> Date: Sun, 7 Feb 2021 18:12:14 +0100 Subject: [PATCH 1/5] Add option to disable N2N (#1439) to disable the node to node transport feature --- MyConfig.h | 7 +++++++ core/MyTransport.cpp | 2 ++ keywords.txt | 1 + 3 files changed, 10 insertions(+) diff --git a/MyConfig.h b/MyConfig.h index 0aa451420..eb85e8908 100755 --- a/MyConfig.h +++ b/MyConfig.h @@ -1111,6 +1111,12 @@ #define MY_TRANSPORT_DISCOVERY_INTERVAL_MS (20*60*1000ul) #endif +/** + *@def MY_TRANSPORT_N2N_FEATURE_DISABLED + *@brief If defined, disables the direct node to node transport send attempts + */ +//#define MY_TRANSPORT_N2N_FEATURE_DISABLED + /** *@def MY_TRANSPORT_UPLINK_CHECK_DISABLED *@brief If defined, disables uplink check to GW during transport initialisation @@ -2313,6 +2319,7 @@ // transport #define MY_PARENT_NODE_IS_STATIC #define MY_REGISTRATION_CONTROLLER +#define MY_TRANSPORT_N2N_FEATURE_DISABLED #define MY_TRANSPORT_UPLINK_CHECK_DISABLED #define MY_TRANSPORT_SANITY_CHECK #define MY_NODE_LOCK_FEATURE diff --git a/core/MyTransport.cpp b/core/MyTransport.cpp index 4c91da55f..11bc80f33 100644 --- a/core/MyTransport.cpp +++ b/core/MyTransport.cpp @@ -545,6 +545,7 @@ bool transportRouteMessage(MyMessage &message) #endif } #else +#if !defined(MY_TRANSPORT_N2N_FEATURE_DISABLED) if (destination > GATEWAY_ADDRESS && destination < BROADCAST_ADDRESS) { // node2node traffic: assume node is in vincinity. If transmission fails, hand over to parent if (transportSendWrite(destination, message)) { @@ -553,6 +554,7 @@ bool transportRouteMessage(MyMessage &message) } TRANSPORT_DEBUG(PSTR("!TSF:RTE:N2N FAIL\n")); } +#endif route = _transportConfig.parentNodeId; // not a repeater, all traffic routed via parent #endif } diff --git a/keywords.txt b/keywords.txt index d63941799..4048df728 100755 --- a/keywords.txt +++ b/keywords.txt @@ -78,6 +78,7 @@ MY_TRANSPORT_TIMEOUT_EXT_FAILURE_STATE_MS LITERAL1 MY_TRANSPORT_TIMEOUT_FAILURE_STATE_MS LITERAL1 MY_TRANSPORT_UPLINK_CHECK_DISABLED LITERAL1 MY_TRANSPORT_WAIT_READY_MS LITERAL1 +MY_TRANSPORT_N2N_FEATURE_DISABLED LITERAL1 # debug MY_DEBUG LITERAL1 From 254756ccb66b95e441178ef9ae4171ee0738c171 Mon Sep 17 00:00:00 2001 From: Max Wache <54880394+lelouch94@users.noreply.github.com> Date: Sun, 28 Feb 2021 17:35:16 +0100 Subject: [PATCH 2/5] Extend comments on MY_TRANSPORT_N2N_FEATURE_DISABLED to describe the use case. --- MyConfig.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MyConfig.h b/MyConfig.h index eb85e8908..822e02cc3 100755 --- a/MyConfig.h +++ b/MyConfig.h @@ -1114,6 +1114,9 @@ /** *@def MY_TRANSPORT_N2N_FEATURE_DISABLED *@brief If defined, disables the direct node to node transport send attempts + * + * Use this function together with the option @ref MY_PARENT_NODE_IS_STATIC + * to ensure that all telegrams sent are routed exclusively through the associated parent node. */ //#define MY_TRANSPORT_N2N_FEATURE_DISABLED From 095339adca15dd4d836947763ccf6ad76ef38cdf Mon Sep 17 00:00:00 2001 From: Maximilian Wache <54880394+lelouch94@users.noreply.github.com> Date: Sun, 7 Mar 2021 19:23:55 +0100 Subject: [PATCH 3/5] Add log message for N2N feature disabled --- core/MyTransport.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/MyTransport.cpp b/core/MyTransport.cpp index 11bc80f33..561fe730e 100644 --- a/core/MyTransport.cpp +++ b/core/MyTransport.cpp @@ -554,6 +554,8 @@ bool transportRouteMessage(MyMessage &message) } TRANSPORT_DEBUG(PSTR("!TSF:RTE:N2N FAIL\n")); } +#else + TRANSPORT_DEBUG(PSTR("TSF:RTE:N2N DIS\n")); #endif route = _transportConfig.parentNodeId; // not a repeater, all traffic routed via parent #endif From 968a3e257c1a28d43549450e6ca275ce17d1a4d5 Mon Sep 17 00:00:00 2001 From: Maximilian Wache <54880394+lelouch94@users.noreply.github.com> Date: Fri, 12 Mar 2021 20:48:03 +0100 Subject: [PATCH 4/5] Add documentation entry for message N2N disabled --- core/MyTransport.h | 1 + 1 file changed, 1 insertion(+) diff --git a/core/MyTransport.h b/core/MyTransport.h index ef1451cad..210c8c482 100644 --- a/core/MyTransport.h +++ b/core/MyTransport.h @@ -119,6 +119,7 @@ * |!| TSF | RTE | FPAR ACTIVE | Finding parent active, message not sent * |!| TSF | RTE | DST %%d UNKNOWN | Routing for destination (DST) unknown, send message to parent * | | TSF | RTE | N2N OK | Node-to-node communication succeeded +* | | TSF | RTE | N2N DIS | Node-to-node communication disabled by configuration * |!| TSF | RTE | N2N FAIL | Node-to-node communication failed, handing over to parent for re-routing * | | TSF | RRT | ROUTE N=%%d,R=%%d | Routing table, messages to node (N) are routed via node (R) * |!| TSF | SND | TNR | Transport not ready, message cannot be sent From 68c54b7113be3057514a71b4141595c26932f49d Mon Sep 17 00:00:00 2001 From: Maximilian Wache <54880394+lelouch94@users.noreply.github.com> Date: Fri, 12 Mar 2021 20:52:05 +0100 Subject: [PATCH 5/5] Add N2N disabled explanation to log parser --- Logparser/logparser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Logparser/logparser.js b/Logparser/logparser.js index 05ac8f1cc..8835476d8 100644 --- a/Logparser/logparser.js +++ b/Logparser/logparser.js @@ -322,6 +322,7 @@ var match = [ { re: "!TSF:RTE:FPAR ACTIVE", d: "Finding parent active, message not sent" }, { re: "!TSF:RTE:(\\d+) UNKNOWN", d: "Routing for destination $1 unknown, sending message to parent" }, { re: "!TSF:RTE:N2N FAIL", d: "Direct node-to-node communication failed - handing over to parent" }, + { re: "TSF:RTE:N2N DIS", d: "Direct node-to-node communication disabled by configuration" }, { re: "TSF:RRT:ROUTE N=(\\d+),R=(\\d+)", d: "Routing table, messages to node ($1) are routed via node ($2)"}, { re: "!TSF:SND:TNR", d: "Transport not ready, message cannot be sent" }, { re: "TSF:TDI:TSL", d: "Set transport to sleep" },