Skip to content

Fixes #9792 : Hop with Meshtastic ffff and ?dB is added to missing hop in traceroute#9945

Merged
fifieldt merged 4 commits into
meshtastic:developfrom
domusonline:issues/issue-9792
Mar 20, 2026
Merged

Fixes #9792 : Hop with Meshtastic ffff and ?dB is added to missing hop in traceroute#9945
fifieldt merged 4 commits into
meshtastic:developfrom
domusonline:issues/issue-9792

Conversation

@domusonline

Copy link
Copy Markdown
Contributor

This fixes the situation where a duplicate packet from a traceroute will replace the packet to be rebroadcasted with the original packet (not containing the processing node).

fixes #9792

The change is to check in FloodingRouter::reprocessPacket if the packet is already decoded. This is necessary to check portnum for TraceRoute messages. If decode fails we bailout (can't test it).
If decode succeeds we let the original code run. I kept the original test for decoded, just in case this fix is changed in the future and we risk reaching to that test without decoding (it could crash if we test an uninitialized field - portnum -)

Tests were run, forcing the flow to use the change. Output in tracepath was correct. Node run for about 10H without noticeable issues caused by this change.

Log showing the new situation:

===> Receive traceroute from ca70. Packet ID 0x1eb460e8. Process and enqueue for TX

Mar 19 02:00:20 DOH2_9468 RadioIf [2551]: Corrected frequency offset: 136.593735
Mar 19 02:00:20 DOH2_9468 RadioIf [2552]: Lora RX (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 0, WantAck=1, HopLim=5 Ch=0x8 encrypted len=22 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x68 relay=0x70)
Mar 19 02:00:20 DOH2_9468 RadioIf [2552]: Packet RX: 395ms
Mar 19 02:00:20 DOH2_9468 Router [2552]: Packet History - insert: Using new slot @uptime 2552.031s TRACE NEW
Mar 19 02:00:20 DOH2_9468 Router [2552]: Use channel 0 (hash 0x8)
Mar 19 02:00:20 DOH2_9468 Router [2552]: Expand short PSK #1
Mar 19 02:00:20 DOH2_9468 Router [2552]: Use AES128 key!
Mar 19 02:00:20 DOH2_9468 Router [2552]: decoded message (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=5 Ch=0x0 Portnum=70 WANTRESP rxtime=1773885794 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x68 relay=0x70)
Mar 19 02:00:20 DOH2_9468 Router [2552]: handleReceived(REMOTE) (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=5 Ch=0x0 Portnum=70 WANTRESP rxtime=1773885794 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x68 relay=0x70)
Mar 19 02:00:20 DOH2_9468 Router [2552]: Module 'traceroute' wantsPacket=1
Mar 19 02:00:20 DOH2_9468 Router [2552]: Received traceroute from=0xdb2aca70, id=0x1eb460e8, portnum=70, payloadlen=0
Mar 19 02:00:20 DOH2_9468 Router [2552]: Route traced:#0120xdb2aca70 --> 0x433c9468 (5.25dB) --> ...
Mar 19 02:00:20 DOH2_9468 Router [2552]: Module 'traceroute' considered
Mar 19 02:00:20 DOH2_9468 Router [2552]: Module 'routing' wantsPacket=1
Mar 19 02:00:20 DOH2_9468 Router [2552]: Routing sniffing (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=5 Ch=0x0 Portnum=70 WANTRESP rxtime=1773885794 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x68 relay=0x70)
Mar 19 02:00:20 DOH2_9468 Router [2552]: Rebroadcast received message coming from 70
Mar 19 02:00:20 DOH2_9468 Router [2552]: Packet History - insert: Reusing slot aged 0.124s TRACE MATCHED PACKET
Mar 19 02:00:20 DOH2_9468 Router [2552]: Setting next hop for packet with dest 55fc8418 to 18
Mar 19 02:00:20 DOH2_9468 Router [2552]: Setting next retransmission in 7246 msecs:
Mar 19 02:00:20 DOH2_9468 Router [2552]: (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=4 Ch=0x0 Portnum=70 WANTRESP rxtime=1773885794 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x18 relay=0x68)
Mar 19 02:00:20 DOH2_9468 Router [2552]: Expand short PSK #1
Mar 19 02:00:20 DOH2_9468 Router [2552]: Use AES128 key!
Mar 19 02:00:20 DOH2_9468 Router [2552]: enqueue for send (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=4 Ch=0x8 encrypted len=33 rxtime=1773885794 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x18 relay=0x68 priority=70)
Mar 19 02:00:20 DOH2_9468 Router [2552]: txGood=127,txRelay=127,rxGood=572,rxBad=81
Mar 19 02:00:20 DOH2_9468 Router [2552]: rx_snr found. hop_limit:4 rx_snr:5.250000
Mar 19 02:00:20 DOH2_9468 Router [2552]: rx_snr found in packet. Setting tx delay:3080
Mar 19 02:00:20 DOH2_9468 Router [2552]: Module 'routing' considered

===> Packet not yet sent but duplicate received

Mar 19 02:00:29 DOH2_9468 RadioIf [2561]: Corrected frequency offset: 130.781250
Mar 19 02:00:29 DOH2_9468 RadioIf [2561]: Lora RX (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 0, WantAck=1, HopLim=5 Ch=0x8 encrypted len=22 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x68 relay=0x70)
Mar 19 02:00:29 DOH2_9468 RadioIf [2561]: Packet RX: 395ms
Mar 19 02:00:29 DOH2_9468 RadioIf [2561]: rx_snr found. hop_limit:4 rx_snr:5.250000
Mar 19 02:00:29 DOH2_9468 RadioIf [2561]: rx_snr found in packet. Setting tx delay:3500
Mar 19 02:00:29 DOH2_9468 Router [2561]: Packet History - insert: Reusing slot aged 9.481s TRACE MATCHED PACKET

===> Packet duplicate detected

Mar 19 02:00:29 DOH2_9468 Router [2561]: Ignore dupe incoming msg (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=5 Ch=0x8 encrypted len=22 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x68 relay=0x70)
Mar 19 02:00:29 DOH2_9468 Router [2561]: cancelSending id=0x1eb460e8, removed=1

===> Changed: Decoded in reprocessPacket()

Mar 19 02:00:29 DOH2_9468 Router [2561]: Use channel 0 (hash 0x8)
Mar 19 02:00:29 DOH2_9468 Router [2561]: Expand short PSK #1
Mar 19 02:00:29 DOH2_9468 Router [2561]: Use AES128 key!
Mar 19 02:00:29 DOH2_9468 Router [2561]: decoded message (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=5 Ch=0x0 Portnum=70 WANTRESP rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x68 relay=0x70)

===> Changed: print packet in reprocessPacket()

Mar 19 02:00:29 DOH2_9468 Router [2561]: reprocessPacket(DUP) (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=5 Ch=0x0 Portnum=70 WANTRESP rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x68 relay=0x70)
Mar 19 02:00:29 DOH2_9468 Router [2561]: Route traced:#0120xdb2aca70 --> 0x433c9468 (5.25dB) --> ...
Mar 19 02:00:29 DOH2_9468 Router [2561]: Rebroadcast received message coming from 70
Mar 19 02:00:30 DOH2_9468 Router [2561]: Packet History - insert: Reusing slot aged 0.105s TRACE MATCHED PACKET
Mar 19 02:00:30 DOH2_9468 Router [2561]: Setting next hop for packet with dest 55fc8418 to 18
Mar 19 02:00:30 DOH2_9468 Router [2561]: Setting next retransmission in 7246 msecs:
Mar 19 02:00:30 DOH2_9468 Router [2561]: (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=4 Ch=0x0 Portnum=70 WANTRESP rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x18 relay=0x68)
Mar 19 02:00:30 DOH2_9468 Router [2561]: Expand short PSK #1
Mar 19 02:00:30 DOH2_9468 Router [2561]: Use AES128 key!
Mar 19 02:00:30 DOH2_9468 Router [2561]: enqueue for send (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=4 Ch=0x8 encrypted len=33 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x18 relay=0x68 priority=70)
Mar 19 02:00:30 DOH2_9468 Router [2561]: txGood=127,txRelay=127,rxGood=577,rxBad=81
Mar 19 02:00:30 DOH2_9468 Router [2561]: rx_snr found. hop_limit:4 rx_snr:5.250000
Mar 19 02:00:30 DOH2_9468 Router [2561]: rx_snr found in packet. Setting tx delay:3920
Mar 19 02:00:30 DOH2_9468 Router [2561]: Incoming msg was filtered from 0xdb2aca70

===> Packet finally sent

Mar 19 02:00:33 DOH2_9468 RadioIf [2565]: Started Tx (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=4 Ch=0x8 encrypted len=33 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x18 relay=0x68 priority=70)
Mar 19 02:00:33 DOH2_9468 RadioIf [2565]: 1 packets remain in the TX queue
Mar 19 02:00:33 DOH2_9468 Position [2565]: Ch. util >25%. Skip send
Mar 19 02:00:33 DOH2_9468 RadioIf [2565]: Packet TX: 477ms
Mar 19 02:00:33 DOH2_9468 RadioIf [2565]: Completed sending (id=0x1eb460e8 fr=0xdb2aca70 to=0x55fc8418, transport = 1, WantAck=1, HopLim=4 Ch=0x8 encrypted len=33 rxSNR=5.25 rxRSSI=-96 hopStart=5 nextHop=0x18 relay=0x68 priority=70)
Mar 19 02:00:33 DOH2_9468 RadioIf [2565]: rx_snr found. hop_limit:0 rx_snr:-6.000000
Mar 19 02:00:33 DOH2_9468 RadioIf [2565]: rx_snr found in packet. Setting tx delay:644
Mar 19 02:00:34 DOH2_9468 RadioIf [2566]: Can not send yet, busyRx
Mar 19 02:00:34 DOH2_9468 RadioIf [2566]: rx_snr found. hop_limit:0 rx_snr:-6.000000
Mar 19 02:00:34 DOH2_9468 RadioIf [2566]: rx_snr found in packet. Setting tx delay:1120

===> Returned packet...

Mar 19 02:00:34 DOH2_9468 RadioIf [2566]: Corrected frequency offset: -188.906250
Mar 19 02:00:34 DOH2_9468 RadioIf [2566]: Lora RX (id=0x7dd81ff3 fr=0x55fc8418 to=0xdb2aca70, transport = 0, WantAck=1, HopLim=3 Ch=0x8 encrypted len=37 rxSNR=5.75 rxRSSI=-77 hopStart=3 relay=0x18)
Mar 19 02:00:34 DOH2_9468 RadioIf [2566]: Packet RX: 518ms
Mar 19 02:00:34 DOH2_9468 RadioIf [2566]: rx_snr found. hop_limit:0 rx_snr:-6.000000
Mar 19 02:00:34 DOH2_9468 RadioIf [2566]: rx_snr found in packet. Setting tx delay:840
Mar 19 02:00:34 DOH2_9468 Router [2566]: Packet History - insert: Using new slot @uptime 2566.549s TRACE NEW
Mar 19 02:00:34 DOH2_9468 Router [2566]: Use channel 0 (hash 0x8)
Mar 19 02:00:34 DOH2_9468 Router [2566]: Expand short PSK #1
Mar 19 02:00:34 DOH2_9468 Router [2566]: Use AES128 key!
Mar 19 02:00:34 DOH2_9468 Router [2566]: decoded message (id=0x7dd81ff3 fr=0x55fc8418 to=0xdb2aca70, transport = 1, WantAck=1, HopLim=3 Ch=0x0 Portnum=70 requestId=1eb460e8 rxtime=1773885808 rxSNR=5.75 rxRSSI=-77 hopStart=3 relay=0x18)
Mar 19 02:00:34 DOH2_9468 Router [2566]: handleReceived(REMOTE) (id=0x7dd81ff3 fr=0x55fc8418 to=0xdb2aca70, transport = 1, WantAck=1, HopLim=3 Ch=0x0 Portnum=70 requestId=1eb460e8 rxtime=1773885808 rxSNR=5.75 rxRSSI=-77 hopStart=3 relay=0x18)
Mar 19 02:00:34 DOH2_9468 Router [2566]: Module 'traceroute' wantsPacket=1
Mar 19 02:00:34 DOH2_9468 Router [2566]: Received traceroute from=0x55fc8418, id=0x7dd81ff3, portnum=70, payloadlen=10
Mar 19 02:00:34 DOH2_9468 Router [2566]: Route traced:#0120xdb2aca70 --> 0x433c9468 (5.25dB) --> 0x55fc8418 (6.75dB)#12...(5.75dB) 0x433c9468 <-- 0x55fc8418
Mar 19 02:00:34 DOH2_9468 Router [2566]: Module 'traceroute' considered
Mar 19 02:00:34 DOH2_9468 Router [2566]: Module 'routing' wantsPacket=1
Mar 19 02:00:34 DOH2_9468 Router [2566]: Routing sniffing (id=0x7dd81ff3 fr=0x55fc8418 to=0xdb2aca70, transport = 1, WantAck=1, HopLim=3 Ch=0x0 Portnum=70 requestId=1eb460e8 rxtime=1773885808 rxSNR=5.75 rxRSSI=-77 hopStart=3 relay=0x18)
Mar 19 02:00:34 DOH2_9468 Router [2566]: cancelSending id=0x1eb460e8, removed=0
Mar 19 02:00:34 DOH2_9468 Router [2566]: cancelSending id=0x1eb460e8, removed=0
Mar 19 02:00:34 DOH2_9468 Router [2566]: Rebroadcast received message coming from 18
Mar 19 02:00:34 DOH2_9468 Router [2566]: Packet History - insert: Reusing slot aged 0.150s TRACE MATCHED PACKET
Mar 19 02:00:34 DOH2_9468 Router [2566]: Expand short PSK #1
Mar 19 02:00:34 DOH2_9468 Router [2566]: Use AES128 key!
Mar 19 02:00:34 DOH2_9468 Router [2566]: enqueue for send (id=0x7dd81ff3 fr=0x55fc8418 to=0xdb2aca70, transport = 1, WantAck=1, HopLim=2 Ch=0x8 encrypted len=46 rxtime=1773885808 rxSNR=5.75 rxRSSI=-77 hopStart=3 relay=0x68 priority=80)
Mar 19 02:00:35 DOH2_9468 Router [2566]: txGood=128,txRelay=128,rxGood=579,rxBad=81
Mar 19 02:00:35 DOH2_9468 Router [2566]: rx_snr found. hop_limit:2 rx_snr:5.750000
Mar 19 02:00:35 DOH2_9468 Router [2566]: rx_snr found in packet. Setting tx delay:2604
Mar 19 02:00:35 DOH2_9468 Router [2566]: Module 'routing' considered

===> Returned packet sent

Mar 19 02:00:39 DOH2_9468 RadioIf [2571]: Started Tx (id=0x7dd81ff3 fr=0x55fc8418 to=0xdb2aca70, transport = 1, WantAck=1, HopLim=2 Ch=0x8 encrypted len=46 rxtime=1773885808 rxSNR=5.75 rxRSSI=-77 hopStart=3 relay=0x68 priority=80)
Mar 19 02:00:39 DOH2_9468 RadioIf [2571]: 1 packets remain in the TX queue
Mar 19 02:00:40 DOH2_9468 RadioIf [2571]: Packet TX: 600ms
Mar 19 02:00:40

Screenshot_20260319_021510_Meshtastic

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)
      Heltec WSL V3

@github-actions github-actions Bot added needs-review Needs human review bugfix Pull request that fixes bugs labels Mar 19, 2026
@thebentern thebentern requested review from GUVWAF and Copilot March 19, 2026 11:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes traceroute duplicate-packet handling by ensuring packets are decoded before checking traceroute portnum in FloodingRouter::reprocessPacket, preventing a duplicate from replacing a to-be-rebroadcasted packet without the processing node hop/SNR info.

Changes:

  • Attempt to decode non-decoded packets in reprocessPacket() when traceroute support is enabled.
  • Bail out on decode failure to avoid acting on packets that can’t be inspected for traceroute.
  • Add debug printing for successfully decoded duplicate packets.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/mesh/FloodingRouter.cpp
Comment thread src/mesh/FloodingRouter.cpp
Comment thread src/mesh/FloodingRouter.cpp Outdated

@GUVWAF GUVWAF left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks for the effort.

@fifieldt fifieldt removed the needs-review Needs human review label Mar 19, 2026
domusonline and others added 3 commits March 20, 2026 07:47
Log improvement for failure to decode packet.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@fifieldt fifieldt force-pushed the issues/issue-9792 branch from 4cb75c2 to 1cbf96f Compare March 19, 2026 20:47
@NomDeTom

Copy link
Copy Markdown
Collaborator

@fifieldt needs a tag, plz!

@fifieldt

Copy link
Copy Markdown
Member

Sorry @NomDeTom , pre-coffee brain failed to understand - was this one good to merge? Is there a particular label we need to apply?

@NomDeTom

Copy link
Copy Markdown
Collaborator

Sorry @NomDeTom , pre-coffee brain failed to understand - was this one good to merge? Is there a particular label we need to apply?

Not necessarily for merging, but if it has no labels then the first check on the CI will always fail. Iirc, it will apply labels the first time only, but if all the labels are removed then it won't reapply them.

@fifieldt fifieldt merged commit eb80d31 into meshtastic:develop Mar 20, 2026
77 checks passed
andmadeira pushed a commit to andmadeira/meshtastic-firmware that referenced this pull request Mar 20, 2026
…missing hop in traceroute (meshtastic#9945)

* Fix issue 9792, decode packet for TR test

* Fix 9792: Assure packet id decoded for TR test

* Potential fix for pull request finding

Log improvement for failure to decode packet.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* trunk fmt

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
thebentern pushed a commit that referenced this pull request Mar 22, 2026
…p in traceroute (#9945)

* Fix issue 9792, decode packet for TR test

* Fix 9792: Assure packet id decoded for TR test

* Potential fix for pull request finding

Log improvement for failure to decode packet.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* trunk fmt

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
@domusonline domusonline deleted the issues/issue-9792 branch March 30, 2026 11:16
jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
…missing hop in traceroute (meshtastic#9945)

* Fix issue 9792, decode packet for TR test

* Fix 9792: Assure packet id decoded for TR test

* Potential fix for pull request finding

Log improvement for failure to decode packet.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* trunk fmt

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Traceroute shows "Meshtastic ffff" and "? dB" when all involved nodes are using recent firmwares

5 participants