mirror of
https://github.com/mirage/qubes-mirage-firewall.git
synced 2025-10-28 13:11:09 -04:00
Merge pull request #219 from palainp/fix-dm-appvm
Fix HVM clients AppVMs
This commit is contained in:
commit
6fa82a92b0
2 changed files with 19 additions and 9 deletions
|
|
@ -402,13 +402,14 @@ let conf_vif get_ts vif backend client_eth dns_client dns_servers ~client_ip
|
|||
|
||||
(** A new client VM has been found in XenStore. Find its interface and connect
|
||||
to it. *)
|
||||
let add_client get_ts dns_client dns_servers ~router vif client_ip qubesDB =
|
||||
let add_client get_ts dns_client dns_servers ~router vif client_ip qubesDB
|
||||
~cleanup_tasks =
|
||||
let open Lwt.Syntax in
|
||||
let cleanup_tasks = Cleanup.create () in
|
||||
Log.info (fun f ->
|
||||
f "add client vif %a with IP %a" Dao.ClientVif.pp vif Ipaddr.V4.pp
|
||||
client_ip);
|
||||
let { Dao.ClientVif.domid; device_id } = vif in
|
||||
|
||||
let* backend = Netback.make ~domid ~device_id in
|
||||
let* eth = ClientEth.connect backend in
|
||||
let client_mac = Netback.frontend_mac backend in
|
||||
|
|
@ -436,11 +437,10 @@ let add_client get_ts dns_client dns_servers ~router vif client_ip qubesDB =
|
|||
(Printexc.to_string exn));
|
||||
Lwt.return_unit
|
||||
in
|
||||
Lwt.return cleanup_tasks
|
||||
Lwt.return_unit
|
||||
|
||||
(** Watch XenStore for notifications of new clients. *)
|
||||
let wait_clients get_ts dns_client dns_servers qubesDB router =
|
||||
let open Lwt.Syntax in
|
||||
let clients : Cleanup.t Dao.VifMap.t ref = ref Dao.VifMap.empty in
|
||||
Dao.watch_clients @@ fun new_set ->
|
||||
(* Check for removed clients *)
|
||||
|
|
@ -456,11 +456,21 @@ let wait_clients get_ts dns_client dns_servers qubesDB router =
|
|||
match Seq.uncons seq with
|
||||
| None -> Lwt.return_unit
|
||||
| Some ((key, ipaddr), seq) when not (Dao.VifMap.mem key !clients) ->
|
||||
let* cleanup =
|
||||
add_client get_ts dns_client dns_servers ~router key ipaddr qubesDB
|
||||
in
|
||||
let cleanup_tasks = Cleanup.create () in
|
||||
Lwt.async (fun () ->
|
||||
Lwt.catch
|
||||
(fun () ->
|
||||
add_client get_ts dns_client dns_servers ~router key ipaddr
|
||||
qubesDB ~cleanup_tasks)
|
||||
(function
|
||||
| Xs_protocol.Error _ ->
|
||||
Log.warn (fun f ->
|
||||
f "Client %a has not terminated its vif initialisation"
|
||||
Dao.ClientVif.pp key);
|
||||
Lwt.return_unit
|
||||
| e -> Lwt.fail e));
|
||||
Log.debug (fun f -> f "client %a arrived" Dao.ClientVif.pp key);
|
||||
clients := Dao.VifMap.add key cleanup !clients;
|
||||
clients := Dao.VifMap.add key cleanup_tasks !clients;
|
||||
go seq
|
||||
| Some (_, seq) -> go seq
|
||||
in
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
ac049069b35f786fa11b18a2261d7dbecd588301af0363ef6888ec9d924dc989 dist/qubes-firewall.xen
|
||||
14f2f9444579649198ffcf3509d793b7c9e159af48b6321f0fa2d5e9c363b3d1 dist/qubes-firewall.xen
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue