English Amiga Board


Go Back   English Amiga Board > Requests > request.UAE Wishlist

 
 
Thread Tools
Old 24 January 2013, 22:24   #1
neozeed
Registered User
 
Join Date: Jan 2013
Location: Hong Kong, SAR
Posts: 28
SLiRP (user mode nat)

Also, have you thought about using SLiRP from Qemu with the ethernet? I'td be handy for people without winpcap .. .esp wifi users or people using Wine...

Years ago I integrated it into SIMH and it wasn't too painful..

I guess just a thought.
neozeed is offline  
Old 25 January 2013, 08:20   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,534
I don't think it will work, A2065 emulation needs Ethernet level access (not IP), it needs to send and receive raw ethernet frames.

Last edited by Toni Wilen; 25 January 2013 at 12:45. Reason: packets -> frames
Toni Wilen is online now  
Old 25 January 2013, 13:52   #3
neozeed
Registered User
 
Join Date: Jan 2013
Location: Hong Kong, SAR
Posts: 28
Quote:
Originally Posted by Toni Wilen View Post
I don't think it will work, A2065 emulation needs Ethernet level access (not IP), it needs to send and receive raw ethernet frames.
that is what it works with...

Years ago I patched in the Qemu SLiRP code with SIMH's VAX 11-780 which also was pcap based, and it worked, much to my amazement...

I'm not near my 'main machine' as I'm on the road so if I had proper compiler access I'd just do it, but it wasn't too involved.. just some init function, you pass a frame to it, then another to poll to see if it it has a frame for you, which you pass back in..

Considering SIMH was written with DecNET in mind, I was pleasantly surprised to get 4.3 BSD running strictly user-mode with the ability to telnet in & irc out...
neozeed is offline  
Old 25 January 2013, 13:57   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,534
Point to some up to date documentation, first few hits I found talked about IP and not being able to support ICMP which is is quite far from ethernet

EDIT: I am extremely lazy and I'll expect to get correct information from first few hits or it is considered not worth the trouble.
Toni Wilen is online now  
Old 25 January 2013, 16:20   #5
neozeed
Registered User
 
Join Date: Jan 2013
Location: Hong Kong, SAR
Posts: 28
Quote:
Originally Posted by Toni Wilen View Post
Point to some up to date documentation, first few hits I found talked about IP and not being able to support ICMP which is is quite far from ethernet

EDIT: I am extremely lazy and I'll expect to get correct information from first few hits or it is considered not worth the trouble.
sure no problems.. You can ping an ip address from within, but not out to the world.. 10.0.2.2 should ping..

this is a bit .. terse to look at but...

PHP Code:
#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_DEVdevcharnameDEVICEdptruint32 dbit)
 {
       
struct in_addr guest_addr;
       
slirp_init();
       
tbufflen=0;
       
slirp_inited=1;
      
memset(&guest_addr,0,sizeof(guest_addr));
       
inet_aton("10.0.2.15",&guest_addr);
//printf("%d",guest_addr.s_addr);
       
slirp_redir(0,42323,guest_addr,23);
       return 
SCPE_OK;
       }

t_stat eth_close (ETH_DEVdev)
 {
//slirp_exit(1);
       
return SCPE_OK;}

t_stat eth_write (ETH_DEVdevETH_PACKpacketETH_PCALLBACK routine)
 {
       
slirp_input(packet->msg,packet->len);
       if(
routine)
       (
routine)(0);
       return 
SCPE_OK;
 }



t_stat eth_read (ETH_DEVdevETH_PACKpacketETH_PCALLBACK routine)
 {
       
int ret,nfds;
       
fd_set rfdswfdsxfds;
       
struct timeval tv;

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

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

if(
tbufflen>0)
       {
       
dev->read_packet->len=tbufflen;
       
memcpy(dev->read_packet->msg,tbuff,tbufflen);
       
eth_add_crc32(dev->read_packet);
       if(
dev->read_callback)
        (
dev->read_callback)(0);
       
tbufflen=0;
       }


nfds=-1;
FD_ZERO(&rfds);
FD_ZERO(&wfds);
FD_ZERO(&xfds);
if(
slirp_inited)
       {
       
slirp_select_fill(&nfds,&rfds,&wfds,&xfds);
       
tv.tv_sec=0;
       
tv.tv_usec=0;
       
ret select(nfds 1, &rfds, &wfds, &xfds, &tv);
       if(
ret>0)
               {}
       if(
ret<0) {
           
FD_ZERO(&rfds);
           
FD_ZERO(&wfds);
           
FD_ZERO(&xfds);
           }
       
slirp_select_poll(&rfds, &wfds, &xfds);
       }


return 
SCPE_OK;
}


t_stat eth_filter (ETH_DEVdevint addr_countETH_MACaddresses,
                  
ETH_BOOL all_multicastETH_BOOL promiscuous)
 {return 
SCPE_NOFNC;}

int eth_devices (int maxETH_LISTdev)
 {return -
1;}

void slirp_output (const unsigned char *pktint pkt_len)
{
tbufflen=pkt_len;
memcpy(tbuff,pkt,pkt_len);
}

int slirp_can_output(void)
{
return 
1;

With the slirp I used here:

https://sourceforge.net/projects/sim...pid=65835818-0

It may be easier for me to uh 'borrow' a friends machine.. and see if I can just hammer it together...

What do you use to build WinUAE compiler wise?
neozeed is offline  
Old 25 January 2013, 16:35   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,534
I don't want to see any code yet, I want to see how it works, depencies, restrictions etc.

EDIT: Does it "emulate" ethernet and convert known ethernet frames to/from IP packets? I can't really see any other ways to make it work without kernel driver.

Last edited by Toni Wilen; 25 January 2013 at 16:52.
Toni Wilen is online now  
Old 26 January 2013, 10:24   #7
neozeed
Registered User
 
Join Date: Jan 2013
Location: Hong Kong, SAR
Posts: 28
Quote:
Originally Posted by Toni Wilen View Post
I don't want to see any code yet, I want to see how it works, depencies, restrictions etc.

EDIT: Does it "emulate" ethernet and convert known ethernet frames to/from IP packets? I can't really see any other ways to make it work without kernel driver.
basically it acts as a nat router... the host passes it a frame (memcpy'd in) and it'll inspect the packets and open out tcp connections as need be.

The source was pulled from FreeBSD from what I recall, the tcpip stack was re-compiled in a way that it can stand on its own, and as it nat's it opens connections through the hosts tcpip stack. The joy being that you don't need any kernel driver installed on the host, and you don't need any special 'bsdsockets' type shim, instead your virtual ethernet card just feeds the frames to slirp, and it works it out from there. It is part of Qemu if you invoke:

Quote:
-net nic -net user
there is some minor information here. So from Qemu's POV it doesn't matter if you are running OS/2, MS-DOS or Windows NT as long as the NIC driver is doing its job and passing ethernet frames. Just as my hacked up SIMH, 2.11 BSD on the PDP-11, 4.2 & 4.3 BSD on the VAX work fine.

Oh yeah the biggest thing I've found is that Visual C++ will compile it, but it doesn't work correctly for some reason. GCC builds it OK. I've compiled it on Linux/BSD and MinGW.
neozeed is offline  
Old 31 January 2013, 16:31   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,534
Now that 040/060 MMU emulation is finally starting to work, I may have time to do work with this..

Unfortunately I am still not sure how to integrate this with WinUAE. (I always hate code that is taken from somewhere else and never meant to be used by any one else = weird requirements and no examples)

1) How to initialize it? (Anything else needed?)
2) I have one ethernet frame transmitted by emulated NIC, what function to call with the packet as a parameter? (and same when receiving)
3) Does it "just work" or does it need some extra function calls or something?

What does "Does not work correctly" mean?

ADDED: License is original BSD (has advertising clause) = it is not GPL compatible.
ADDED2: There appears to be newer version that is GPL compatible. Lets see..

Last edited by Toni Wilen; 12 February 2013 at 13:53.
Toni Wilen is online now  
Old 17 May 2013, 19:48   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,534
2.6.0 is out, time for other things again..

Unfortunately qemu slirp has external dependencies (qemu specific stuff) and is gcc-only but does not have GPL-incompatible bsd advertising clause.

It won't be trivial task. I need simple and GPL compatible version, thanks
Toni Wilen is online now  
Old 21 June 2013, 16:38   #10
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,534
Some progress. Basilisk II slirp seems to be much more portable than current qemu slirp, both also have "fixed" licensing, bsd advertising clause is gone (original authors were asked if changing license is allowed and they agreed).

EDIT: It seems to work. ICMP (ping) can't work but at least TCP and UDP appears to work.

Last edited by Toni Wilen; 22 June 2013 at 16:05.
Toni Wilen is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
slirp network emulation backend Toni Wilen support.WinUAE 27 28 February 2014 13:48
Another new user rewoffl Member Introductions 1 30 August 2012 16:55
New user digger909 Member Introductions 10 08 June 2009 19:33
NAT address -Rob- support.Other 7 07 April 2008 00:06
'Warp Mode' broken in 'windowed mode' NoX1911 support.WinUAE 3 26 May 2007 01:05

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:08.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08665 seconds with 13 queries