mame
mame copied to clipboard
netdev: Add support for the macOS 10.10+ vmnet virtual network interface [Kelvin Sherlock, R. Belmont]
vmnet is a virtual network passthrough API added in macOS 10.10 and enhanced in 10.15. It works well for our purposes except that it requires root privileges. Therefore this includes two implementations: one which works in the straightforward way but requires you to sudo mame, and one which builds a small helper program (when TOOLS=1) which can be set SUID root. MAME then launches the helper program on startup and sends/receives data through it via pipes. The helper program drops root as soon as the vmnet connection is open, so it should be all around better for security than sudo'ing MAME.
This was written originally by Kelvin Sherlock for Ample; I've done a fairly extensive cleanup pass on it and also found a few bugs in it which have been fixed. It now works well for various systems with networking that I've tried; emulated Mac System 7 can mount my netatalk 2.2.10 server, access the outside Internet with FTP, HTTP, and SSH.
Limitations:
- vmnet does not pass EtherTalk packets (WiFi routers don't either). The fix for that will be to support real bit-serial LocalTalk in the 8530 and a bitb-like adapter device that translates it into the community-defined LToUDP (LocalTalk over UDP) standard. Many other emulators and a new LocalTalk WiFi dongle for real hardware ("AirTalk") now speak LToUDP.
- vmnet null-routes all traffic until the emulated client sends a DHCP request. Macs that can run Open Transport are fine, but MacTCP and some of the older workstations MAME emulates use bootp and will require some additional packet intervention code in vmnet_common to translate to and from DHCP.
Haven’t looked at the code yet, but one of the things on my (very long) TODO list is an HDLC async mode bridge device for emulated serial ports, which would allow bridging LocalTalk to other programs, as well as SNA, BITBUS, etc.
@cuavas I'd appreciate it if you could take a look at this when you have time. I'm confident about the actual functionality (I use it all the time now) but if you have any ideas on making the chown/chmod dance easier or anything else I'd love to hear it.
There’s still a bunch of stuff from the first review. I assume you or Kelvin are still looking at it.
I don't see an end in sight for reworking this so I'm going to cut my losses.
I addressed every bullet point from the original review except the smart pointer stuff (which we're now starting to get into here). Please detail what else from that you feel isn't done.
This is back to being up-to-date with mainline, so adventurous people can try it. Next step is to do some mechanical cleanup, etc.