Minor cleanups

This commit is contained in:
Thomas Leonard 2015-12-30 14:28:28 +00:00
parent 11e18c0b83
commit 5a2f6f7ce8
4 changed files with 5 additions and 8 deletions

5
dao.ml
View File

@ -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"

View File

@ -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 *)

View File

@ -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

View File

@ -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