Skip to content

[applevz] Additional networks#4757

Merged
sharder996 merged 26 commits into
mainfrom
feature/apple/networking
May 5, 2026
Merged

[applevz] Additional networks#4757
sharder996 merged 26 commits into
mainfrom
feature/apple/networking

Conversation

@sharder996
Copy link
Copy Markdown
Collaborator

@sharder996 sharder996 commented Mar 23, 2026

This PR adds supports for using additional network interfaces when using the applevz backend driver.

This implementation of vmnet network interfaces was largely inspired by the following existing works:

Necessary modifications to integrate this code into Multipass is outlined at the top of applevz_vmnet.mm, but all credit for unmodified code goes to the original author.

See the vmnet documentation for more reading on vmnet API usage.

Once #4312 is merged into main and the interactions with the AvailabilityZoneManager is more finalized, this implementation can be easily extended to support shared network interfaces.


MULTI-2259
MULTI-2263

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.67%. Comparing base (fcf58e6) to head (825cf47).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4757   +/-   ##
=======================================
  Coverage   87.67%   87.67%           
=======================================
  Files         269      269           
  Lines       14603    14603           
=======================================
  Hits        12801    12801           
  Misses       1802     1802           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sharder996 sharder996 force-pushed the feature/apple/networking branch from 3f926da to 9f839da Compare March 24, 2026 16:41
@sharder996 sharder996 changed the base branch from main to feature/apple/asif-images March 24, 2026 16:42
@sharder996 sharder996 marked this pull request as ready for review March 24, 2026 16:48
@sharder996 sharder996 requested review from a team and jimporter and removed request for a team March 24, 2026 17:02
@sharder996 sharder996 force-pushed the feature/apple/networking branch from be162d1 to 5b0a04c Compare March 26, 2026 19:32
@sharder996 sharder996 force-pushed the feature/apple/asif-images branch 2 times, most recently from f6543d8 to 3f74c3d Compare April 2, 2026 07:20
@sharder996 sharder996 force-pushed the feature/apple/networking branch from 5b0a04c to 5621123 Compare April 2, 2026 14:47
Copy link
Copy Markdown
Contributor

@jimporter jimporter left a comment

Choose a reason for hiding this comment

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

I don't have a lot of knowledge about Apple's vmnet, so I just have some more general comments below.

Comment thread src/platform/backends/applevz/applevz_bridge.mm
Comment thread src/platform/backends/applevz/applevz_bridge.mm
Comment thread src/platform/backends/applevz/applevz_bridge.mm Outdated
Comment thread src/platform/backends/applevz/applevz_vmnet.mm Outdated
Comment on lines +91 to +111
auto bind_endpoint = [&](std::vector<uint8_t>& buffers,
std::vector<vmpktdesc>& packets,
std::vector<iovec>& iovs,
std::vector<msghdr_x>& msgs) {
buffers.resize((size_t)packet_count * max_packet_bytes);
packets.resize(packet_count);
iovs.resize(packet_count);
msgs.resize(packet_count);
for (int i = 0; i < packet_count; i++)
{
iovs[i].iov_base = buffers.data() + (size_t)i * max_packet_bytes;
iovs[i].iov_len = max_packet_bytes;
packets[i].vm_pkt_iov = &iovs[i];
packets[i].vm_pkt_iovcnt = 1;
msgs[i].msg_hdr.msg_iov = &iovs[i];
msgs[i].msg_hdr.msg_iovlen = 1;
}
};

bind_endpoint(host_buffers, host_packets, host_iovs, host_msgs);
bind_endpoint(vm_buffers, vm_packets, vm_iovs, vm_msgs);
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.

Then bind_endpoint could be a method on VmnetBuffers, so here you'd just call:

host.bind_endpoint();
vm.bind_enpoint();

Comment thread src/platform/backends/applevz/applevz_vmnet.mm Outdated
Comment thread src/platform/backends/applevz/applevz_vmnet.mm
Comment thread src/platform/backends/applevz/applevz_vmnet.mm Outdated
Comment thread src/platform/backends/applevz/applevz_vmnet.mm Outdated
Comment thread src/platform/backends/applevz/applevz_vmnet.mm Outdated
@sharder996 sharder996 force-pushed the feature/apple/networking branch 2 times, most recently from c11eb18 to 72f75f9 Compare April 6, 2026 20:01
@sharder996 sharder996 requested a review from jimporter April 6, 2026 20:02
jimporter
jimporter previously approved these changes Apr 6, 2026
Copy link
Copy Markdown
Contributor

@jimporter jimporter left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Base automatically changed from feature/apple/asif-images to main April 24, 2026 15:44
@sharder996 sharder996 dismissed jimporter’s stale review April 24, 2026 15:44

The base branch was changed.

@sharder996 sharder996 enabled auto-merge April 24, 2026 15:58
Persisting and saving a UUID would cause DHCP to assign a static IP
address. Not something Multipass supports.
Crediting [vmnet-helper](https://github.com/nirs/vmnet-helper) and
listing modifications to original implementation
@sharder996 sharder996 force-pushed the feature/apple/networking branch from 72f75f9 to dabd4da Compare April 27, 2026 14:20
@sharder996 sharder996 requested a review from jimporter April 27, 2026 14:20
@sharder996
Copy link
Copy Markdown
Collaborator Author

sharder996 commented Apr 27, 2026

@jimporter Rebased on main in order to get updated CI workflows. Should be no new changes. Aligned some VM factory tests with AZs.

@sharder996 sharder996 force-pushed the feature/apple/networking branch from dabd4da to 825cf47 Compare April 27, 2026 15:28
Copy link
Copy Markdown
Contributor

@jimporter jimporter left a comment

Choose a reason for hiding this comment

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

Reapproving after the rebase

@sharder996 sharder996 added this pull request to the merge queue May 4, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 4, 2026
@sharder996 sharder996 added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 261ae33 May 5, 2026
31 checks passed
@sharder996 sharder996 deleted the feature/apple/networking branch May 5, 2026 02:31
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