Skip to content

Commit 9610673

Browse files
committed
Network: fix cidr_of_string_exn
1 parent ce59724 commit 9610673

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

network.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ open Prelude
22

33
let () = assert (Sys.word_size = 64)
44

5+
(* reexport exceptions *)
6+
include (Devkit_ragel : sig
7+
exception Parse_ipv4 of string
8+
exception Parse_compact_duration of string
9+
end)
10+
511
type ipv4 = int32
612
type ipv4_cidr = int32 * int32
713

@@ -69,7 +75,7 @@ let cidr_of_string_exn s =
6975
let ip = ipv4_of_string_exn ip in
7076
Int32.logand ip mask, mask)
7177

72-
let cidr_of_string_exn s = try ipv4_of_string_exn s, -1l with Invalid_argument _ -> cidr_of_string_exn s
78+
let cidr_of_string_exn s = try ipv4_of_string_exn s, -1l with Parse_ipv4 _ -> cidr_of_string_exn s
7379

7480
let range_of_cidr (ip0,mask) = ip0, make_broadcast ip0 mask
7581

0 commit comments

Comments
 (0)