TRACEROUTE: stop at a down link or a shut port, and name it (#1516) #1610

Merged
jaylouisw merged 5 commits from fix/1116-0505 into main 2026-11-16 05:16:50 +00:00
Owner

Fixes #1516

What was wrong

traceroute never consulted link state in what it reported. With a cable pulled mid-path, ping failed honestly with link down while the trace printed thirty identical * no reply hops and never named the drop the engine had recorded. The success flag was already correct; the evidence was not.

(I checked the issue's own premise first: there is no tracePath anywhere in this repository — engine/simulator.js traceroute() is the trace path, and it never returns arrived: true over a down link. What it does do is say nothing about why it stopped, which is the real defect and what this fixes.)

What changed

  • engine/simulator.js traceroute(): each silent hop now carries dropped — the discard reason recorded for that probe. A structural cause (peer port shut, link administratively down, link down, no egress ports, ACL, VLAN not allowed) is looked for before _lastDiscard()'s ranking, because the ranking puts the no ARP reply from X conclusion above an unranked link down — right for ping, wrong for a trace.
  • A structural cause ends the walk where the wire ended, instead of probing to the 30-hop ceiling.
  • engine/cli.js _traceroute(): prints the reason beside the star — 2 * no reply (link down (dropped by d2)).

Verification

test/icmp-errors-traceroute.test.js — 15 new checks, 54/54. Against the previous simulator 7 fail, including expected 2, got 30 and undefined for the cause.

  • downed R1-R2 cable: ping false, trace success: false, 2 hops, hop 2 dropped: 'link down (dropped by d2)'
  • shut R2 Gi0/0: 2 hops, hop 2 dropped: 'peer port shut (...)'
  • console: 2 * no reply (link down ...), no hop 3, % destination not reached after 2 hops
  • a healthy trace still shows 3 hops and no hop marked as a drop

Full suite 267 suites / 9658 assertions / 0 failed; node scripts/syntax-check.js 337 files OK.

Not done

The issue also asked that a trace never be more optimistic than the data plane. It already isn't on success; I verified that with a ping/trace pair per cable position. No new features were added.

Fixes #1516 ## What was wrong `traceroute` never consulted link state *in what it reported*. With a cable pulled mid-path, `ping` failed honestly with `link down` while the trace printed thirty identical `* no reply` hops and never named the drop the engine had recorded. The `success` flag was already correct; the evidence was not. (I checked the issue's own premise first: there is no `tracePath` anywhere in this repository — `engine/simulator.js` `traceroute()` is the trace path, and it never returns `arrived: true` over a down link. What it does do is say nothing about why it stopped, which is the real defect and what this fixes.) ## What changed - `engine/simulator.js` `traceroute()`: each silent hop now carries `dropped` — the discard reason recorded for that probe. A structural cause (`peer port shut`, `link administratively down`, `link down`, `no egress ports`, `ACL`, `VLAN not allowed`) is looked for *before* `_lastDiscard()`'s ranking, because the ranking puts the `no ARP reply from X` conclusion above an unranked `link down` — right for ping, wrong for a trace. - A structural cause ends the walk where the wire ended, instead of probing to the 30-hop ceiling. - `engine/cli.js` `_traceroute()`: prints the reason beside the star — ` 2 * no reply (link down (dropped by d2))`. ## Verification `test/icmp-errors-traceroute.test.js` — 15 new checks, **54/54**. Against the previous simulator **7 fail**, including `expected 2, got 30` and `undefined` for the cause. - downed R1-R2 cable: ping false, trace `success: false`, 2 hops, hop 2 `dropped: 'link down (dropped by d2)'` - shut R2 Gi0/0: 2 hops, hop 2 `dropped: 'peer port shut (...)'` - console: `2 * no reply (link down ...)`, no hop 3, `% destination not reached after 2 hops` - a healthy trace still shows 3 hops and no hop marked as a drop Full suite **267 suites / 9658 assertions / 0 failed**; `node scripts/syntax-check.js` 337 files OK. ## Not done The issue also asked that a trace never be *more optimistic* than the data plane. It already isn't on `success`; I verified that with a ping/trace pair per cable position. No new features were added.
TRACEROUTE: a probe stopped by a down cable or a shut port ends the walk and names the cause (#1516)
Some checks failed
CI / Classify the change (pull_request) Successful in 18s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 25s
CI / Test (Node 20) (pull_request) Failing after 27s
CI / Server smoke test (pull_request) Successful in 1m0s
CI / Docker build (pull_request) Has started running
CI / Test (Node 22) (pull_request) Successful in 1m52s
CI / Test (Node 18) (pull_request) Successful in 2m10s
baa83c8aec
traceroute never consulted link state in its *reporting*: after a cable was
pulled, ping correctly failed with 'link down', while the trace printed thirty
identical '*  no reply' hops and never named the drop the engine had recorded.
A trace is the evidence an operator pastes into a ticket, so it must not say
less than the ping beside it.

Each silent hop now carries the discard reason for that probe - a structural
cause (peer port shut, link administratively down, link down, no egress ports,
ACL, VLAN) outranks the 'no ARP reply' conclusion drawn from the silence that
followed it - and a structural cause ends the walk where the wire ended instead
of probing to the 30-hop ceiling. The console prints the reason beside the star.

test/icmp-errors-traceroute.test.js: 15 new checks (54/54); against the previous
simulator 7 of them fail, including 'expected 2, got 30'. Full suite 267 suites
/ 9658 assertions / 0 failed; syntax 337 files.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 05:16:39 +00:00
jaylouisw force-pushed fix/1116-0505 from baa83c8aec
Some checks failed
CI / Classify the change (pull_request) Successful in 18s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 25s
CI / Test (Node 20) (pull_request) Failing after 27s
CI / Server smoke test (pull_request) Successful in 1m0s
CI / Docker build (pull_request) Has started running
CI / Test (Node 22) (pull_request) Successful in 1m52s
CI / Test (Node 18) (pull_request) Successful in 2m10s
to 0e6c78b961
Some checks failed
CI / Classify the change (pull_request) Waiting to run
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 32s
CI / Test (Node 18) (pull_request) Has been cancelled
CI / Test (Node 20) (pull_request) Has been cancelled
CI / Test (Node 22) (pull_request) Has been cancelled
CI / Server smoke test (pull_request) Has been cancelled
CI / Docker build (pull_request) Has been cancelled
2026-11-16 05:16:44 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!1610
No description provided.