Skip to content

Commit

Permalink
CA-401324: Update pvsproxy socket location (#6098)
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.
  • Loading branch information
lindig authored Nov 1, 2024
2 parents 07aeb76 + c0482fe commit b6619b5
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 b6619b5

Please sign in to comment.