Skip to content

Commit

Permalink
CA-401324: Update pvsproxy socket location
Browse files Browse the repository at this point in the history
A previous commit changed the socket location to /run/pvsproxy but this
is problematic because the pvsproxy daemon runs as a deprivileged user
and cannot create the socket.

Instead, update the path to a location that the daemon has permission to
create. Add a fallback to the original path to cope with older pvsproxy
daemons. This fallback can be removed in the future.

Co-developed-by: Pau Ruiz Safont <[email protected]>
Signed-off-by: Ross Lagerwall <[email protected]>
  • Loading branch information
rosslagerwall authored and psafont committed Oct 31, 2024
1 parent 94dc48c commit c0482fe
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ocaml/networkd/bin/network_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1474,10 +1474,21 @@ end
module PVS_proxy = struct
open S.PVS_proxy

let path = ref "/run/pvsproxy"
let path = ref ""

let depriv_path = "/run/pvsproxy-state/socket"

let legacy_path = "/opt/citrix/pvsproxy/socket/pvsproxy"

let default_path () =
if Sys.file_exists depriv_path then
depriv_path
else
legacy_path

let do_call call =
try Jsonrpc_client.with_rpc ~path:!path ~call ()
let p = match !path with "" -> default_path () | path -> path in
try Jsonrpc_client.with_rpc ~path:p ~call ()
with e ->
error "Error when calling PVS proxy: %s" (Printexc.to_string e) ;
raise (Network_error PVS_proxy_connection_error)
Expand Down

0 comments on commit c0482fe

Please sign in to comment.