diff --git a/dao.ml b/dao.ml index d4cd140..4635ccf 100644 --- a/dao.ml +++ b/dao.ml @@ -41,7 +41,6 @@ let watch_clients fn = ) type network_config = { - uplink_prefix : Ipaddr.V4.Prefix.t; (* The network connecting us to NetVM *) uplink_netvm_ip : Ipaddr.V4.t; (* The IP address of NetVM (our gateway) *) uplink_our_ip : Ipaddr.V4.t; (* The IP address of our interface to NetVM *) @@ -55,8 +54,6 @@ let read_network_config qubesDB = | None -> raise (error "QubesDB key %S not present" name) | Some value -> value in let uplink_our_ip = get "/qubes-ip" |> Ipaddr.V4.of_string_exn in - let uplink_netmask = get "/qubes-netmask" |> Ipaddr.V4.of_string_exn in - let uplink_prefix = Ipaddr.V4.Prefix.of_netmask uplink_netmask uplink_our_ip in let uplink_netvm_ip = get "/qubes-gateway" |> Ipaddr.V4.of_string_exn in let clients_prefix = (* This is oddly named: seems to be the network we provide to our clients *) @@ -64,6 +61,6 @@ let read_network_config qubesDB = let client_netmask = get "/qubes-netvm-netmask" |> Ipaddr.V4.of_string_exn in Ipaddr.V4.Prefix.of_netmask client_netmask client_network in let clients_our_ip = get "/qubes-netvm-gateway" |> Ipaddr.V4.of_string_exn in - { uplink_prefix; uplink_netvm_ip; uplink_our_ip; clients_prefix; clients_our_ip } + { uplink_netvm_ip; uplink_our_ip; clients_prefix; clients_our_ip } let set_iptables_error db = Qubes.DB.write db "/qubes-iptables-error" diff --git a/dao.mli b/dao.mli index de2067a..adf036a 100644 --- a/dao.mli +++ b/dao.mli @@ -19,7 +19,6 @@ val client_vifs : int -> client_vif list Lwt.t (** [client_vif domid] is the list of network interfaces to the client VM [domid]. *) type network_config = { - uplink_prefix : Ipaddr.V4.Prefix.t; (* The network connecting us to NetVM *) uplink_netvm_ip : Ipaddr.V4.t; (* The IP address of NetVM (our gateway) *) uplink_our_ip : Ipaddr.V4.t; (* The IP address of our interface to NetVM *) diff --git a/router.ml b/router.ml index 6cd11cd..27305a5 100644 --- a/router.ml +++ b/router.ml @@ -34,7 +34,7 @@ let remove_client t = Client_eth.remove_client t.client_eth let forward_ipv4 router buf = match Memory_pressure.status () with | `Memory_critical -> (* TODO: should happen before copying and async *) - print_endline "Memory low - dropping packet"; + Log.warn "Memory low - dropping packet" Logs.unit; return () | `Ok -> match target router buf with diff --git a/uplink.ml b/uplink.ml index f2bf861..bef3f46 100644 --- a/uplink.ml +++ b/uplink.ml @@ -43,11 +43,12 @@ module Make(Clock : V1.CLOCK) = struct let listen t router = Netif.listen t.net (fun frame -> - Eth.input + (* Handle one Ethernet frame from NetVM *) + Eth.input t.eth ~arpv4:(Arp.input t.arp) ~ipv4:(unnat t router frame) ~ipv6:(fun _buf -> return ()) - t.eth frame + frame ) let interface t = t.interface