[Rpcemu] Config-free networking work-in-progress (was: Patch for 0.9.1 - Mac keyboard support)

Theo Markettos theo at markettos.org.uk
Wed Nov 21 04:45:22 PST 2018


On Tue, Nov 20, 2018 at 10:08:40PM +0000, Theo Markettos wrote:
> There are also things like: https://github.com/zhuhaow/NEKit that build on
> top of NETunnelProvider and handle the entitlement, like you do with
> Tunnelblick.

Shortly after writing that post, I had a better idea.

QEMU uses a library called SLIRP, which contains its own ethernet stack,
including servers to do DHCP, DNS, etc.  When a QEMU VM wants to use the network,
the default mode is to push packets into SLIRP which will NAT them and emit
them from the QEMU app as if they were native connections.  This enables
no-setup networking for QEMU VMs, and it's the default way that QEMU uses.
In principle, doing the same for RPCEmu would allow no-setup networking
across all the platforms it supports.

QEMU's source code is not pleasant to work with (I have the scars), but
somebody has done libslirp, which is the SLIRP code ripped out into a
separate library with an easy-to-use interface:
https://github.com/rd235/libslirp
(it's mostly GPL as RPCEmu is)

Since I had a spare couple of hours, I plugged libslirp into RPCEmu as a new
'NAT' networking type, just in the Linux code for now as a proof of concept. 
Currently it doesn't work - transmitted packets go into libslirp but none
are received from it as network_plt_rx() is never called to fetch them,
probably because I need to understand how the RPCEmu network card does
interrupts.  libslirp can either do a synchronous receive call, or a file
descriptor via poll() or select().

As I don't know when I'll next get time to work on this, I've put the
code up here:
https://bitbucket.org/caliston/rpcemu-libslirp/
in case anyone gets around to taking a look before me.

Theo



More information about the RPCEmu mailing list