A saved lab forgot who was holding which address #1466
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!1466
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/dhcp-leases-survive"
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?
Closes #1465
The leases live on the topology (
topo.dhcpStates, aliased by the simulator) — exactly the state the document carries.Topology.serialize()wrote the flows for that reason (#1435) and never wrote the leases, so a server that had answered two hosts reopened claiming nobody had ever asked. And becausedhcp.leaseTable()only states a lease's state when asked at an instant, the view — with no clock — called every row active anyway:The change
dhcp: { <deviceId>: { leases: [...] } }, written only when a device holds one, so a board without a DHCP server produces byte-identical documents and the checked-in examples are untouched;engine/dhcp.js, the module that owns the lease state's shape: two Maps become one list of leases and come back as two Maps rebuilt from that list, so a document can never restore a MAC map and an address map that disagree. An entry naming a device that is not on the board is skipped; one address keeps one holder, the rule the running server applies;no clockand the summary counts bindings: With a clock the same rows read60sandlapsed (address free)again, word for word as before.Evidence
test/dhcp-leases-survive-save.test.js, 32 checks: the document's lease records matching the bindings the server reported; nodhcpblock on a board with no leases; a reopened lab holding its bindings before anything is run and no longer claiming nobody asked;no clockwith no active/lapsed claim, then2 active binding(s)at the granting instant and0 active binding(s), 2 lapsedpast expiry; the codec keeping one holder per address, dropping entries with no address or no holder, and decoding nothing to an empty state rather than a crash; a ghost server skipped; the checked-in examples carrying nodhcpblock.Reverting
engine/fails 12/32.Neighbours green:
dhcp134,dhcp-bindings51,dhcp-pool-undo51,state-payload-complete16,flows-survive-save-load16,spec-survives-load32,examples-generated21.Docs:
docs/ARCHITECTURE.md§ "A saved lab forgot who was holding which address".