feat(run): add explicit vmnet subnet - #1322
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6147f96d1d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
6147f96 to
a781ac0
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Validation evidence for
The full guest DHCP / |
|
@codex review |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Validation and test artifact update for
GitHub Actions build: https://github.com/wignerStan/tart/actions/runs/33282954364 Artifact name: The artifact contains a development-signed |
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review Please rigorously review the current head |
|
@codex security review Please review the current head |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Follow-up review and corrected test buildI reviewed the follow-up commits and the complete current diff again at head Correctness issue fixedThe previous head passed the first host address (
The PR description has also been corrected; it no longer documents the old ValidationGitHub Actions run
A separate configuration probe confirmed that the setter accepts all advertised boundary shapes: Codex code review on The uploaded artifact is The packaged Mac test bundle itself has: Real-machine statusThere is still no complete physical/real-machine VM boot result recorded on this PR. A hosted probe reached The real macOS 26 Apple Silicon test should record:
The PR should remain draft until that test is attached. |
What changed
tart run --net-vmnet-subnet <CIDR>on macOS 26 or newer.VZVmnetNetworkDeviceAttachment.vmnet_network_get_ipv4_subnetand fail instead of silently continuing if vmnet did not honor the requested CIDR./30or larger).Usage
This gives Tart a deliberate network range instead of relying on Apple's automatically selected shared vmnet range. VPN/TUN routing software can then distinguish the Tart range from unrelated virtualization networks and select its direct outbound for that traffic, while products such as Parallels can remain on their own network. The packet may still enter a TUN and be handled by a direct outbound; the useful property here is the deterministic range available to routing policy.
Motivation
The global
com.apple.vmnet.plistoverride is not scoped to Tart and is reported as unreliable on Tahoe (#1225). Existing Tart network modes also do not provide a per-invocation explicit NAT subnet:This PR therefore uses the macOS 26 logical-network API only when an explicit subnet is requested. Existing shared networking and Softnet behavior are unchanged.
Difference from #1268
This is intentionally narrower:
The user supplies the CIDR directly, which is the feature needed for deterministic routing policy.
Implementation notes
For
192.168.200.0/24, Tart passes the canonical subnet address192.168.200.0and mask255.255.255.0tovmnet_network_configuration_set_ipv4_subnet. Apple's API reserves the first, second, and last addresses; the second address is used by the host and the remaining assignable addresses are available to DHCP.After network creation, Tart retrieves the actual address and mask and verifies that they normalize to the requested CIDR. A different network or mask is rejected.
The vmnet configuration and network references are released through a small Core Foundation C shim. The network remains strongly owned by
NetworkVmnetfor the lifetime of the VM.The feature is gated behind Swift 6.4/Xcode 27 and
@available(macOS 26, *).Development signing
Production signing already carries
com.apple.vm.networking. For local source testing,scripts/run-signed.shselectsResources/tart-vmnet-dev.entitlementswhen either--net-vmnet-subnet VALUEor--net-vmnet-subnet=VALUEis present. The repository's embedded development provisioning profile authorizes that entitlement.Ordinary snapshot artifacts continue to use the normal development entitlement set. This keeps existing snapshot binaries runnable in hosted environments, but those ordinary snapshots cannot exercise
--net-vmnet-subnet.Validation
Validated from feature head
43978042b895d0dd8dcb1a2243c9c2187cb1af36on anxcode-27-arm64runner with macOS 26.5.2 and Swift 6.4:swift build --build-system swiftbuildpassed.NetworkVmnetTestspassed: 9 tests, 0 failures./30:10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,192.168.200.0/24, and192.168.200.0/30.com.apple.vm.networking = true.43978042found no major issues.A hosted attempt reached
vmnet_network_createbut returned status1002in that restricted runner environment. This is not counted as either a runtime pass or a product-code failure. No complete real-machine VM boot result is currently recorded on the PR.A full Tart VM smoke test on a real macOS 26 Apple Silicon host is still required before merge. It should verify guest DHCP assignment,
tart ip(including lease-file behavior), host-to-guest reachability, DNS and Internet access, IPv6 behavior, conflicting/subsequent network creation, and the sing-box direct rule while confirming the Parallels CIDR remains unaffected.