network: inject host.vz.internal alias; clean up dormant gvproxy code#1
Merged
Merged
Conversation
…y code vz-ufk: every stack-managed container now resolves `host.vz.internal` → `192.168.64.1` (Apple's NAT gateway) via `/etc/hosts`, giving sandboxed workloads a stable name for the macOS host. Constants live in `vz-runtime-contract` so portable consumers don't pull in the macOS-only `vz` crate. Reachability over the gateway from per-service netns containers is gated on a separate MASQUERADE follow-up (vz-0ml); the DNS-injection side is proven end-to-end on a real VM via the new `host_vz_internal_etc_hosts_entry_present_in_container` E2E. vz-832: delete the dormant `GvproxyBackend` / `GvproxyConfig` / `locate_gvproxy` / `NetworkBackend` trait / `NetworkHandle`. The gvproxy binary was never spawned; the real network is Apple NAT + per-container `/etc/hosts` + a vsock-relay TCP listener for inbound forwarding. The new top-of-file doc in `crates/vz-stack/src/network.rs` describes that model accurately. Follow-ups filed: vz-0ml (stack-network MASQUERADE), vz-662 (gvproxy revival as the production network backend).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related network changes:
vz stack-managed container now resolveshost.vz.internal→192.168.64.1(Apple's NAT gateway) via/etc/hosts, giving sandboxed workloads a stable name for the macOS host (the Docker Desktop equivalent ofhost.docker.internal). Constants live invz-runtime-contractso portable consumers don't pull in the macOS-onlyvzcrate.GvproxyBackend/GvproxyConfig/locate_gvproxy/NetworkBackendtrait /NetworkHandlefromcrates/vz-stack/src/network.rs. The gvproxy binary was never spawned; the actual networking model is Apple NAT (outbound) + per-container/etc/hosts(sibling DNS) + a vsock-relay TCP listener invz-oci-macos/src/runtime/networking.rs(inbound forwarding). The new top-of-file doc describes that model accurately.Known limitation (tracked, not in this PR)
Data-plane reachability from a stack-managed netns container to
192.168.64.1is not working today — the guest agent'ssetup_stack_networkdoesn't programMASQUERADE/ip_forward, and the initramfs ships noiptables/nft. The kernel hasCONFIG_NF_NAT/CONFIG_NF_TABLEScompiled in, so this is purely a userspace gap. Tracked as vz-0ml. The companionhost_vz_internal_reaches_host_service_via_nat_gatewayE2E is#[ignore]'d on that bead. The DNS-injection side of this PR is fully proven (see test plan below).Also filed: vz-662 —
network: revive gvproxy as the production network backend(would solvehost.vz.internalreachability properly + LAN-bind for inbound + UDP forwarding). Reframed by the discovery during this work that port forwarding does work today via the vsock-relay TCP listener (TCP, loopback-only) — so the gvproxy revival argument is narrower than it first looked.Test plan
cargo build --workspacecleancargo clippy -p vz -p vz-runtime-contract -p vz-stack -p vz-oci-macos --libcleancargo nextest run -p vz-stack— 691/692 pass (the 1 failure isenvironment_secret_source_is_staged_and_mounted, pre-existing onmain;$HOMEis a directory in the sandbox)host_vz_internal_injected_into_every_serviceproves solo-service stacks get the aliasthree_service_ip_allocation+default_network_backward_compatto acknowledge the extra/etc/hostsentryhost_vz_internal_etc_hosts_entry_present_in_containerboots a real shared VM, creates a netns-isolated container through the full stack pipeline, execsgrep host.vz.internal /etc/hosts, and confirms the row points at192.168.64.1. Run via./scripts/run-sandbox-vm-e2e.sh --suite runtime -- --ignored --nocapture --test-threads=1 --exact host_vz_internal_etc_hosts_entry_present_in_containershared_vm_inter_service_connectivityE2E still passes — Task 2 cleanup didn't break the bridge / netns /extra_hostspipelineFiles
crates/vz-runtime-contract/src/types/workload.rs,src/lib.rsHOST_INTERNAL_ALIASandHOST_INTERNAL_GATEWAY_IPV4constants (lives here, not invz, sovz-stackdoesn't take a macOS-only dep)crates/vz/src/protocol.rscrates/vz-stack/src/executor/create.rsextra_hostsbefore the sibling-service loopcrates/vz-stack/src/executor/tests.rscrates/vz-stack/src/network.rscrates/vz-stack/src/lib.rscrates/vz-oci-macos/tests/runtime_e2e.rsREADME.mdhost.vz.internal+0.0.0.0-vs-127.0.0.1caveat + netns-reachability limitationplanning/host-internal-alias/README.md🤖 Generated with Claude Code