ocaml-ipaddr icon indicating copy to clipboard operation
ocaml-ipaddr copied to clipboard

Inconsistency in V4.Prefix.of_string / V6.Prefix_of_string regarding trailing chars

Open cfcs opened this issue 8 years ago • 0 comments

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

cfcs avatar Dec 15 '17 16:12 cfcs