Skip to content

[applevz] Additional networks#4757

Open
sharder996 wants to merge 26 commits intomainfrom
feature/apple/networking
Open

[applevz] Additional networks#4757
sharder996 wants to merge 26 commits intomainfrom
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.50%. Comparing base (137f185) to head (72f75f9).
⚠️ Report is 369 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4757   +/-   ##
=======================================
  Coverage   87.50%   87.50%           
=======================================
  Files         258      258           
  Lines       14127    14127           
=======================================
  Hits        12361    12361           
  Misses       1766     1766           

☔ 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 from 5621123 to c11eb18 Compare April 6, 2026 19:58
@sharder996 sharder996 force-pushed the feature/apple/networking branch 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
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