Skip to content

Commit c0f459a

Browse files
committed
Merge pull request #173 from fugitifduck/0x04_ip_to_mask
ip_to_mask fix:
2 parents 1913858 + 4ff8681 commit c0f459a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/OpenFlow0x04_Core.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ let val_to_mask v =
1919

2020
let ip_to_mask (p,m) =
2121
if m = 32l then { m_value = p; m_mask = None }
22-
else { m_value = p; m_mask = Some m }
22+
else
23+
let m = Int32.shift_left 0xffffffffl (Int32.to_int (Int32.sub 32l m)) in
24+
{ m_value = p; m_mask = Some m }
2325

2426
type switchId = int64
2527

0 commit comments

Comments
 (0)