From 1aacdc08272213c9eb9382678f2539ea7abfb0be Mon Sep 17 00:00:00 2001 From: nightjoker7 Date: Tue, 21 Apr 2026 12:14:04 -0500 Subject: [PATCH] TrafficManagement: exempt traceroute from per-source rate limiting Add TRACEROUTE_APP to the list of portnums that bypass the rate limiter in TrafficManagementModule::handleReceived(), alongside the existing ROUTING_APP and ADMIN_APP exemptions. Traceroute responses travel as ordinary DM-class packets from the source being probed, so when rate_limit_enabled is true on a router and the source has just sent any other traffic (position, telemetry, NodeInfo broadcast), the traceroute reply is silently dropped via ignoreRequest=true/STOP. The initiator cannot distinguish this from a genuine routing failure, which is exactly the case traceroute is meant to diagnose. Refactor the portnum check into a named rateLimitExempt boolean for clarity and update the adjacent comment to reflect the new membership. --- src/modules/TrafficManagementModule.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/TrafficManagementModule.cpp b/src/modules/TrafficManagementModule.cpp index 1ecb68c4b49..176bcdb54ac 100644 --- a/src/modules/TrafficManagementModule.cpp +++ b/src/modules/TrafficManagementModule.cpp @@ -965,10 +965,14 @@ ProcessMessage TrafficManagementModule::handleReceived(const meshtastic_MeshPack // Rate Limiting // --------------------------------------------------------------------- // Throttle nodes sending too many packets within a time window. - // Excludes routing and admin packets which are essential for mesh operation. + // Excludes routing, admin, and traceroute packets which are essential for mesh + // operation and diagnostics. if (cfg.rate_limit_enabled && cfg.rate_limit_window_secs > 0 && cfg.rate_limit_max_packets > 0) { - if (mp.decoded.portnum != meshtastic_PortNum_ROUTING_APP && mp.decoded.portnum != meshtastic_PortNum_ADMIN_APP) { + const auto pn = mp.decoded.portnum; + const bool rateLimitExempt = (pn == meshtastic_PortNum_ROUTING_APP || pn == meshtastic_PortNum_ADMIN_APP || + pn == meshtastic_PortNum_TRACEROUTE_APP); + if (!rateLimitExempt) { if (isRateLimited(mp.from, nowMs)) { logAction("drop", &mp, "rate-limit"); incrementStat(&stats.rate_limit_drops);