A saved lab forgets every DHCP lease, and without a clock the view calls the survivors active #1465
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge#1465
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Cause
The leases live on the topology (
topo.dhcpStates, aliased by the simulator) — exactly the state the document is meant to carry.Topology.serialize()writes 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 re-issued the same addresses as if they were new.The same shape of mistake sat in the view. A lease's state is a fact about time, and
dhcp.leaseTable()only states it when asked at an instant; without one, rows carry nostateat all — and the summary subtracted the lapsed count from the total and called the rest active, a claim about time the engine had explicitly declined to make:What should be true
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): two Maps that JSON cannot write become one list of leases, and come back as two Maps rebuilt from that one list — so a document can never restore a MAC map and an address map that disagree. An entry naming a device not on the board is skipped; one address keeps one holder, which is the rule the running server applies.no clock, and the summary counts bindings, not states —2 binding(s); no clock is set, so none is lapsed or active yet - the expiry is counted from the instant each lease was granted. With a clock the rows read60sandlapsed (address free)again, unchanged.Evidence:
test/dhcp-leases-survive-save.test.js, 32 checks. Revertingengine/fails 12.Neighbours green:
dhcp134,dhcp-bindings51,dhcp-pool-undo51,state-payload-complete16,flows-survive-save-load16,spec-survives-load32,examples-generated21.Also probed this iteration and found honest, so nothing was changed for them:
show running-configreplay across all four checked-in example labs (19 devices, no drift), an incompleteip dhcp pool(kept deliberately, reported byshow ip dhcp poolasIn use: no - <reason>, and the exit message is a statement about the pool rather than a refusal), and two pools with overlapping ranges (the first match wins consistently; no address is handed to two clients).spanning-tree portfast,vlan 20 name labanddo show vlaneach answered a different question #1493