Repository navigation
Mark the destination reached on a Port Unreachable from the target - #180
Merged
Merged
Conversation
A live trace only counted an ICMP Echo Reply as reaching the target, so UDP probes, which the target answers with Port Unreachable, never set dest_ttl or complete. Every TTL up to the maximum kept being probed and the target was listed at each of them. Count a Destination Unreachable sent by the target itself as the destination, matching replay.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
A live UDP trace never marks the destination reached.
dest_ttlstaysnull,completestaysfalse, every TTL up to the max keeps being probed every round, and the TUI lists the target again at each hop past it (with themax_ttl=30badge). On master this shows with-p udpagainst the LAN gateway: it is listed at hops 1, 2, 3 and further. Replay of the same session already ends the path at the first reply from the target, so live and replay disagree.Root cause
The receiver's batch update (
src/trace/receiver.rs) only setdest_ttl/completeon an ICMP Echo Reply from the target. A UDP probe that reaches the target draws a Port Unreachable (IPv4 type 3 code 3, IPv6 type 1 code 4), so the check never fired. Every protocol's ICMP replies go through that one check. The other places that setdest_ttlare replay (any reply from the target) and the engine's IPv6 Echo Reply poll, which handles only ICMP-mode Echo Replies from the target and is already correct.Fix
is_destination_reply()counts an Echo Reply or a Destination Unreachable sent by the target itself as reaching the destination. The receiver uses it in place of the Echo-only check. These still do not count:The engine already stops probing at
dest_ttl, so once it is set, UDP stops probing past the destination the same way ICMP does. PMTUD runs only in ICMP mode and still confirms sizes only on Echo Replies from the target, so it is unchanged. The single-target DNAT tolerance intake_pendingis untouched.Replay is unchanged. Recorded events carry no ICMP type, so replay still ends the path at any reply from the target, including Time Exceeded or Parameter Problem; live is now the same for Echo Reply and Destination Unreachable and stricter for those two. For an ordinary UDP trace the target only sends Port Unreachable, so live and replay agree.
TCP is a separate gap and is not fixed here. The destination answers a SYN with SYN-ACK or RST over TCP, and ttl only reads ICMP, so a TCP trace still never marks the destination unless the target sends ICMP. Live results below confirm this. I added a note to KNOWN_ISSUES.md. Reading TCP replies would need a new receive path.
Tests
destination_reply_includes_port_unreachable_from_target, for IPv4 and IPv6. With the master predicate (Echo Reply only) swapped back in, it fails on the Port Unreachable assertion. It passes with the fix.cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo clippy --all-targets --no-default-features -- -D warnings,cargo test: all pass.Live before/after (Linux, Docker NET_RAW,
-c 3 --json)On this network, hops past the home gateway answer UDP probes only with the unmerged short-quote fix (#176). So the internet targets compare master+#176 against this branch+#176. The gateway rows use plain master and this branch.
-p udp --flows 48.8.8.8-p udp --flows 41.1.1.1-p udp2001:4860:4860::8888-p udpLAN gateway (no #176)-p icmp8.8.8.8 (control)-p tcp1.1.1.1The sent counts match what a fixed path gives: all TTLs in round 1, then TTLs up to
dest_ttlonly. For example, 30×4 + 7×4×2 = 176. The JSON export still contains the round-1 rows pastdest_ttl, as it already does for ICMP. The TUI, CSV and report cap atdest_ttl.Not verified