[Simh] support for SLiRP status?

Peter Garay peter.garay at lhsystems.hu
Fri Jun 13 07:39:23 EDT 2008

Dear Jason and all,

A long time ago there was a post on this list about using SLiRP and I would 
like to inquire about the progress, if any made.

I know that SLiRP is only suitable for a subset of TCP/IP networking and hence 
not applicable for everyone. However it is a good solution on platforms where 
there is no pcap library available and it works well in qemu for client type 
applications. For instance, I would hope to get the emulator on WinMobile 
this way. 

Thanks and best regards,


Jason Stevens neozeed at gmail.com
Sun Oct 7 00:42:00 EDT 2007

I've done some hacking with the networking on qemu & simh, and I've finally
done something that's been on my list of things to do.  Qemu has a built in
'user mode networking' stack called slirp that will allow Qemu to connect to
the network without any tap/tun or libpcap.  All TCP/IP traffic on the
ethernet is intercepted, and operated on the host side.  If you remember
slirp from the "good old days" when everyone had shell accounts, then the
windows people would build slirp so a stubbed out winsock.dll would allow
them to use winsock applications going thru the host computer.

Anyways I've tested this successfully with the VAX emulator.  It appears
that there is some weird issues either with the way the vax780 emulator
handles it's ethernet card (which may be why it's disabled to start with),
or with BSD 4.3 / Taho on how their ethernet frames are...   Right now I'm
testing with IRC on 4.3 BSD Quasijarus UNIX #3.  I've also included a redir
port so that I can 'telnet' into the host.

I don't know if anyone would even find this interesting, but the prospect of
a 'drop and go' host is quite usefull for me at least.  Not to mention it'll
be a snap to setup on the network, or install Operating Systems like OpenBSD
which can pull the rest of the OS via HTTP.

Remember it's best to use the following config under slirp

Host IP

In the source below, I've hardcoded port 42323 on the host to go to port 23
on the emulated vax.  I then telnet to the loop on 42323 and connect to the

If you want to try, download and configure qemu on your PC.  I just then
copied the slirp files into simh, and added them to the makefile.  I had to
copy some config headers from qemu to satisfy the last of the slirp
dependancies.  From what I can gather the major 'block' here is that slirp
needs to know what endian the host is at compile time.

For what it's worth, here is my addition to the sim_ether file.  I'm sorry
it's not a diff, I had removed the os dependant portion from the independant
portion to speed my compiles & tests...

#include "slirp.h"
#include <ctype.h>
#include "sim_ether.h"
#include "sim_sock.h"

unsigned char tbuff[2000];
int tbufflen;
int slirp_inited=0;
extern fd_set *global_readfds, *global_writefds, *global_xfds;

t_stat eth_open(ETH_DEV* dev, char* name, DEVICE* dptr, uint32 dbit)
        struct in_addr guest_addr;
        return SCPE_OK;

t_stat eth_close (ETH_DEV* dev)
        return SCPE_OK;}

t_stat eth_write (ETH_DEV* dev, ETH_PACK* packet, ETH_PCALLBACK routine)
        return SCPE_OK;

t_stat eth_read (ETH_DEV* dev, ETH_PACK* packet, ETH_PCALLBACK routine)
        int ret,nfds;
        fd_set rfds, wfds, xfds;
        struct timeval tv;

if(!dev) return SCPE_UNATT;
if(!packet) return SCPE_ARG;

dev->read_packet = packet;
packet->len = 0;
dev->read_callback = routine;


        ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv);
        if(ret<0) {
        slirp_select_poll(&rfds, &wfds, &xfds);

return SCPE_OK;

t_stat eth_filter (ETH_DEV* dev, int addr_count, ETH_MAC* addresses,
                   ETH_BOOL all_multicast, ETH_BOOL promiscuous)
  {return SCPE_NOFNC;}

int eth_devices (int max, ETH_LIST* dev)
  {return -1;}

void slirp_output (const unsigned char *pkt, int pkt_len)

int slirp_can_output(void)
return 1;


Let me know if anyone is interested, and I'll check out what the full
licensing is involved in this....

Jason Stevens

More information about the Simh mailing list