dhcp: a MAC is the same 48 bits in every notation the console prints #1863
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!1863
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/1117-1506"
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?
Fixes #1861
What was wrong. The DHCP console decided what a hardware address is with three private shapes of its own - a colon-only regex in
host, a/:/.test(...)inno host, and a third copy in theshow ip dhcp bindingfilter - while everything else on the box uses one rule:net.formatMac()prints dotted (0200.0000.0001) anddhcp.normalizePool()canonicalises any spelling. So the address the console prints was refused as "neither" an address nor a MAC, and a lease held by exactly that MAC was answeredno lease holds that address.What changed.
macSpelling(token)next to the other small helpers: asksnet.macToInt(the engine's rule) and returns the canonical colon form, or null. An IPv4 address is never a MAC, even where its digits read as twelve hex characters (100.100.100.100).host <address> <mac>uses it, so colon, hyphen and dotted spellings all work in either order, and the reservation is stored once under the canonical form.no hostuses it, so a reservation added dotted is removable dotted; a miss now names the token that was typed instead of saying only "in pool lan".show ip dhcp binding <mac>uses it, so a dotted MAC finds its lease instead of being answered as an address lookup.docs/CLI.md§DHCP server says the same.Tests.
test/dhcp-bindings.test.js, new sections "A hardware address is accepted in every notation this console prints it in" and "A lease is found by the MAC the console prints elsewhere": 7 new assertions (66 -> 67 in that file), red before the fix.Gates:
node scripts/syntax-check.js(389 files OK); fullnpm test317 suites, 11,053 assertions, 0 failed.Not done, deliberately:
show ip dhcp bindingstill prints MACs colon-separated while the rest of the console prints dotted. That is a display question of its own and is called out in the issue.3bf2c846a54ba2f84293