ocaml-ipaddr
ocaml-ipaddr copied to clipboard
Inconsistency in V4.Prefix.of_string / V6.Prefix_of_string regarding trailing chars
This bit me today while working on a library to parse pf rules and was a little bit tricky to track down (with a trailing comma):
utop # Ipaddr.Prefix.of_string "172.16.0.0/12xxx";;
- : Ipaddr.Prefix.t option = Some 172.16.0.0/12
utop # Ipaddr.V4.Prefix.of_string "172.16.0.0/12xxx";;
- : Ipaddr.V4.Prefix.t option = None
EDIT: I forgot to mention that I prefer the latter (fail hard on invalid input). :-)
EDIT2: ping @djs55