logo

utils-cidr

utilities to manipulate CIDR ip-ranges git clone https://anongit.hacktivis.me/git/utils-cidr.git

cidr2list.1 (1292B)


  1. .\" utils-cidr: utilities to manipulate CIDR ip-ranges
  2. .\" Copyright 2025 Haelwenn (lanodan) Monnier <contact+utils-cidr@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .Dd October 18, 2025
  5. .Dt CIDR2LIST 1
  6. .Os
  7. .Sh NAME
  8. .Nm cidr2list
  9. .Nd expand CIDR ranges into a list
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Sh DESCRIPTION
  13. .Nm
  14. reads CIDR ranges and CIDR-less IPv4 addresses from standard
  15. input and prints the full list of the addresses of their range,
  16. assuming a /32 for CIDR-less addresses.
  17. .Sh EXIT STATUS
  18. .Ex -std
  19. .Sh EXAMPLES
  20. .Bd -literal
  21. $ printf '%s\en' 192.168.0.42/31 192.168.0.69/31 | cidr2list
  22. 192.168.0.42
  23. 192.168.0.43
  24. 192.168.0.68
  25. 192.168.0.69
  26. .Ed
  27. .Sh RATIONALES
  28. .Nm
  29. doesn't supports IPv6 because the typical usage would be extremely
  30. large ranges like /48 and /64 which would respectively imply
  31. printing 2^(128-48) and 2^(128-64) IPv6 addresses.
  32. Which cannot fit into current (2025) storage, let alone RAM.
  33. .Pp
  34. Meanwhile listing out 0.0.0.0/0 (all of IPv4),
  35. is exactly 2^32\ *\ 4\ =\ 16\ GiB if kept in binary representation,
  36. and less than 2^32\ *\ (3*4\ +\ 3\ +\ 1)\ =\ 64\ GiB in textual representation.
  37. .Pp
  38. Testing it out, it takes 61\ 337\ 501\ 696\ bytes\ (~57.125\ GiB), and about
  39. 17\ minutes with
  40. .Nm
  41. going at ~54.8MiB/s.
  42. .Sh AUTHORS
  43. .An Haelwenn (lanodan) Monnier Aq Mt contact@hacktivis.me