Link state is decoration: a cable marked down still carries traffic #1057

Closed
opened 2026-11-08 09:01:16 +00:00 by jaylouisw · 0 comments
Owner

Link has carried state: 'up' | 'down' | 'blocked' since the physical layer was built, and
nothing in the engine ever reads it:

$ grep -rn "isUp()" engine/*.js
engine/link.js:  isUp() { return this.state !== 'down'; }      # defined
                                                                 # ... and never called

Link.isUp() exists, is exported, is serialised, and has no caller. So a cable marked down:

  • still carries every frame;
  • still counts as a bridge port, so the spanning tree never notices a failure;
  • is still walked by the DHCP segment search, so a cut cable still hands out leases;
  • is still drawn identically to a working cable.

The field is decoration. The failure it hides is total: a lab can show a cut link passing
traffic
, which is the one thing a network simulator must never do.

What a lab needs

Pulling a cable is the single most common thing a technician does in Packet Tracer, and this project
has no word for it. topo.disconnect() deletes the link, which is a different operation: the ports
unpatch, the hardware changes, and the cable never comes back. What is missing is:

  1. A link that is down, not gone. Ports stay patched, colours stay as catalogued, nothing passes.
  2. The network reacting. STP rebuilds and a redundant topology heals; MAC tables flush so frames
    are not unicast into the port that used to lead somewhere.
  3. Re-convergence. The control-plane timers run again from the instant of the change, so a lab
    can show the window in which nothing works — and the answer at any instant inside it says
    converging rather than "host unreachable", which is a different and wrong diagnosis.
  4. The change survives a save. A lab saved with a cable down must load with it down, at the same
    instant, and still report the correct convergence window.
  5. A visible difference on the canvas. A failed link is the most important thing on the page.
  6. A way to do it from the CLI, so a script can express it: link down <id> at <ms>.

Acceptance

  • A frame crossing a down link is dropped with reason: 'link down' and the link id.
  • A down link is not a bridge port; breaking one of two paths keeps the lab working.
  • Breaking the last path stops it, and healing it restores it.
  • With a change at 10 s, a ping at 11 s and at 20 s fails with reason: 'converging'; at 41 s it
    succeeds, and getConvergence().convergedAtMs is 40 000.
  • Every bridge's MAC table is empty after a change.
  • A DHCP client behind a cut cable gets no lease.
  • link state/stateSinceMs/lastChangeAtMs round-trip through save/load; links that never changed
    carry no new field, so regenerated examples stay byte-identical.
  • link up|down|state and links in the CLI with the usages above; POST /api/topologies/:id/links/:linkId/state; a down cable drawn dashed and red.

Not in scope

Degraded links (no CRC errors, no flapping), autonegotiation on recovery, interface self-test
failures, and RSTP fast convergence — the timer model is 802.1D, so re-convergence costs the same
30 s as a boot. These are documented in docs/LINK-STATE.md rather than half-implemented.

`Link` has carried `state: 'up' | 'down' | 'blocked'` since the physical layer was built, and **nothing in the engine ever reads it**: ``` $ grep -rn "isUp()" engine/*.js engine/link.js: isUp() { return this.state !== 'down'; } # defined # ... and never called ``` `Link.isUp()` exists, is exported, is serialised, and has no caller. So a cable marked `down`: - still carries every frame; - still counts as a bridge port, so the spanning tree never notices a failure; - is still walked by the DHCP segment search, so a cut cable still hands out leases; - is still drawn identically to a working cable. The field is decoration. The failure it hides is total: **a lab can show a cut link passing traffic**, which is the one thing a network simulator must never do. ## What a lab needs Pulling a cable is the single most common thing a technician does in Packet Tracer, and this project has no word for it. `topo.disconnect()` deletes the link, which is a *different* operation: the ports unpatch, the hardware changes, and the cable never comes back. What is missing is: 1. **A link that is down, not gone.** Ports stay patched, colours stay as catalogued, nothing passes. 2. **The network reacting.** STP rebuilds and a redundant topology heals; MAC tables flush so frames are not unicast into the port that used to lead somewhere. 3. **Re-convergence.** The control-plane timers run again *from the instant of the change*, so a lab can show the window in which nothing works — and the answer at any instant inside it says `converging` rather than "host unreachable", which is a different and wrong diagnosis. 4. **The change survives a save.** A lab saved with a cable down must load with it down, at the same instant, and still report the correct convergence window. 5. **A visible difference on the canvas.** A failed link is the most important thing on the page. 6. **A way to do it from the CLI**, so a script can express it: `link down <id> at <ms>`. ## Acceptance - A frame crossing a down link is dropped with `reason: 'link down'` and the link id. - A down link is not a bridge port; breaking one of two paths keeps the lab working. - Breaking the last path stops it, and healing it restores it. - With a change at 10 s, a ping at 11 s and at 20 s fails with `reason: 'converging'`; at 41 s it succeeds, and `getConvergence().convergedAtMs` is 40 000. - Every bridge's MAC table is empty after a change. - A DHCP client behind a cut cable gets no lease. - `link state`/`stateSinceMs`/`lastChangeAtMs` round-trip through save/load; links that never changed carry no new field, so regenerated examples stay byte-identical. - `link up|down|state` and `links` in the CLI with the usages above; `POST /api/topologies/:id/links/:linkId/state`; a down cable drawn dashed and red. ## Not in scope Degraded links (no CRC errors, no flapping), autonegotiation on recovery, interface self-test failures, and RSTP fast convergence — the timer model is 802.1D, so re-convergence costs the same 30 s as a boot. These are documented in `docs/LINK-STATE.md` rather than half-implemented.
Sign in to join this conversation.
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#1057
No description provided.