diff --git a/lib/ipaddr.ml b/lib/ipaddr.ml index 18794c5..64e74f4 100644 --- a/lib/ipaddr.ml +++ b/lib/ipaddr.ml @@ -1354,6 +1354,10 @@ module Prefix = struct | V4 p -> V4 (V4.Prefix.netmask p) | V6 p -> V6 (V6.Prefix.netmask p) + let address = function + | V4 p -> V4 (V4.Prefix.address p) + | V6 p -> V6 (V6.Prefix.address p) + let pp ppf i = Format.fprintf ppf "%s" (to_string i) let first = function diff --git a/lib/ipaddr.mli b/lib/ipaddr.mli index 62f3dec..95124ed 100644 --- a/lib/ipaddr.mli +++ b/lib/ipaddr.mli @@ -777,6 +777,9 @@ module Prefix : sig val netmask : t -> addr (** [netmask subnet] is the netmask for [subnet]. *) + val address : t -> addr + (** [address cidr] is the address for [cidr]. *) + val first : t -> addr (** [first subnet] is first valid unicast address in this [subnet]. *)