Files
meshcore-bot-firmware/patches/meshcore/0015-Report-flood-paths-in-bot-DM-diagnostics.patch
2026-05-17 21:08:43 -06:00

46 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: cj-vana <cj@depth23.online>
Date: Sun, 17 May 2026 21:07:25 -0600
Subject: [PATCH] Report flood paths in bot DM diagnostics
---
examples/companion_radio/FirmwareBot.cpp | 6 +-----
examples/companion_radio/MyMesh.cpp | 7 ++++++-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/examples/companion_radio/FirmwareBot.cpp b/examples/companion_radio/FirmwareBot.cpp
index 21312c55..3b4a008e 100644
--- a/examples/companion_radio/FirmwareBot.cpp
+++ b/examples/companion_radio/FirmwareBot.cpp
@@ -320,11 +320,7 @@ BotWriteResult writeAckResponse(const BotMessage& message, const BotCommand& com
const char* sender = message.sender_name[0] ? message.sender_name : "unknown";
int n;
- if (message.channel_kind == BOT_CHANNEL_DM) {
- n = snprintf(output, output_len, "@[%s] direct", sender);
- } else {
- n = snprintf(output, output_len, "@[%s]", sender);
- }
+ n = snprintf(output, output_len, "@[%s]", sender);
if (n < 0) {
output[0] = 0;
return BOT_WRITE_NO_SPACE;
diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp
index 1a7ddb7a..bfed7f98 100644
--- a/examples/companion_radio/MyMesh.cpp
+++ b/examples/companion_radio/MyMesh.cpp
@@ -1083,7 +1083,12 @@ void MyMesh::observeBotDirectMessage(const ContactInfo &from, uint32_t sender_ti
if (rssi < -32768.0f) rssi = -32768.0f;
recordBotNeighbor(from.id.pub_key, (int16_t)rssi, (int8_t)(packet->getSNR() * 4));
}
- if (from.out_path_len != OUT_PATH_UNKNOWN && mesh::Packet::isValidPathLen(from.out_path_len)) {
+ if (packet && packet->isRouteFlood() && packet->path_len <= 0xFF && mesh::Packet::isValidPathLen((uint8_t)packet->path_len)) {
+ message.path_len = (uint8_t)packet->path_len;
+ message.path_hash_size = packet->getPathHashSize();
+ message.path_hash_count = packet->getPathHashCount();
+ message.path = packet->path;
+ } else if (from.out_path_len != OUT_PATH_UNKNOWN && mesh::Packet::isValidPathLen(from.out_path_len)) {
message.path_len = from.out_path_len;
message.path_hash_size = (from.out_path_len >> 6) + 1;
message.path_hash_count = from.out_path_len & 63;