simple_repeater: filter hash -- runtime deny-forward podle hashe kanálu

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-10-14 20:34:19 +02:00
1 parent a79860e9c9
commit 4ca0850369
4 files changed
+113

No files matched your search

+12
View File
@@ -699,6 +699,14 @@ void MyMesh::sendFloodReply(mesh::Packet* packet, unsigned long delay_millis, ui
bool MyMesh::allowPacketForward(const mesh::Packet *packet) {
if (_prefs.disable_fwd) return false;
// CUSTOM (TeTeHacko): keyless channel-hash deny list (`filter hash`). Before
// takeForwardingRateLimit() in routeRecvPacket(), so a vetoed packet does not
// eat FairnessLimiter tokens either.
if (filterHashDenied(packet)) {
filter_hash_dropped++;
MESH_DEBUG_PRINTLN("allowPacketForward: channel hash %02X on deny list", packet->payload[0]);
return false;
}
if (packet->isRouteFlood()
&& mesh::isFloodHopLimitExceeded(packet, _prefs.flood_max, _prefs.flood_max_unscoped, _prefs.flood_max_advert)) {
return false;
@@ -1347,6 +1355,7 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
#define FAIRNESS_ENABLED_DEFAULT 1
#endif
_prefs.fairness_enabled = FAIRNESS_ENABLED_DEFAULT;
filter_hash_dropped = 0;
_prefs.interference_threshold = 0; // disabled
_prefs.cad_enabled = 0; // hardware CAD before TX (off by default; 'set cad on')
_prefs.loop_detect = LOOP_DETECT_MINIMAL;
@@ -1763,6 +1772,9 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, char *command, char *reply
// CUSTOM (TeTeHacko): `bot` — read-only channel bot diagnostics. See ChannelBot.h.
if (botHandleCommand(command, reply)) return;
#endif
// CUSTOM (TeTeHacko): `filter hash [add|del <hex>|clear]` — keyless channel-hash
// deny list. Before filterHandleCommand(), which would claim any `filter ...`.
if (filterHashHandleCommand(command, reply, reply_max)) return;
#ifdef FILTER_CHANNEL_PSKS
// CUSTOM (TeTeHacko): `filter add|del|list|clear` — runtime deny list for
// channel messages this repeater refuses to forward. See ChannelFilter.h.