simple_repeater: filter hash throttle + opt-in message age limit (tth #3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-02 17:40:09 +01:00
1 parent e3029de6e4
commit 548b96d15c
8 files changed
+370 -29

No files matched your search

+12 -8
View File
@@ -699,14 +699,6 @@ 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;
@@ -729,6 +721,14 @@ bool MyMesh::allowPacketForward(const mesh::Packet *packet) {
return false;
}
}
// CUSTOM (TeTeHacko): keyless channel-hash deny list / throttle (`filter hash`).
// LAST of the checks here, so a throttle pass is only spent on a packet that
// would otherwise go out; and before takeForwardingRateLimit() in
// routeRecvPacket(), so a vetoed packet does not eat FairnessLimiter tokens.
if (filterHashDenied(packet)) {
MESH_DEBUG_PRINTLN("allowPacketForward: channel hash %02X on deny list", packet->payload[0]);
return false;
}
return true;
}
@@ -1405,6 +1405,7 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
#endif
_prefs.fairness_enabled = FAIRNESS_ENABLED_DEFAULT;
filter_hash_dropped = 0;
filter_hash_passed = 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;
@@ -1845,6 +1846,9 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, char *command, char *reply
// 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;
// CUSTOM (TeTeHacko): `filter dryrun [on|off]`, `filter age [<min>|off]`. Also
// before filterHandleCommand(), which would take `dryrun`/`age` for names.
if (filterMiscHandleCommand(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.