Send ICMP errors, and build traceroute on them #1484
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1484
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/icmp-errors-traceroute"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Send ICMP errors, and build traceroute on them
The engine decremented TTL, watched it hit zero, and dropped the packet with an event only the simulator can read. Same for no route. So
traceroutewas impossible in principle — the command works by provoking time exceeded from each hop in turn, and no hop ever answered — and a lab could not tell "the packet died at hop 3" from "the packet died here".ICMP errors —
_icmpErrorTo()sends type 11 (time exceeded, code 0) on TTL expiry and type 3 (destination unreachable, code 0) when there is no route, sourced from the router's address on the ingress interface and sent back out the interface the packet arrived on. It refuses to answer an ICMP error with an ICMP error, and refuses broadcast sources: that guard is what stops a routing loop becoming a storm._sendIcmp()now takes a TTL so a probe can be aimed at one hop.Traceroute —
Simulator.traceroute()plus CLItraceroute <ip>/tracert. Probes carry TTL 1, 2, 3 …, so the nth router expires one and names itself; the probe that reaches the destination returns as an echo reply; a silent hop prints*. A destination-unreachable ends the trace with a refusal instead of grinding tomaxHops, which is what a real one does.Two things I got wrong by reading instead of running:
ownsIpOn()will not treat it as local. That is a real modelling question about ingress-vs-egress ownership, not something this PR quietly changes.docs/SIMULATION.md§3.2 said ICMP errors and traceroute were absent; rewritten.docs/CLI.mdgains the command. 84 suites, 4220 assertions, 39 new intest/icmp-errors-traceroute.test.js.The engine decremented TTL, watched it reach zero and dropped the packet with an event only the simulator can read. It did the same when it had no route. So traceroute was impossible in principle: the command works by provoking 'time exceeded' from each hop in turn, and no hop ever answered. It also meant a lab could not tell 'the packet died at hop 3' from 'the packet died here'. _icmpErrorTo() sends type 11 (time exceeded, code 0) on TTL expiry and type 3 (destination unreachable, code 0) on no route, from the router's address on the ingress side, back out the interface the packet arrived on. It refuses to answer an ICMP error with an ICMP error and refuses broadcast sources: that guard is what keeps a routing loop from becoming a storm. Simulator.traceroute() and a CLI 'traceroute <ip>' ('tracert'): probes carry TTL 1, 2, 3 ... so the nth router expires one and names itself; the probe that reaches the destination comes back as an echo reply. A silent hop prints '*'. A destination-unreachable ends the trace with a refusal rather than a timeout, which is what a real one does. Two things learned by running it rather than reading it: a TTL-1 probe to an unroutable network dies of TTL at the first router before anyone evaluates the route (so the refusal is at hop 2, not hop 1 - my first test asserted the wrong thing), and an address on the router's other interface is not treated as local, so a probe aimed at a far-side address of the first hop times out rather than being answered. The second is a real modelling question filed separately, not papered over here. docs/SIMULATION.md 3.2 rewritten - it said ICMP errors and traceroute were absent. 84 suites, 4220 assertions, 39 new in test/icmp-errors-traceroute.test.js.f80067cdeef544e238abRebased onto
mainand landed (73718ab4). Two things came out of doing it by hand rather than with the API's "update" endpoint:The red was a fossil, not a regression. This branch was based on
d6a9db08(2026-11-08), whose tree still contained the GitHub-legacycodeql.ymlthatdd8b024alater dropped frommain. Apull_requestrun takes its workflow files from the head branch, so every check list for this PR showedCodeQL / Analyze = failure— a workflow that no longer exists anywhere onmain. The rebase removed the file with the base, and the failure went with it. Nothing was deleted to make it go away.Rebasing put the branch in front of a guard written after it.
test/event-legend.test.js(#1475) enumerates every event type emitted inengine/and requires the packet log to render a sentence for each. This branch emitsicmp-errorandtraceroute-probe, and both fell through to their bare type names.web/app.jsnow names them:Only fields the emit sites actually carry (the legend suite checks that too).
Verified before pushing:
icmp-errors-traceroute39/39,event-legend18/18, full suite 240 suites / 8,917 assertions with only the two legend failures that are now fixed. Post-merge onmain: 39 and 18, tree clean.helplisted neither of the two features landed yesterday, nor the DHCP pool sub-mode #1491max <n>caps the walk the index has promised since #1484 #2437