Philip Prindeville
e906ccfc8c
base-files: ipcalc.sh: Add tests for unroutable, etc
...
See RFC-1918, RFC-3927, and RFC-1122.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2023-12-12 12:30:35 -07:00
Philip Prindeville
dd256099c3
base-files: ipcalc.sh: Add netmask2prefix function
...
Also add is_contiguous to check if it's a valid netmask.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2023-12-12 12:30:35 -07:00
Philip Prindeville
6cdc429a48
base-files: ipcalc.sh: Add prefix-to-netmask conversion
...
Seems like it might be used in other places, so factor it into the
library.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2023-12-12 12:30:35 -07:00
Philip Prindeville
f0612c0d84
base-files: ipcalc.sh: Add some commentary, etc.
...
Explain some of the more obscure logic, or where we deviate from
what the original awk code did. Also, give a count of the usable
addresses on the subnet.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2023-12-12 12:30:35 -07:00
Philip Prindeville
854739b32c
base-files: ipcalc.sh: Rewrite in pure shell
...
Also add better error checking on input.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2023-12-12 12:30:35 -07:00