The DHCP server can say who holds which address, and a lapsed lease comes back (#1373) #1374
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!1374
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/dhcp-bindings"
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?
The DHCP server can now say who holds which address, and a lapsed lease comes back. Fixes #1373.
DHCP has been modelled end to end since it was: pools, ranges, exclusions, reservations, lease times, renewals and
expiry. The server keeps an allocation table — MAC → address, and when it comes back — and nothing could read
it: there was no
show ip dhcpat all. Same family asshow power inline(#1295), the STP election (#1365), NAT(#1367) and OSPF (#1371): the mechanism exists and the surface does not.
Two commands, reading the engine's own table
Capacity is counted the way allocation counts it (
dhcp.poolCapacity): endpoints in, network/broadcast out,exclusions out, the gateway out when it sits inside the range. Reservations count, because they are allocatable to
their owner.
An unknown MAC, address or pool name is reported with the reason — never an empty table:
A second defect, found while making the table readable
Nothing ever called
expireLeases(). A lease that had lapsed held its address for the life of the run, so asmall pool could be exhausted by clients that were long gone — and
showwould have reported them as activeforever. Leases now expire at the instant the question is asked (
runAtMs, converted into the secondsdhcp.jscounts in, in one place), and the lapsed row stays in the table marked
lapsed (address free).A third, found by probing the command I expected to work
host <mac> <address>is the same reservation ashost <address> <mac>, and the handler stored it verbatim — sothe pool ended up keyed by the address,
{"192.168.10.104": "aa:bb:cc:00:00:98"}, and said nothing untilexitrefused the whole pool with "reservation key ... is not a valid MAC address". The two tokens are now toldapart by shape, both orders are accepted, and a pair that is neither is refused where it is typed, naming both
accepted orders.
Evidence
test/dhcp-bindings.test.js— 51 checks: the pool view is the pool the server answers from and its capacity iscounted the way allocation counts; bindings name their pool and lease length and match the address the client
actually holds; a binding can be asked for by MAC or address and an unknown one is reported; in a one-address
pool, a host that stops asking loses the address when its lease lapses and the other host gets it (before the
fix the address was never freed and the second host was refused); a reserved address is marked; both reservation
orders store the same way round and a wrong pair is refused at the point of the typo; without a run the console
says nothing has been evaluated.
engine/cli.js→ 34 of 51 failengine/dhcp.jsorengine/simulator.js→ the suite cannot run at all (poolCapacity,dhcpBindings)helpgains the command;docs/CLI.mdgains "Reading DHCP";docs/SIMULATION.mdgains the row that says DHCP isnow reported and that expiry happens at the instant asked.
Suite: 190 suites, 7,352 assertions, 0 failed. Syntax: 258 files, OK.