From: Alan C. <al...@ll...> - 2021-04-28 15:13:50
|
On Tue, 27 Apr 2021 08:21:14 +0100 Andrea <mar...@gm...> wrote: > I see FUSE has a W5100 Ethernet card emulation > > https://sourceforge.net/p/fuse-emulator/fuse/ci/master/tree/peripherals/nic/w5100_socket.c > > I am writing an emulation for this card for AppleWin (Uthernet 2). > > I have a POC and was trying to understand if I could use the one from fuse. > I noticed the following difference: > > fuse emulates udp and tcp, while I need ipraw and macraw. > > So I did my homework and got them working. > But I then hit a few issues and wanted to understand how you solved them > > - raw sockets require privileged access (annoying) > - impossible to forward udp packets for dhcp (root or no root). > > The problem with udp packets is that I need to listen on port 67-udp and this is impossible because > it is already taken by dnsmasqd on my system. > > So this is the question I have for you: have you got any example of a ZX80 software that does DHCP > and this works with your W5100 emulation? > If yes, I am really curious to see how you did it. > > I have a solution, but it is a huge effort, where I intercept DHCP, reply wit a dummy (10.0.0.1) and > then forward udp and tcp packets (a la NAT) > I think this is what VirtualBox does. Take a look at https://github.com/kvmtool/kvmtool/tree/master/net/uip It's a dead project now but the uip code in it turns a raw network connection into host tcp, udp etc. You'd still probably need the DHCP proxy in there but it should let you turn macraw into host sockets for at least the simple stacks used on micros. There is a much better version of the code in very old versions of the Intel clear containers but I've no idea where you'd dig that out on the net any more. Another bizarre but effective approach is to make your emulator one end of a simple VPN/IPIP tunnel instead and run the server end somewhere. Alan |