Ipaddr of_octet functions (#117, @ryangibb).V6.to_int64 (reported by @RyanGibb in #113)with_port_of_string function (@dinosaure, @hannesm, #108)Ipaddr.of_string (@dinosaure, @hannesm, #109) Before this release, Ipaddr.of_string accepts remaining bytes and returns a valid value such as "127.0.0.1aaaa" is valid. Now, ipaddr does not accept a string with remaining bytes.Do not zero out the non-prefix-length part of the address in {V4,V6}.Prefix.t (#99 @hannesm) Removed {V4,V6}.Prefix.of_address_string{,_exn} and {V4,V6}.Prefix.to_address_{string.buffer}
To port code:
Prefix.of_string to zero out the non-prefix-length address bits, call Prefix.prefix : t -> t subsequently.Prefix.of_address_string{,_exn} can be replaced by Prefix.of_string{,_exn}, to retrieve the address use Prefix.address : t -> addr.Prefix.to_address_{string,buffer} can be replaced by Prefix.to_{string,buffer}, where Prefix.t already contains the IP address to be printed.{V4,V6}.t * {V4,V6}.Prefix.t for an address and subnet configuration, {V4,V6}.Prefix.t is sufficient.{V4,V6,}.succ, {V4,V6,}.pred, {V4,V6}.Prefix.first, and {V4,V6}.Prefix.last functions (#94 @NightBlues)Prefix.of_netmask to Prefix.of_netmask_exn with labelled arguments (~netmask and ~address), provide Prefix.of_netmask which returns a (t, [> `Msg of string ]) result value (#95 @hannesm)V4.Prefix.mem with a CIDR with prefix length 0 (#98 @verbosemode)Rename the to/from_bytes functions to refer to octets instead. This distinguishes the meaning of human-readable addresses (strings in this library) and byte-packed representations(octets in this library) from the OCaml bytes type that represents mutable strings.
Porting code should just be a matter of renaming functions such as:
Ipaddr.of_bytes becomes Ipaddr.of_octetsMacaddr.to_bytes becomes Macaddr.to_octetswrite_octets functions that can write octet representations of IPv4/v6 into an existing bytestring.domain-name library to produce domain names from IP addresses.ipaddr.sexp and macaddr.sexp ocamlfind subpackages and instead have ipaddr-sexp and macaddr-sexp to match the opam package names.Ipaddr_cstruct and Macaddr_cstruct libraries for conversion to/from cstructs (#36 @nojb @avsm)Not_found exception when parsing [: in IPv6 and instead raise Parse_error as other errors do (found by fuzz testing in #84 by @dinosaure)[@@ocaml.toplevel_printer]. This enables utop to automatically install the printers (@avsm)This release features several backwards incompatible changes, but ones that should increase the portability and robustness of the library.
Remove the sexp serialisers from the main interface in favour of pp functions. Use the Ipaddr_sexp module if you still need a sexp serialiser.
To use these with ppx-based derivers, simply replace the reference to the Ipaddr type definition with Ipaddr_sexp. That will import the sexp-conversion functions, and the actual type definitions are simply aliases to the corresponding type within Ipaddr. For example, you might do:
type t = {
ip: Ipaddr_sexp.t;
mac: Macaddr_sexp.t;
} [@@deriving sexp]The actual types of the records will be aliases to the main library types, and there will be two new functions available as converters. The signature after ppx has run will be:
type t = {
ip: Ipaddr.t;
mac: Macaddr.t;
}
val sexp_of_t : t -> Sexplib0.t
val t_of_sexp : Sexplib0.t -> tMacaddr module into a separate opam package so that the Ipaddr module can be wrapped. Use the macaddr opam library now if you need just the MAC address functionality.of_string/bytes functions that formerly returned option types with the Rresult result types instead. This stops the cause of the exception from being swallowed, and the error message in the new functions can be displayed usefully.Ipaddr.V6.to_string and to_buffer functions, remove the optional labelled argument v4 and always output v4-mapped strings as recommended by RFC5952. (#80 by @hannesm).pp_hum which was deprecated in 2.9.0.pp functions for prettyprinting and deprecate pp_hum variants. The two functions are currently the same, so porting is just a matter of replacing existing uses of pp_hum with pp (#71 @verbosemode)base-unix depopt to be a real dependency (#68 @rgrinberg).sexplib dependency (#66 #67 @bmillwood).ipaddr.top package by linking to compiler-libs instead of compiler-libs.toplevel (#76 @avsm based on fix in mirage/ocaml-uri#130 by @yallop)Ipaddr_unix is now in a separate subdirectory. This means that packages that implicitly depended on the module without including the ocamlfind ipaddr.unix package may now fail. Just adding the ocamlfind dependency will fix it, and is backwards compatible with older Ipaddr releases.ppx_sexp_conv with Jbuilder also having that as the minimum supported compiler version.sexplib.syntax, type_conv deps and camlp4 transitive dependencyppx_sexp_conv dependencyIpaddr.Prefix.subset, Ipaddr.V4.Prefix.subset and Ipaddr.V6.subset predicates to test containment of subnets (#52 from @seliopou)to_bytes_raw now uses Bytes.t rather than string (potentially breaking)to_domain_name conversions to DNS label lists (in-addr.arpa and ip6.arpa)V6.interface_routers, V6.site_routers, and V6.Prefix.solicited_nodeV6.link_address_of_mac to convert a MAC into a link local IP addresswith sexp (de)serializers to all of the Ipaddr and Macaddr types. (#31)Ipaddr.V6.Prefix.of_netmask for conversion from an IPv6 address/netmask to prefix (useful for some binary interfaces). See #27.Ipaddr.V6.Prefix.netmask to generate a netmask address from a prefix (useful for some binary interfaces). See #27.Ipaddr.Prefix.network for generic prefix -> address conversionIpaddr.Prefix.netmask for generic prefix -> netmask conversionIpaddr.V4.Prefix.of_netmask for conversion from an address/netmask to prefixIpaddr.V4.Prefix.netmask to generate a netmask address from a prefixipaddr.top package.of_string_raw to Ipaddr.V4.Prefix and Ipaddr.V6.Prefixof_addr to Ipaddr.V4.Prefix and Ipaddr.V6.Prefix('v4,'v6) v4v6 to Ipaddr to represent version disjunctsIpaddr.Prefix module for generic prefix manipulationIpaddr.V4.make to accept int rather than int32 (breaking)scope for classifying address scopesIpaddr.V4.of_string_raw for parsing inside of larger stringsIpaddr.V4.to_int16 and Ipaddr.V4.of_int16unspecified, nodes, and routers constants to Ipaddr.V4Ipaddr.V4.Prefix.network_address to put an address into a subnetof_address_string_exn, of_address_string, to_address_string, to_address_buffer to Ipaddr.V4.Prefix to parse/print combined addr/prefixmulticast_org, multicast_admin, multicast_link subnet constants to Ipaddr.V4.PrefixIpaddr.V4.scope to classify IPv4 addressesIpaddr.V4.is_global and Ipaddr.V4.is_multicast predicatessep:char argument to Macaddr.to_stringIpaddr.V4.Prefix.bits function to produce bits of prefix from prefix.Macaddr.make_local function to create local unicast MAC addresses from an octet generation function.Macaddr.get_oui accessor to extract the Organizationally Unique Identifier as an integer.Macaddr.is_local predicate to test for a locally administered address.Macaddr.is_unicast predicate to test for a unicast MAC address.Ipaddr.V4.any, Ipaddr.V4.broadcast, Ipaddr.V4.localhost special constant addresses.Ipaddr.V4.Prefix.global (0.0.0.0/0) subnet constant.Ipaddr.V4.Prefix.network function to produce subnet address from prefix.Macaddr module for handling MAC-48 (Ethernet) addresses.Ipaddr.Parse_error now contains both the error condition and the failing input.