mirror of
https://github.com/mirage/qubes-mirage-firewall.git
synced 2024-10-01 01:05:39 -04:00
in Qubes doc client_our_ip is always netvm_our_ip
This commit is contained in:
parent
9cabe7e303
commit
5a0711bb2d
@ -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
|
||||
|
19
dao.ml
19
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 "@[<v2>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 =
|
||||
|
6
dao.mli
6
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user