Skip to content

Conversation

@irvingoujAtDevolution
Copy link
Contributor

@irvingoujAtDevolution irvingoujAtDevolution commented Jun 26, 2025

Hello @CBenoit , I added dynamically dispatched trait for hyperv connector and normal connectors. The main drive is to avoid copy and paste in previous version. I did it this is way is also to reuse existing code as much as possible, instead of copy each and every method and add a _vmconnect suffix. This might not be the best solution, let me know your thoughts.

@CBenoit
Copy link
Member

CBenoit commented Jul 1, 2025

@irvingoujAtDevolution I don’t remember very well. What is different from the previous version?

@irvingoujAtDevolution
Copy link
Contributor Author

@CBenoit
The first version's main problem was that we modified on ClientConnector itself, which causes the state management less intuitive.
The second version's problem was that, the logic for vmconnect are tied to io, and we uses a lot of boolean params and hardcoded logics to manually manipulate the connector's state, which is not FFI friendly.

Comment on lines +39 to +53
pub async fn run_until_handover(
credssp_finished: &mut CredSSPFinished,
framed: &mut Framed<impl FramedRead + FramedWrite>,
mut connector: VmClientConnector,
) -> ConnectorResult<ClientConnector> {
let result = loop {
single_sequence_step(framed, &mut connector, &mut credssp_finished.write_buf).await?;

if connector.should_hand_over() {
break connector.hand_over();
}
};

info!("Handover to client connector");
credssp_finished.write_buf.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is handover a terminology used by VMConnect protocol?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, it's only make sense in this context

Copy link
Member

@CBenoit CBenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What about the extra option EnhancedMode? I think Hyper-V understands the following format now: <GUID>;EnhancedMode=1

@irvingoujAtDevolution
Copy link
Contributor Author

We were having CredSSP issues on enhanced mode, I intend to have that support in separate pull request.

@github-actions
Copy link

github-actions bot commented Jul 4, 2025

Coverage Report 🤖 ⚙️

Past:
Total lines: 28328
Covered lines: 17460 (61.64%)

New:
Total lines: 28654
Covered lines: 17473 (60.98%)

Diff: -0.66%

[this comment will be updated automatically]

@irvingoujAtDevolution irvingoujAtDevolution marked this pull request as ready for review July 4, 2025 18:44
@irvingoujAtDevolution irvingoujAtDevolution force-pushed the vmconnect-use-vmconnector branch 2 times, most recently from e28091e to 349b21f Compare July 4, 2025 18:55
@irvingoujAtDevolution irvingoujAtDevolution force-pushed the vmconnect-use-vmconnector branch from 082acb5 to 69264ff Compare July 8, 2025 21:04
@CBenoit CBenoit requested a review from Copilot November 4, 2025 12:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for HyperV VmConnect connections to the IronRDP client. The changes enable clients to connect to HyperV virtual machines using a VM-specific connector that handles the specialized protocol requirements.

  • Introduces a new ironrdp-vmconnect crate to handle HyperV VM-specific connection logic with NTLM-only CredSSP
  • Refactors connector architecture to use trait-based approach (ConnectorCore, SecurityConnector, CredsspSequenceFactory) for polymorphism
  • Updates RDCleanPath protocol to support optional x224 connection PDUs for VM connections

Reviewed Changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web-client/iron-svelte-client/src/lib/login/login.svelte Adds UI field for HyperV VmConnect ID input
web-client/iron-remote-desktop-rdp/src/main.ts Exports new vmConnect extension function
crates/ironrdp-vmconnect/src/lib.rs New module exposing VM connector functionality
crates/ironrdp-vmconnect/src/connector.rs Implements VmClientConnector with VM-specific state machine
crates/ironrdp-vmconnect/src/credssp.rs Implements NTLM-only CredSSP sequence for VM connections
crates/ironrdp-vmconnect/src/config.rs Defines VM-specific credentials and configuration types
crates/ironrdp-web/src/session.rs Integrates VM connector with web client connection flow
crates/ironrdp-client/src/rdp.rs Updates TCP/WebSocket connection logic to support VM connectors
crates/ironrdp-client/src/config.rs Adds CLI arguments and config for VM connections
crates/ironrdp-rdcleanpath/src/lib.rs Changes x224 PDU fields to Option<T> for VM support
crates/ironrdp-connector/src/lib.rs Introduces trait-based connector abstraction
crates/ironrdp-connector/src/credssp.rs Refactors CredSSP into trait for extensibility
crates/ironrdp-connector/src/connection.rs Implements new traits for ClientConnector
crates/ironrdp-async/src/connector.rs Updates async connector to work with trait objects
crates/ironrdp-async/src/vmconnector.rs Adds VM connector lifecycle management functions
crates/ironrdp-blocking/src/connector.rs Updates blocking connector for trait objects
crates/ironrdp-testsuite-/tests/.rs Updates tests to match new async API signatures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +217 to +218
<input id="pcb" type="text" bind:value={vmconnect} />
<label for="pcb">HyperV VmConnect ID</label>
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input element has id=\"pcb\" but should have id=\"vmconnect\" to match the label's for attribute and avoid duplicate IDs with the Pre Connection Blob field above (line 213).

Suggested change
<input id="pcb" type="text" bind:value={vmconnect} />
<label for="pcb">HyperV VmConnect ID</label>
<input id="vmconnect" type="text" bind:value={vmconnect} />
<label for="vmconnect">HyperV VmConnect ID</label>

Copilot uses AI. Check for mistakes.
Comment on lines +473 to +475
// let connector::ClientConnectorState::ConnectionInitiationWaitConfirm { .. } = connector.state() else {
// return Err(connector::general_err!("invalid connector state (wait confirm)"));
// };
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed. If this validation is no longer needed, the commented lines should be deleted rather than left in the codebase.

Suggested change
// let connector::ClientConnectorState::ConnectionInitiationWaitConfirm { .. } = connector.state() else {
// return Err(connector::general_err!("invalid connector state (wait confirm)"));
// };

Copilot uses AI. Check for mistakes.
@CBenoit
Copy link
Member

CBenoit commented Nov 4, 2025

@irvingoujAtDevolution Can you rebase on top of master and address Copilot’s suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants