Skip to content

refactor(vmm): remove built-in port forwarding#795

Merged
kvinwang merged 1 commit into
masterfrom
remove-vmm-port-forward
Jul 20, 2026
Merged

refactor(vmm): remove built-in port forwarding#795
kvinwang merged 1 commit into
masterfrom
remove-vmm-port-forward

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

Summary

  • remove the VMM's bridge-mode userspace port-forward service and workspace crate
  • remove ReportDhcpLease, persisted guest-ip state, and DHCP notification setup
  • remove the bridge forwarding capability/config flag and reserve its protobuf field
  • update bridge setup and documentation to use dnsmasq only for address assignment

QEMU user-mode networking and its explicit port_map support are unchanged.

This follows the removal direction discussed in #756 (comment). The built-in bridge forwarder depended on an out-of-band DHCP lease report whose state could be stale and was not useful outside this subsystem.

Testing

  • cargo test --manifest-path dstack/Cargo.toml -p dstack-vmm
  • cargo test --manifest-path dstack/Cargo.toml -p dstack-cli-core
  • cargo check --manifest-path dstack/Cargo.toml --workspace
  • bash -n dstack/scripts/setup-bridge.sh

Signed-off-by: Kevin Wang <wy721@qq.com>
Copilot AI review requested due to automatic review settings July 20, 2026 02:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 removes the VMM’s bridge-mode userspace port-forwarding subsystem (and its supporting DHCP lease reporting/state), leaving QEMU user-mode networking and its port_map/hostfwd behavior unchanged. It simplifies bridge-mode setup to use dnsmasq solely for DHCP address assignment and updates config/templates/docs accordingly.

Changes:

  • Remove the built-in bridge forwarding service, DHCP lease report RPC, and persisted guest-ip/forwarding state from dstack-vmm.
  • Remove the dstack-port-forward workspace crate and all references/dependencies.
  • Update bridge networking scripts/docs and reserve the removed protobuf field name/number.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
dstack/vmm/vmm.toml Removes the bridge forwarding config flag from the sample config.
dstack/vmm/src/main_service.rs Drops DHCP lease RPC handling and forwarding reconfiguration hooks.
dstack/vmm/src/config.rs Removes forward_service_enabled from the Networking config struct.
dstack/vmm/src/app/workdir.rs Removes persisted guest-ip file helpers.
dstack/vmm/src/app/network.rs Removes forwarding-related validation constraint for multiple bridges.
dstack/vmm/src/app.rs Removes port-forward service state, DHCP lease handling, and forwarding lifecycle logic.
dstack/vmm/rpc/proto/vmm_rpc.proto Removes ReportDhcpLease and reserves the forward_service_enabled field number/name.
dstack/vmm/Cargo.toml Drops dependency on dstack-port-forward.
dstack/test-scripts/snp-e2e-smoke.sh Removes the forwarder flag from embedded config snippets.
dstack/scripts/setup-bridge.sh Removes DHCP notification checks/installation; dnsmasq config no longer uses dhcp-script.
dstack/scripts/dhcp-notify.sh (removed) Deletes the dnsmasq lease notification script (no longer needed).
dstack/port-forward/src/udp.rs (removed) Removes UDP forwarder implementation.
dstack/port-forward/src/tcp.rs (removed) Removes TCP forwarder implementation.
dstack/port-forward/src/lib.rs (removed) Removes forward-service rule management API.
dstack/port-forward/Cargo.toml (removed) Removes the port-forward crate manifest.
dstack/crates/dstack-cli-core/src/config.rs Updates CLI core config template to remove the forwarder flag.
dstack/Cargo.toml Removes port-forward from workspace members and workspace dependencies.
dstack/Cargo.lock Lockfile updates reflecting removed crate/dependencies.
docs/bridge-networking.md Updates bridge networking docs to remove DHCP notify/forwarding references.
Comments suppressed due to low confidence (2)

dstack/vmm/src/app.rs:1404

  • If Networking::forward_service_enabled is kept as a deprecated/ignored field for backward-compatible deserialization, this test initializer also needs to set it (e.g., false) to keep the struct literal compiling.
        manifest.networks = vec![Networking {
            mode: NetworkingMode::Bridge,
            bridge: "dstack-br0".to_string(),
            mac_prefix: String::new(),
            net: String::new(),
            dhcp_start: String::new(),
            restrict: false,
            netdev: String::new(),
        }];

dstack/vmm/src/app.rs:1618

  • If Networking::forward_service_enabled is kept as a deprecated/ignored field for backward-compatible deserialization, this test initializer also needs to set it (e.g., false) to keep the struct literal compiling.
        bridge_manifest.networks = vec![Networking {
            mode: NetworkingMode::Bridge,
            bridge: "dstack-br0".to_string(),
            mac_prefix: "02:aa:bb".to_string(),
            net: String::new(),
            dhcp_start: String::new(),
            restrict: false,
            netdev: String::new(),
        }];

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

Comment thread dstack/vmm/src/config.rs
Comment thread dstack/vmm/src/main_service.rs
@kvinwang kvinwang changed the title refactor(vmm): remove built-in port forwarding refactor(vmm): remove port-forwarding subsystem Jul 20, 2026
@kvinwang kvinwang changed the title refactor(vmm): remove port-forwarding subsystem refactor(vmm): remove built-in port forwarding Jul 20, 2026
@kvinwang
kvinwang merged commit 02aeb89 into master Jul 20, 2026
16 checks passed
@kvinwang
kvinwang deleted the remove-vmm-port-forward branch July 20, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants