Skip to content

Add vmnet.framework based network backend

Vladislav Yaroshchuk qemu-devel 13 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v13 Latest7 patches 27 repliesIn review
  2. v127 patches 2 repliesSuperseded
  3. v117 patches 2 repliesSuperseded
Earlier versions · 10
VersionPostedPatchesRepliesStatus
v107 patches4 repliesSuperseded
v97 patches0 repliesSuperseded
v87 patches5 repliesApplied
v77 patches4 repliesSuperseded
v66 patches0 repliesSuperseded
v56 patches11 repliesSuperseded
v46 patches6 repliesSuperseded
v36 patches0 repliesSuperseded
v26 patches3 repliesSuperseded
v17 patches7 repliesSuperseded

Changes in v13 from the cover letter

- fix incorrect macOS version bound while
'feature available since 11.0' check.
Use MAC_OS_X_VERSION_MIN_REQUIRED instead of MAC_OS_X_VERSION_MAX_ALLOWED.

Patches in v13 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7net/vmnet: add vmnet dependency and customizable optionmeson.build meson_options.txt scripts/meson-buildoptions.sh+20 -12 replies
2/7net/vmnet: add vmnet backends to qapi/netnet/clients.h net/meson.build net/net.c +6 more+278 -222 replies
3/7net/vmnet: implement shared mode (vmnet-shared)net/vmnet-common.m net/vmnet-shared.c net/vmnet_int.h+415 -41 reply
4/7net/vmnet: implement host mode (vmnet-host)net/vmnet-host.c+104 -60 replies
5/7net/vmnet: implement bridged mode (vmnet-bridged)net/vmnet-bridged.m+100 -51 reply
6/7net/vmnet: update qemu-options.hxqemu-options.hx+25 -01 reply
7/7net/vmnet: update MAINTAINERS listMAINTAINERS+5 -00 replies

Reviews trailers per patch

2 of 7 patches have a Reviewed-by or Acked-by.

PatchMarkus ArmbrusterRoman Bolshakov
1/7T-b R-b
2/7A-b
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v13 thread

Cover letter [PATCH v13 0/7] Add vmnet.framework based network backend

macOS provides networking API for VMs called 'vmnet.framework':
https://developer.apple.com/documentation/vmnet

We can provide its support as the new QEMU network backends which represent three different vmnet.framework interface usage modes:

* vmnet-shared:
allows the guest to communicate with other guests in shared mode and also with external network (Internet) via NAT. Has (macOS-provided) DHCP server; subnet mask and IP range can be configured;

* vmnet-host:
allows the guest to communicate with other guests in host mode. By default has enabled DHCP as vmnet-shared, but providing network unique id (uuid) can make vmnet-host interfaces isolated from each other and also disables DHCP.

* vmnet-bridged:
bridges the guest with a physical network interface.

This backends cannot work on macOS Catalina 10.15 cause we use vmnet.framework API provided only with macOS 11 and newer. Seems that it is not a problem, because QEMU guarantees to work on two most recent versions of macOS which now are Big Sur (11) and Monterey (12).

Also, we have one inconvenient restriction: vmnet.framework interfaces can create only privileged user:
$ sudo qemu-system-x86_64 -nic vmnet-shared

Attempt of vmnet-* netdev creation being unprivileged user fails with vmnet's 'general failure'.

This happens because vmnet.framework requires com.apple.vm.networking entitlement which is: "restricted to developers of virtualization software. To request this entitlement, contact your Apple representative." as Apple documentation says:
https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_vm_networking

One more note: we still have quite useful but not supported 'vmnet.framework' features as creating port forwarding rules, IPv6 NAT prefix specifying and so on.

Nevertheless, new backends work fine and tested within qemu-system-x86-64 on macOS Bir Sur 11.5.2 host with such nic models:
* e1000-82545em
* virtio-net-pci
* vmxnet3

The guests were:
* macOS 10.15.7
* Ubuntu Bionic (server cloudimg)

This series partially reuses patches by Phillip Tennen:
https://patchew.org/QEMU/[email protected]/
So I included them signed-off line into one of the commit messages and also here.

v1 -> v2:
Since v1 minor typos were fixed, patches rebased onto latest master, redundant changes removed (small commits squashed)
v2 -> v3:
- QAPI style fixes
- Typos fixes in comments
- #include's updated to be in sync with recent master
v3 -> v4:
- Support vmnet interfaces isolation feature
- Support vmnet-host network uuid setting feature
- Refactored sources a bit
v4 -> v5:
- Missed 6.2 boat, now 7.0 candidate
- Fix qapi netdev descriptions and styles
(@subnetmask -> @subnet-mask)
- Support vmnet-shared IPv6 prefix setting feature
v5 -> v6
- provide detailed commit messages for commits of
many changes
- rename properties @dhcpstart and @dhcpend to @start-address and @end-address
- improve qapi documentation about isolation
features (@isolated, @net-uuid)
v6 -> v7:
- update MAINTAINERS list
v7 -> v8
- QAPI code style fixes
v8 -> v9
- Fix building on Linux: add missing qapi
'if': 'CONFIG_VMNET' statement to Netdev union
v9 -> v10
- Disable vmnet feature for macOS < 11.0: add vmnet.framework API probe into meson.build.
This fixes QEMU building on macOS < 11.0:
https://patchew.org/QEMU/[email protected]/
v10 -> v11
- Enable vmnet for macOS 10.15 with subset of available features. Disable vmnet for macOS < 10.15.
- Fix typos
v11 -> v12
- use more general macOS version check with MAC_OS_VERSION_11_0 instead of manual
definition creating.
v12 -> v13
- fix incorrect macOS version bound while
'feature available since 11.0' check.
Use MAC_OS_X_VERSION_MIN_REQUIRED instead of MAC_OS_X_VERSION_MAX_ALLOWED.

Vladislav Yaroshchuk (7):
net/vmnet: add vmnet dependency and customizable option net/vmnet: add vmnet backends to qapi/net net/vmnet: implement shared mode (vmnet-shared) net/vmnet: implement host mode (vmnet-host) net/vmnet: implement bridged mode (vmnet-bridged) net/vmnet: update qemu-options.hx
net/vmnet: update MAINTAINERS list

 MAINTAINERS                   |   5 +
 meson.build                   |  16 +-
 meson_options.txt             |   2 +
 net/clients.h                 |  11 ++
 net/meson.build               |   7 +
 net/net.c                     |  10 +
 net/vmnet-bridged.m           | 120 ++++++++++++
 net/vmnet-common.m            | 333 ++++++++++++++++++++++++++++++++++
 net/vmnet-host.c              | 122 +++++++++++++
 net/vmnet-shared.c            | 100 ++++++++++
 net/vmnet_int.h               |  48 +++++
 qapi/net.json                 | 133 +++++++++++++-
 qemu-options.hx               |  25 +++
 scripts/meson-buildoptions.sh |   3 +
 14 files changed, 932 insertions(+), 3 deletions(-)
 create mode 100644 net/vmnet-bridged.m
 create mode 100644 net/vmnet-common.m
 create mode 100644 net/vmnet-host.c
 create mode 100644 net/vmnet-shared.c
 create mode 100644 net/vmnet_int.h
Signature · 1 line
2.23.0