Great news! The excellent A/UX capable emulator Shoebill, now has working Ethernet support! The sad news is that it only supports the TUN/TAP interface. So Windows users are kind of left out in the fun.
Except, I’ve been here before with SIMH ages ago. So I dusted off my source code, and injected it into Shoebill. The first issue I had was that SLiRP was rejecting all the inputted frames, because of invalid frame length. Even more weird is that ARP worked, and I could see the 10.0.2.2 and 10.0.2.3 virtual IP’s but TCP and UDP outbound wouldn’t work at all.
It took me longer than it should have but although this code worked great with GCC 2.7 and 3.0, 4.x breaks it. And it’s the same reason why Shoebill originally didn’t work on Win32, the blasted packed structures! So adding the ‘-mno-ms-bitfields’ flag to GCC is all it took, and now I could ping 10.0.2.2 for about 5-7 pings until SLiRP would crash. I tried all kinds of stuff trying to see if there was an issue with SLiRP, but I should have payed closer attention to the debugger, with all those threads flying around. It turns out Shoebill was trying to read & write a the same time, which caused SLiRP to crash as it is not re-entrant. I tried to place mutex’s on every SLiRP call but that ended up having SLiRP not process any packets. Very strange. I then reduced it to where I read the frame out of SLiRP and pass it to Shoebill, and where Shoebill write’s a frame out the SLiRP. And much to my amazement I can run ‘worms’ just fine!
So after a minute of worming and pinging I called it ‘good enough’ and rebuilt a production binary, and packaged up my source code.