[Bug]: TrafficManagement: unknown_packet_threshold has no effect — undecryptable packets never reach modules (2.8.0–2.8.2, develop)

Open
#12,431 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Read src/mesh/Router.cpp around passesRoutingAuthGate() and the opaque relay return path, then trace TrafficManagementModule::shouldDropUnknown() in src/modules/TrafficManagementModule.cpp. Start by adding an integration test to test/test_traffic_management/test_main.cpp that sends an opaque packet through the router. Done means packets over the configured threshold are no longer relayed, with the existing module tests still passing.

Written by the indexing model from the issue text.

Description

bug first-contribution triage
Category

Other

Hardware

Not Applicable

Is this bug report about any UI (https://meshtastic.org/docs/configuration/device-uis/) component firmware?
  • Meshtastic UI aka MUI
  • InkHUD
  • BaseUI
Firmware Version

2.8.2

Description
Summary

The Traffic Management unknown-packet filter (unknown_packet_threshold / shouldDropUnknown()) can never trigger in released 2.8.x firmware. Undecryptable packets are diverted to opaque relay before module dispatch,
so TrafficManagementModule never sees them.

Details (develop @ 647831b25)
  • All inbound traffic (radio src/mesh/RadioInterface.cpp:1560, MQTT downlink src/mqtt/MQTT.cpp:199/201, UDP src/mesh/udp/UdpMulticastHandler.h:113) goes enqueueReceivedMessage() → Router::runOnce() →
    Router::perhapsHandleReceived() (src/mesh/Router.cpp:1708).
  • There, passesRoutingAuthGate() (Router.cpp:1769) returns OPAQUE_RELAY_ONLY for DECODE_OPAQUE (unknown channel, :849) and for DECODE_FAILURE when not to/from us (:841).
  • On OPAQUE_RELAY_ONLY the caller does relayOpaquePacket(p) + perhapsUplinkOpaquePki(p), releases the packet and returns (Router.cpp:1774-1785). MeshModule::callModules() is only reached later, inside
    Router::handleReceived() (Router.cpp:1643).
  • NextHopRouter::relayOpaquePacket() documents this: "Opaque traffic never reaches PacketHistory, NodeDB, modules, phone, or ACK handling" (src/mesh/NextHopRouter.cpp:31).
  • The routing-auth cache only stores ACCEPTed packets (Router.cpp:824, :850), so it is not an alternative path.
  • TrafficManagementModule sets encryptedOk = true (src/modules/TrafficManagementModule.cpp:133) and handles which_payload_variant != decoded at :1093 by calling shouldDropUnknown() (:1095). That branch is
    unreachable, and nothing else calls the unknown-packet check. unknown_packet_drops stays at 0 regardless of configuration.
  • The TMM unit tests (test/test_traffic_management/test_main.cpp, e.g. test_tm_unknownPackets_dropOnNPlusOne) call module.handleReceived() directly, bypassing the router, so they still pass. An integration test
    feeding an opaque packet through Router::perhapsHandleReceived() would catch this.
Likely cause

#10967 (d6b12ea3f, merged 2026-07-21) moved undecryptable packets onto relayOpaquePacket(). TMM (#9358) predates it, and its unknown-packet handling relied on encrypted packets reaching modules. In discussion #9437 a
user reported TMM working on 2.7.20 alpha, before #10967. The same code is present in v2.8.0.47db0e3, v2.8.1.8e6a88d, v2.8.2.d5f1619 and develop @ 647831b25.

Expected behavior

With unknown_packet_threshold > 0, a source exceeding the threshold of undecryptable packets within the 5-minute window should stop being relayed.

Why it matters

Since #11844, CORE_PORTNUMS_ONLY (the ROUTER default) relays all opaque traffic, because the port list cannot apply to it. The unknown-packet filter is the natural complement for routers in that mode to throttle a
source flooding undecryptable traffic, without resorting to LOCAL_ONLY/KNOWN_ONLY, which drop all foreign-channel traffic.

Dominant language
C++
Stars
8.4k
Forks
2.8k
Avg merge
3d 14h
Merged PRs (30d)
119

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from meshtastic/firmware

All issues in meshtastic/firmware

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.