diff --git a/client_eth.ml b/client_eth.ml index 45337b2..de41f70 100644 --- a/client_eth.ml +++ b/client_eth.ml @@ -20,7 +20,7 @@ type host = let create config = let changed = Lwt_condition.create () in - let my_ip = config.Dao.uplink_our_ip in + let my_ip = config.Dao.our_ip in Lwt.return { iface_of_ip = IpMap.empty; my_ip; changed } let client_gw t = t.my_ip diff --git a/dao.ml b/dao.ml index d5bfffa..c6ba241 100644 --- a/dao.ml +++ b/dao.ml @@ -123,10 +123,8 @@ let watch_clients fn = ) type network_config = { - 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 *) - - clients_our_ip : Ipaddr.V4.t; (* The IP address of our interface to our client VMs (their gateway) *) + netvm_ip : Ipaddr.V4.t; (* The IP address of NetVM (our gateway) *) + our_ip : Ipaddr.V4.t; (* The IP address of our interface to NetVM *) dns : Ipaddr.V4.t; dns2 : Ipaddr.V4.t; } @@ -138,23 +136,20 @@ let try_read_network_config db = match DB.KeyMap.find_opt name db with | None -> Ipaddr.V4.make 0 0 0 0 | Some value -> Ipaddr.V4.of_string_exn value in - let uplink_our_ip = get "/qubes-ip" in - let uplink_netvm_ip = get "/qubes-gateway" in - let clients_our_ip = get "/qubes-netvm-gateway" in + let our_ip = get "/qubes-ip" in (* - IP address for this VM (only when VM has netvm set) *) + let netvm_ip = get "/qubes-gateway" in (* - default gateway IP (only when VM has netvm set); VM should add host route to this address directly via eth0 (or whatever default interface name is) *) let dns = get "/qubes-primary-dns" in let dns2 = get "/qubes-secondary-dns" in Log.info (fun f -> f "@[Got network configuration from QubesDB:@,\ NetVM IP on uplink network: %a@,\ - Our IP on uplink network: %a@,\ Our IP on client networks: %a@,\ DNS primary resolver: %a@,\ DNS secondary resolver: %a@]" - Ipaddr.V4.pp uplink_netvm_ip - Ipaddr.V4.pp uplink_our_ip - Ipaddr.V4.pp clients_our_ip + Ipaddr.V4.pp netvm_ip + Ipaddr.V4.pp our_ip Ipaddr.V4.pp dns Ipaddr.V4.pp dns2); - { uplink_netvm_ip; uplink_our_ip; clients_our_ip ; dns ; dns2 } + { netvm_ip ; our_ip ; dns ; dns2 } let read_network_config qubesDB = let rec aux bindings = diff --git a/dao.mli b/dao.mli index 2b3d97a..df3c23b 100644 --- a/dao.mli +++ b/dao.mli @@ -20,10 +20,8 @@ val watch_clients : (Ipaddr.V4.t VifMap.t -> unit) -> 'a Lwt.t in XenStore, and again each time XenStore updates. *) type network_config = { - 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 *) - - clients_our_ip : Ipaddr.V4.t; (* The IP address of our interface to our client VMs (their gateway) *) + netvm_ip : Ipaddr.V4.t; (* The IP address of NetVM (our gateway) *) + our_ip : Ipaddr.V4.t; (* The IP address of our interface to NetVM *) dns : Ipaddr.V4.t; dns2 : Ipaddr.V4.t; } diff --git a/uplink.ml b/uplink.ml index b74d1df..a7b0350 100644 --- a/uplink.ml +++ b/uplink.ml @@ -74,8 +74,8 @@ end let interface t = t.interface let connect config = - let my_ip = config.Dao.uplink_our_ip in - let gateway = config.Dao.uplink_netvm_ip in + let my_ip = config.Dao.our_ip in + let gateway = config.Dao.netvm_ip in Netif.connect "0" >>= fun net -> Eth.connect net >>= fun eth -> Arp.connect eth >>= fun arp -> @@ -88,7 +88,7 @@ let connect config = >|= or_raise "Getting MAC of our NetVM" Arp.pp_error in let interface = new netvm_iface eth netvm_mac ~my_ip - ~other_ip:config.Dao.uplink_netvm_ip in + ~other_ip:config.Dao.netvm_ip in let fragments = Fragments.Cache.empty (256 * 1024) in Lwt.return { net; eth; arp; interface ; fragments ; ip ; udp } end