Merge pull request #219 from palainp/fix-dm-appvm

Fix HVM clients AppVMs
This commit is contained in:
Pierre Alain 2025-10-05 09:49:43 +02:00 committed by GitHub
commit 6fa82a92b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 9 deletions

View file

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

View file

@ -1 +1 @@
ac049069b35f786fa11b18a2261d7dbecd588301af0363ef6888ec9d924dc989 dist/qubes-firewall.xen
14f2f9444579649198ffcf3509d793b7c9e159af48b6321f0fa2d5e9c363b3d1 dist/qubes-firewall.xen