From 860aca9335d529b0ef02328f0afacef8ef007724 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 30 Jan 2023 14:50:03 -0600 Subject: [PATCH 1/4] Set encryptedOk to false for local_only rebroadcast --- src/mesh/FloodingRouter.cpp | 5 ----- src/modules/RoutingModule.cpp | 8 +++++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index 1498bbeab..d0925d0a1 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -59,11 +59,6 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas LOG_DEBUG("Ignoring a simple (0 id) broadcast\n"); } } - - if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY) { - LOG_DEBUG("Cancelling rebroadcast of message from node on a foreign mesh, due to local only rebroadcast mode\n"); - Router::cancelSending(p->to, p->decoded.request_id); - } // handle the packet as normal Router::sniffReceived(p, c); } diff --git a/src/modules/RoutingModule.cpp b/src/modules/RoutingModule.cpp index f91d32a20..c1862e4ee 100644 --- a/src/modules/RoutingModule.cpp +++ b/src/modules/RoutingModule.cpp @@ -14,7 +14,8 @@ bool RoutingModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mesh // FIXME - move this to a non promsicious PhoneAPI module? // Note: we are careful not to send back packets that started with the phone back to the phone - if ((mp.to == NODENUM_BROADCAST || mp.to == nodeDB.getNodeNum()) && (mp.from != 0)) { + if ((mp.to == NODENUM_BROADCAST || mp.to == nodeDB.getNodeNum()) && (mp.from != 0)) + { printPacket("Delivering rx packet", &mp); service.handleFromRadio(&mp); } @@ -29,7 +30,8 @@ meshtastic_MeshPacket *RoutingModule::allocReply() assert(currentRequest); // We only consider making replies if the request was a legit routing packet (not just something we were sniffing) - if (currentRequest->decoded.portnum == meshtastic_PortNum_ROUTING_APP) { + if (currentRequest->decoded.portnum == meshtastic_PortNum_ROUTING_APP) + { assert(0); // 1.2 refactoring fixme, Not sure if anything needs this yet? // return allocDataProtobuf(u); } @@ -46,5 +48,5 @@ void RoutingModule::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketI RoutingModule::RoutingModule() : ProtobufModule("routing", meshtastic_PortNum_ROUTING_APP, &meshtastic_Routing_msg) { isPromiscuous = true; - encryptedOk = true; + encryptedOk = config.device.rebroadcast_mode != meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY; } From 14079524103482d26a5e1cf20d75b0b6bdf5d309 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 30 Jan 2023 14:50:57 -0600 Subject: [PATCH 2/4] Fmt --- src/modules/RoutingModule.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/RoutingModule.cpp b/src/modules/RoutingModule.cpp index c1862e4ee..d81311481 100644 --- a/src/modules/RoutingModule.cpp +++ b/src/modules/RoutingModule.cpp @@ -14,8 +14,7 @@ bool RoutingModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mesh // FIXME - move this to a non promsicious PhoneAPI module? // Note: we are careful not to send back packets that started with the phone back to the phone - if ((mp.to == NODENUM_BROADCAST || mp.to == nodeDB.getNodeNum()) && (mp.from != 0)) - { + if ((mp.to == NODENUM_BROADCAST || mp.to == nodeDB.getNodeNum()) && (mp.from != 0)) { printPacket("Delivering rx packet", &mp); service.handleFromRadio(&mp); } @@ -30,8 +29,7 @@ meshtastic_MeshPacket *RoutingModule::allocReply() assert(currentRequest); // We only consider making replies if the request was a legit routing packet (not just something we were sniffing) - if (currentRequest->decoded.portnum == meshtastic_PortNum_ROUTING_APP) - { + if (currentRequest->decoded.portnum == meshtastic_PortNum_ROUTING_APP) { assert(0); // 1.2 refactoring fixme, Not sure if anything needs this yet? // return allocDataProtobuf(u); } From 5e1c39eb0fcbd1982e640fd33ae689a0f7d21e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 31 Jan 2023 15:51:21 +0100 Subject: [PATCH 3/4] RP2040 toolchain updated --- .trunk/trunk.yaml | 15 +++++++++++++-- .vscode/extensions.json | 7 ++++--- .vscode/settings.json | 6 +++++- arch/rp2040/rp2040.ini | 4 +--- src/platform/rp2040/rp2040CryptoEngine.cpp | 2 +- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 70acfd11b..d168fec51 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,6 +1,6 @@ version: 0.1 cli: - version: 1.3.1 + version: 1.3.2 plugins: sources: - id: trunk @@ -8,8 +8,18 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: + - svgo@3.0.2 + - shfmt@3.5.0 + - isort@5.11.4 + - black@22.12.0 + - hadolint@2.12.0 + - actionlint@1.6.23 + - flake8@6.0.0 + - markdownlint@0.33.0 + - shellcheck@0.9.0 + - oxipng@8.0.0 - git-diff-check - - gitleaks@8.15.2 + - gitleaks@8.15.3 - clang-format@14.0.0 - prettier@2.8.3 disabled: @@ -22,6 +32,7 @@ lint: - svgo@3.0.2 runtimes: enabled: + - python@3.10.8 - go@1.18.3 - node@18.12.1 actions: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 4fc84fa78..080e70d08 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,8 +2,9 @@ // See http://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format "recommendations": [ - "ms-vscode.cpptools", - "platformio.platformio-ide", - "trunk.io" + "platformio.platformio-ide" ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 3b489975b..0e9ee3ced 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { "editor.formatOnSave": true, - "editor.defaultFormatter": "trunk.io" + "editor.defaultFormatter": "trunk.io", + "githubPullRequests.ignoredPullRequestBranches": ["master"], + "files.associations": { + "*.tcc": "cpp" + } } diff --git a/arch/rp2040/rp2040.ini b/arch/rp2040/rp2040.ini index f30a94d3d..c41f92892 100644 --- a/arch/rp2040/rp2040.ini +++ b/arch/rp2040/rp2040.ini @@ -1,8 +1,6 @@ ; Common settings for rp2040 Processor based targets [rp2040_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#20c7dbfcfe6677c5305fa28ecf5e3870321cb157 -platform_packages = - earlephilhower/toolchain-rp2040-earlephilhower@^5.100300.221223 +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#9f8c10e50b5acd18e7bfd32638199c655be73a5b extends = arduino_base board_build.core = earlephilhower board_build.filesystem_size = 0.5m diff --git a/src/platform/rp2040/rp2040CryptoEngine.cpp b/src/platform/rp2040/rp2040CryptoEngine.cpp index c90126cc7..bb1c00779 100644 --- a/src/platform/rp2040/rp2040CryptoEngine.cpp +++ b/src/platform/rp2040/rp2040CryptoEngine.cpp @@ -1,6 +1,6 @@ +#include "configuration.h" #include "CryptoEngine.h" #include "aes.hpp" -#include "configuration.h" class RP2040CryptoEngine : public CryptoEngine { From 04add9b91ef4cd559f5e174f7e930c711fd12658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 31 Jan 2023 15:56:02 +0100 Subject: [PATCH 4/4] revert config changes accidentally pushed --- .trunk/trunk.yaml | 15 ++------------- .vscode/extensions.json | 7 +++---- .vscode/settings.json | 6 +----- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index d168fec51..70acfd11b 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,6 +1,6 @@ version: 0.1 cli: - version: 1.3.2 + version: 1.3.1 plugins: sources: - id: trunk @@ -8,18 +8,8 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - svgo@3.0.2 - - shfmt@3.5.0 - - isort@5.11.4 - - black@22.12.0 - - hadolint@2.12.0 - - actionlint@1.6.23 - - flake8@6.0.0 - - markdownlint@0.33.0 - - shellcheck@0.9.0 - - oxipng@8.0.0 - git-diff-check - - gitleaks@8.15.3 + - gitleaks@8.15.2 - clang-format@14.0.0 - prettier@2.8.3 disabled: @@ -32,7 +22,6 @@ lint: - svgo@3.0.2 runtimes: enabled: - - python@3.10.8 - go@1.18.3 - node@18.12.1 actions: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 080e70d08..4fc84fa78 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,9 +2,8 @@ // See http://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format "recommendations": [ - "platformio.platformio-ide" + "ms-vscode.cpptools", + "platformio.platformio-ide", + "trunk.io" ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 0e9ee3ced..3b489975b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,4 @@ { "editor.formatOnSave": true, - "editor.defaultFormatter": "trunk.io", - "githubPullRequests.ignoredPullRequestBranches": ["master"], - "files.associations": { - "*.tcc": "cpp" - } + "editor.defaultFormatter": "trunk.io" }