-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rexec client and server #39
Conversation
d794ca0
to
8f9a254
Compare
Added @yomimono as co-author since a lot of the code was based on theirs (thanks!!) |
please add @linse also :) |
8f9a254
to
edf90d6
Compare
Done! :-) |
I had a discussion with @cfcs regarding |
leaving a note here about concatenating printf # open CamlinternalFormatBasics ;;
# let f (Format (fmt, n)) =
let joined = Format (concat_fmt fmt (Char_literal ('z', End_of_format)), "") in
Printf.sprintf joined
in f "a %s " "b";;
- : string = "a b z" So @hannesm suggested this instead: let f fmt = Printf.sprintf (fmt ^^ "z") in f "a %s " "b";;
- : string = "a b z" |
let next_msg t = | ||
recv t.dstream >|= function | ||
| `Ok (`Data_stdout, data) -> | ||
t.stdout_buf <- Cstruct.append t.stdout_buf data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed it, and it seems to be a leftover from #36 which has read_line
that would require buffering. I opted to not implement read_line
when writing Client_flow
. It should be safe to return directly from next_msg
. I can also implement read_line
if it's desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think read_line
might make sense as a utility function for the line-based protocols, but let's not let that block this PR :)
| `Ok (ty, _) -> | ||
Log.err Formats.Qrexec.(fun f -> f "unexpected message of type %ld (%s) received; \ | ||
ignoring it" (int_of_type ty) (string_of_type ty)); | ||
`Ok t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should err on the side of caution here and terminate? Do we anticipate any unhandled messages, or would this only happen in qrexec upgrades?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Qrexec version is negotiated when connecting, so I think this would only happen if the other end is misbehaving. How do you suggest we terminate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would kill the flow from here if that makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See reynir#1 for a suggested implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Do we need to QV.disconnect t.dstream
on Eof
?
The CI fails at OCaml 4.04.0. I use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had some more uncommitted comments
from what I understand (please correct me if I'm wrong)
thanks for reading, maybe we can converge to get this merged (and a mirage-qubes release)!? |
@hannesm sorry, I have been travelling with little opportunity for computer time. Yes, that is correct. I have adapted some of the suggestions made by @cfcs, and #44 ups the OCaml compiler version. What is still outstanding is:
I don't find the latter an issue personally, but I'm open for adding I would love to see this merged and released soon. |
@reynir I'm happy with your kill flow implementation. I haven't tested it, but I think it looks reasonable, and I think we should get this merged. |
a rebase onto master would be great (than CI should pass AFAICT)! |
Co-authored-by: linse <sschirme@gmail.com>
Co-authored-by: Mindy <meetup@yomimono.org> Co-authored-by: linse <sschirme@gmail.com>
Instead of as debug messages. We would not want to hide these.
Co-Authored-By: C For C's Sake <cfcs@users.noreply.github.com>
We raise an exception if the arguments do not fit in the cstruct. Also some whitespace changes.
Try to reflect that it's the remote service exit code
a3b09be
to
8c96707
Compare
Looks like CI is happy :) |
for me, the remaining question is about |
I was considering doing |
I agree with @reynir that the kill behaviour can be improved in a future PR (there are other components, such as qubesdb, which lead to Lwt.fail if they receive unexpected messages). Merging after review and ok from @cfcs to include into the next release. Thanks for your patience and submitting this PR! |
This PR adds functionality to the qrexec implementation such that receiving and sending qrexec rpc calls concurrently is possible.
I will need to review this myself again, but it seems to work provided mirage/ocaml-vchan#132 is merged.