Skip to content

Fix correlation, rate-limit, ASN prefix and replay bugs - #163

Merged
lance0 merged 11 commits into
masterfrom
fix/audit-bugs
Oct 16, 2026
Merged

lance0 merged 11 commits into
masterfrom
fix/audit-bugs

Conversation

@lance0

@lance0 lance0 commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner
  • Probe correlation: the ICMP Echo identifier is now a random non-zero value chosen once per process instead of the PID. Instances in separate containers were all PID 1, so they shared an identifier and picked up each other's replies, even when tracing the same target. The receiver no longer matches a reply to whichever target has the same sequence pending. With several targets, a reply must match the quoted original destination. With a single target, an ICMP error quoting a different destination is still accepted, so hops past a destination NAT (e.g. a load-balancer VIP) are kept. Echo Replies must come from the target, including in the Linux IPv6 Echo Reply poll.
  • Rate limiting: a hop that has never replied is silent, not rate-limited. This stops 100%RL on every * * * hop and [RL?] on unreachable targets.
  • ASN prefix: read the BGP prefix from field 1 of the Cymru origin record (field 2 is the country code), take the first ASN of multi-origin records, and sanitize the prefix.
  • Update check toggle: under --no-update-check, TTL_NO_UPDATE_CHECK or DO_NOT_TRACK, the toggle shows off and is locked for the run, and the saved preference is left unchanged.
  • --replay --animate: hostname, ASN, geo, IX and ICMP-extension data are carried over from the loaded session during playback and seeks.
  • --report: long hostnames are cut with an ellipsis so the columns line up. The IP is always shown in full.
  • CLI: the --flows help example now uses -p udp. The FreeBSD/NetBSD error now names --interface instead of -i. --pmtud with -p udp/tcp is rejected. An explicit --theme default now overrides a saved theme.

lance0 added 11 commits October 16, 2026 12:45
origin.asn.cymru.com TXT records are 'ASN | prefix | CC | registry | date',
so field 2 is the country code and hop detail showed 'Prefix: US'. Parse
field 1, take the first ASN of multi-origin records, and sanitize the
prefix like the AS name.
A hop with an all-timeout history has a perfectly 'stable' 100% loss
ratio, so every * * * hop showed 100%RL and any unreachable target got
[RL?] in the title. Rate limiting means some replies get through, so
skip detection until the hop has answered at least once.
When the quoted original destination (or Echo Reply source) missed the
pending map, the receiver retried the lookup against every target by
sequence alone. The ICMP identifier is the PID, so two ttl instances in
containers (both PID 1) shared it and one session picked up hops from
the other's trace; late replies could also consume another target's
pending probe. Drop the cross-target fallback, and have the Linux IPv6
Echo Reply poll ignore replies that don't come from the engine's target.
The settings toggle only read the saved preference, so it showed [on]
under --no-update-check, TTL_NO_UPDATE_CHECK or DO_NOT_TRACK even though
no check ran. Show it off and locked for the run (Enter explains why),
and keep the saved preference untouched so a one-off flag doesn't
persist.
--replay --animate rebuilt hops from probe events, which don't carry
enrichment, so playback showed bare IPs while static replay had names
and ASNs. Keep the loaded session on ReplayState and copy each new
responder's enrichment from it whenever events are applied (playback,
forward/backward seek, seek to end).
The Host column was padded to 46 chars but never cut, so a long rDNS
name pushed every later column right on that row. Shorten the hostname
with an ellipsis to fit, always keeping the full IP.
--flows only varies the path in UDP/TCP mode, so the example now uses
-p udp. The FreeBSD/NetBSD interface-binding error named -i, which is
--interval; the flag is --interface.
PMTUD only sends its sized probes in ICMP mode, so --pmtud with UDP or
TCP was accepted and silently did nothing. Fail validation with a clear
message; auto and icmp still work.
--theme defaulted to "default" and only non-default values were applied,
so --theme default couldn't switch away from a saved theme. Make the flag
optional and apply whatever was passed.
Instances in separate containers are all PID 1, so they shared an Echo
identifier and each raw socket accepted the other's replies, including
when tracing the same target. Pick a random non-zero id once per process
(std RandomState, no new dependency); engine and receiver both read it
via get_identifier(). DGRAM correlation is unchanged: the payload still
carries the same id for kernels that rewrite the header.
Past a destination NAT (e.g. a load-balancer VIP), routers quote the
translated address, so the strict quoted-destination match lost those
hops. With one target the match is unambiguous, so fall back to it; with
several targets keep dropping. Echo Replies must still come from the
target.
@lance0
lance0 marked this pull request as ready for review October 16, 2026 17:10
@lance0
lance0 merged commit 76970a9 into master Oct 16, 2026
6 checks passed
lance0 added a commit that referenced this pull request Oct 16, 2026
Indicators are now unbracketed title badges (NAT, RL?, ASYM, TTL!, MTU, max_ttl=N, PAUSED) and a dim RL tag after the loss value; INSTALL, KNOWN_ISSUES and the doc index use the new names. KNOWN_ISSUES records that --pmtud is rejected with -p udp/tcp, that replies behind destination NAT are only kept for a single target, and moves instance cross-talk and silent-hop RL flags to Resolved. CHANGELOG gains entries for #163, #164 and #162.
lance0 added a commit that referenced this pull request Oct 16, 2026
* Fix doc claims that drifted from the code

- SCRIPTING: jq recipes used fields that do not exist in the JSON export
  (is_destination, loss_percent, avg_ms, nat_detected) and indexed the
  responders object by position. Rewritten against the real schema, with a
  field table, and the exit-code section no longer implies that exit 0
  means the destination was reached.
- FEATURES: the PeeringDB cache refresh key is Ctrl+R, not r; replay speed
  range is 0.1x-1000x (also > and <); --flows examples now use UDP/TCP,
  since ICMP ignores flows; --pmtud only probes in ICMP mode and conflicts
  with --size; --resolve-all keeps both address families; the config file
  lives under ~/Library/Application Support on macOS. Adds a Detection
  Indicators section, a Config File section, overlay keys, and a CLI
  reference that matches --help (adds --no-update-check, --completions,
  ranges and mode conflicts).
- ARCHITECTURE: module tree, struct locations and field types (ProbeId.seq
  is u8, Hop lives in session.rs, flow_paths not flow_stats).
- SECURITY: supported versions now 0.23.x.
- ROADMAP: add the current-release line.

* Move install, troubleshooting and limitations out of the README

The README becomes a short front door: pitch, quick start, a "What it
finds" list linking to the feature reference, a compact install list,
platform support, and a task-based documentation table.

- docs/INSTALL.md (new): every install channel, permissions (Linux
  setcap, macOS/BSD sudo, containers), shell completions, Windows/WSL2,
  download verification (moved from FEATURES.md), and troubleshooting.
  Lists the aarch64 musl release archive the table was missing.
- KNOWN_ISSUES.md: now the single home for limitations (merged from the
  README). Drops stale entries now resolved in code: the 500us BSD
  inter-probe delay, NetBSD IPv4 PMTUD, and TCP ignoring --rate. Removes
  the ping_group_range claim, which ttl does not use.
- COMPARISON.md: points to INSTALL.md for WSL2 setup instead of repeating
  it, and lists Windows as WSL2-only.
- Every removed README heading keeps its anchor as an <a id> placeholder,
  so existing links to #installation, #permissions-linux,
  #troubleshooting, the use-case sections and others still resolve.

* Add a documentation index

docs/README.md lists every page by area with a one-line scope. CONTRIBUTING points new-feature docs at FEATURES.md and the index rather than the README, lists FreeBSD/NetBSD as experimental tracing platforms, and uses the same clippy command as CI.

* Match docs to the merged TUI polish and correlation fixes

Indicators are now unbracketed title badges (NAT, RL?, ASYM, TTL!, MTU, max_ttl=N, PAUSED) and a dim RL tag after the loss value; INSTALL, KNOWN_ISSUES and the doc index use the new names. KNOWN_ISSUES records that --pmtud is rejected with -p udp/tcp, that replies behind destination NAT are only kept for a single target, and moves instance cross-talk and silent-hop RL flags to Resolved. CHANGELOG gains entries for #163, #164 and #162.
@lance0
lance0 deleted the fix/audit-bugs branch October 16, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant