A netmask is validated nowhere, and four modules disagree about what 255.0.255.0 means #1249
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge#1249
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?
What happens
ip addressaccepts a mask that is not a netmask, and the components that read that mask disagree aboutwhat it means:
255.0.255.0is a valid IPv4 address and not a netmask: it has no prefix length. Measured, on fourimplementations of the same question:
engine/net.js prefixOf()engine/dhcp.js maskContiguous()engine/ospf.js maskPrefix()web/app.js maskBits()255.0.255.0255.255.255.253255.255.0.255So the console accepted it, the router routes on the raw mask, and the inspector you open to find out why
the link behaves oddly summarises it as
/16— a number that describes nothing.The quieter half
That stored the string
"24". Anything that parses a dotted mask — including the front panel — reads it as0.0.0.24and prints/2.Third, smaller: the refusal printed the wrong argument.
Expected
engine/net.js, used by the console, the DHCP pool validator andOSPF, instead of three private implementations;
ip addressrefuses a non-contiguous mask and says so, naming the mask, and leaves the previous addressuntouched;
?for a mask that has no prefix length, rather than aconfident number;
still carries a bad mask.
Scope
Validation of an existing command, and de-duplication of an existing rule. No new commands, no change to
what a valid mask means.