diff --git a/client_eth.ml b/client_eth.ml index 87965c2..798ea5e 100644 --- a/client_eth.ml +++ b/client_eth.ml @@ -35,7 +35,7 @@ let classify t ip = match ip with | Ipaddr.V6 _ -> `External ip | Ipaddr.V4 ip4 -> - if ip4 === t.client_gw then `Client_gateway + if ip4 = t.client_gw then `Client_gateway else match lookup t ip4 with | Some client_link -> `Client client_link | None when Ipaddr.V4.Prefix.mem ip4 t.prefix -> `Unknown_client ip @@ -48,7 +48,7 @@ module ARP = struct } let lookup t ip = - if ip === t.net.client_gw then Some t.client_link#my_mac + if ip = t.net.client_gw then Some t.client_link#my_mac else match IpMap.find ip t.net.iface_of_ip with | Some client_iface -> Some client_iface#other_mac | None -> None @@ -97,7 +97,7 @@ module ARP = struct let open Arpv4_wire in let req_ipv4 = Ipaddr.V4.of_int32 (get_arp_tpa frame) in Log.info "who-has %s?" (fun f -> f (Ipaddr.V4.to_string req_ipv4)); - if req_ipv4 === t.client_link#other_ip then ( + if req_ipv4 = t.client_link#other_ip then ( Log.info "ignoring request for client's own IP" Logs.unit; None ) else match lookup t req_ipv4 with diff --git a/client_net.ml b/client_net.ml index 7409743..03d37ac 100644 --- a/client_net.ml +++ b/client_net.ml @@ -30,7 +30,7 @@ let input_arp ~fixed_arp ~eth request = (** Handle an IPv4 packet from the client. *) let input_ipv4 ~client_ip ~router frame packet = let src = Wire_structs.Ipv4_wire.get_ipv4_src packet |> Ipaddr.V4.of_int32 in - if src === client_ip then Firewall.ipv4_from_client router frame + if src = client_ip then Firewall.ipv4_from_client router frame else ( Log.warn "Incorrect source IP %a in IP packet from %a (dropping)" (fun f -> f Ipaddr.V4.pp_hum src Ipaddr.V4.pp_hum client_ip); diff --git a/unikernel.ml b/unikernel.ml index 4b5c6fa..8d54153 100644 --- a/unikernel.ml +++ b/unikernel.ml @@ -62,7 +62,7 @@ module Main (Clock : V1.CLOCK) = struct Log.info "agents connected in %.3f s (CPU time used since boot: %.3f s)" (fun f -> f (Clock.time () -. start_time) (Sys.time ())); (* Watch for shutdown requests from Qubes *) - let shutdown_rq = OS.Lifecycle.await_shutdown () >|= function `Poweroff | `Reboot -> () in + let shutdown_rq = OS.Lifecycle.await_shutdown () >>= function `Poweroff | `Reboot -> return () in (* Set up networking *) let net_listener = network qubesDB in (* Run until something fails or we get a shutdown request. *) diff --git a/uplink.ml b/uplink.ml index dbe9f82..fa53f84 100644 --- a/uplink.ml +++ b/uplink.ml @@ -44,11 +44,7 @@ module Make(Clock : V1.CLOCK) = struct let connect config = let ip = config.Dao.uplink_our_ip in - Netif.connect "tap0" >>= function - | `Error (`Unknown msg) -> failwith msg - | `Error `Disconnected -> failwith "Disconnected" - | `Error `Unimplemented -> failwith "Unimplemented" - | `Ok net -> + Netif.connect "tap0" >>= or_fail "Can't connect uplink device" >>= fun net -> Eth.connect net >>= or_fail "Can't make Ethernet device for tap" >>= fun eth -> Arp.connect eth >>= or_fail "Can't add ARP" >>= fun arp -> Arp.add_ip arp ip >>= fun () -> diff --git a/utils.ml b/utils.ml index 2ea2cb4..a02f088 100644 --- a/utils.ml +++ b/utils.ml @@ -52,8 +52,6 @@ let fixup_checksums frame = in [just_headers; higherlevel_data] -let (===) a b = (Ipaddr.V4.compare a b = 0) - let error fmt = let err s = Failure s in Printf.ksprintf err fmt