Sheep_net.ko on Debian 8 PPC

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Sheep_net.ko on Debian 8 PPC

Post by galgot »

something strange :
I managed to compile sheep_net.ko ethernet driver on Debian 8 PPC (on a PowerBook G4), it loads and all fine.
But , even though I set TCP-IP manually, it doesn't want to get on the internet, only Appletalk works, I can see other macs on the network via the the selector.
Does someone knows of something on Debian 8 preventing BasiliskII from having his own IP address ?
Or does it came from the sheep_net.ko being incompatible ?
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

Do you assign unique IP address to emulated Mac? I confirm that http (TCP) and ping (ICMP) works in latest Fedora 24.
There is an App for that!
https://github.com/rickyzhang82
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

Yes , I assign 192.168.0.64 to the emulated Mac.
And Debian 8 host use 192.168.0.4.
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

Since, you confirm AppleTalk work. It imply that ethernet layer, aka layer 2 works.

I'd suggest to try two things:
1. Run MacTCP Ping. confirm if ICMP works. Ping to your router with IP address.
2. If 1st step work, confirm if DNS and gate way set correctly. Ping to any URL www.nytimes.com.
3. If 2nd step work , test TCP. Use web browser to test TCP.

At any time, you can download wireshark to sniff packet. I'm writing some doc on how sheep_net work. If you are interested in details, I'd share with your.
There is an App for that!
https://github.com/rickyzhang82
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

Thanks for your help rickyzhang,

find here a screenshot showing the TCP/IP configuration :
Image

you can see result of ping to the router (192.168.0.254) , I suppose it's a success...
But if I try a connection with icab, I get that error "-23045". Connections also fails with other browsers,or if I try connecting through IP with Timbuktu to another Mac.
And indeed , AppleTalk works, my R-pi running BasiliskII appears in the Chooser and I can mount it. Timbuktu also connects to it through Appletalk.

But Ping to http://www.nytimes.com fails :
Image

Funny thing, the same configuration on my R-pi BasiliskII's (IP 192.168.0.43) works perfectly...
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

1. ICMP works.
2. But DNS doesn't work. So I would suggest that use icab with IP address, instead of URL: eg, google in US IP http://74.125.232.241

One more thing, please make sure virtual Mac OS IP, ie 192.168.0.64 has no conflicts with other in you subnet. Supposedly you can ping from other box to this virtual Mac OS IP but it show the same Ethernet address as your host.
There is an App for that!
https://github.com/rickyzhang82
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Sheep_net.ko on Debian 8 PPC

Post by adespoton »

If you add 8.8.8.8 to the top of your name server list, does that fix the problem?
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

Trying to connect to http://74.125.232.241 from icab fails too, no error mesg though, it just "check" forever... a MacTCP ping to the same address gives the same "Host not responding (Cannot resolve name)" result.

I've checked my router configuration, no problem with that 192.168.0.64 address I've assigned, it's free and available.

I've also tried using a free DNS server server (209.244.0.3) in TCP/IP instead of my providers ones,
though they work fine on the R-Pi BasiliskII... Still no success.
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

Try ping 8.8.8.8. It is possible that you can't even ICMP to outside.
There is an App for that!
https://github.com/rickyzhang82
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

ping to 8.8.8.8 works :
Image

So I've set up a local http server at 192.168.0.14 and tried pinging http://192.168.0.14 :
Image
Fail !

but ping to just 192.168.0.14 works :
Image
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

1. Ping 8.8.8.8 works with some time out means that you can ICMP to outside network, ie internet. Your sheep_net module works for ICMP.
2. I'd suggest that set DNS as 8.8.8.8 and ping with url "www.nytimes.com" (no http) and see if it can resolve name.
3. If not, that mean UDP doesn't work either. So it may be IP layer issues. You need wireshark or any packet sniffer to run in your host for further debug.

I think somehow it is IP protocol doesn't work in BII. The sheep_net module use so called IP aliasing old technique. It use different IP address for the same ethernet MAC address. In theory, it should be still OK. Because Linux hasn't dropped support this feature yet.

I experienced the similar thing like you did when I'm patching sheep_net module for 4.5 kernel. But somehow it works again for no reason. But I can't replicate the issue any more. So I can't debug it any more (see link https://sourceforge.net/p/basilisk/mail ... sg35274819)

I suspect that sheep_net module may drop IP packet from time to time. Thus, it time out when ping to 8.8.8.8
There is an App for that!
https://github.com/rickyzhang82
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

Tried 8.8.8.8 as DNS and ping to http://www.nytimes.com. no success.

yes I'll try sniffing packet with Wireshark, will have to learn how to use it :)

Note : I have this problem only when building sheep_net on debian 8 Jessie PPC, I have another PB G4 with Jessie and it's the same trouble.
On other machines running Debian 7 Wheezy PPC it works fine.
Also sheep_net works fine on the R-Pi with Rhaspian 8 jessie , but only if I don't update the R-Pi firmware and don't do upgrades. So I've left the R-Pi Jessie at a certain state.
if I upgrade, no more sheep_net.

Thks again for help.
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

Even you know how to use it, there is still some obstacles. To me, I have no idea how BII inside working after tracing Ethernet interrupt part. There are knowledge gap here and there to prevent me.

I forgot to ask -- Which commit you tried? Recently I patched it for 4.2 kernel. It worth a try for this magic line:

I vaguely remember that after explicitly adding this line -- https://github.com/cebix/macemu/commit/ ... 37e520R721

It seems to make it work. But I'm not so sure if that's the trick.
There is an App for that!
https://github.com/rickyzhang82
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

I just did a "git clone https://github.com/cebix/macemu.git" to get the all thing.
But that was some weeks ago.

Shall I try that lastest commit dc11229 from 3 days ago ?

Edit: just trying now... :)

Re-edit : re-build sheep_net from that commit, nope, no success :/
Last edited by galgot on Tue Aug 16, 2016 5:28 pm, edited 1 time in total.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Sheep_net.ko on Debian 8 PPC

Post by adespoton »

Just for clarification: you can't ping http:// -- ping is icmp:// and http:// is a different protocol. The ping client you're using doesn't understand URIs at all, and can only take a domain or IPv4 value.

You can ping the domain, which starts after the //, or you can use a web browser to attempt to access http:// URIs. Ping tests whether the connection to the server is up, and browsing to the domain checks if the connection to the web service is working on that server

8.8.8.8 is Google's domain name server, which often works significantly better than the one provided by your ISP. It does mean, however, that Google is tracking the domains you look up (instead of your ISP tracking them). Using 8.8.8.8 also means that if your ISP is doing traffic shaping based on domain lookups, you've just routed around that.
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

Ah ok thanks adespoton.
just tried accessing http://192.168.0.14 (local web server) with iCab, and it's fails too.
No error mesg , but keeps checking forever.
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

I suspect that from sheep_net module mess up ethernet packet size.

It hard coded ethernet packet size 1514 byte in BII read
https://github.com/cebix/macemu/blob/ma ... x.cpp#L931

But it is only copy up to count.
https://github.com/cebix/macemu/blob/ma ... net.c#L420

You can try a dirty fix to bump up L931 to 1518 as google show the maximum ethernet packet size. Give a try and let me know.
There is an App for that!
https://github.com/rickyzhang82
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

Ok,
I've changed l931, from :
length = read(fd, Mac2HostAddr(packet), net_if_type == NET_IF_ETHERTAP ? 1516 : 1514);
to :
length = read(fd, Mac2HostAddr(packet), net_if_type == NET_IF_ETHERTAP ? 1516 : 1518);

And rebuild, install,
then sudo modprobe sheep_net and sudo chown galgot /dev/sheep_net
...but still no joy in BasiliskII.

or is it "1516" that I should change to "1518" ?
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

No, first one is for tap. Yours is otherwise, ie NET_IF_SHEEPNET.

Try:
https://github.com/cebix/macemu/blob/ma ... net.c#L127
Bump up max queue to 128
There is an App for that!
https://github.com/rickyzhang82
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

Nope, same thing :/
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

Use wireshark on your host and sniff the IP packet to/from your guest Mac OS with filter ip.addr == 192.168.0.64

Test 1: ping to outside, ie 8.8.8.8
Test 2: ping to outside with URL, ie www.nytimes
Test 2: ical http to outside with IP

One capture per test with filter and post it here.
There is an App for that!
https://github.com/rickyzhang82
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by galgot »

Ok, I've installed Wireshark. But as i said, have to learn how to use it, it's very new to me .
Will see that tomorrow . Good night :)
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

Today, I could replicate that sheep_net module didn't work, either.

When ping to my gateway IP from guest OS, I found that host PC sent out ICMP with type 3 error code 10 to inform gateway/router that guest OS IP is not reachable.

I can disable ICMP by iptables in host OS.

Code: Select all

iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP
But it doesn't work, either. Interesting?
There is an App for that!
https://github.com/rickyzhang82
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

To help debug, I wrote a python script to extract and convert BII sending/receiving packet from ether_unix.cpp debug log

You can pull it from my repo branch 'sheep-net-bug-fix-debug' https://github.com/rickyzhang82/macemu/ ... -fix-debug

Code: Select all

cd macemu/BasiliskII/src/Unix
sh build.sh
./BasiliskII > /tmp/debug.log 
# You should ping/DNS/http in guest OS to generate packet output from log
python extract_eth_hex.py -i /tmp/debug.log -o /tmp/hexdump.log
In wireshark, import from hex dump -->/tmp/hexdump.log

Because sheep_net module take in multicast packet, you will see a lot of noises in wireshark.

I kind of figure it out that. BII didn't receive DNS response packet from sheep_net module.

BII <== sheep_net <== Linux host

Now I need to figure it out why.
There is an App for that!
https://github.com/rickyzhang82
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Sheep_net.ko on Debian 8 PPC

Post by rickyzhang »

This early morning, I analyzed and compared the BII hex dump packets from wireshark and packets captured in host.

I found that the host PC kept on sending ICMP to my router and saying that guest OS IP is not reachable.
I looked into iptables chain rule. It does specify this rule. So I disabled firewall completely

Code: Select all

sudo systemctl disable firewalld.service
Now, I can't replicate the issues any more. I'm not sure if I feel happy or not.

But next time if whoever encounters this, please do the followings:

1. Keep using BII from my sheep-net-bug-fix-debug branch

Code: Select all

./BasiliskII > /tmp/debug.log 
# You should ping/DNS/http in guest OS to generate packet output from log
python extract_eth_hex.py -i /tmp/debug.log -o /tmp/hexdump.log


2. Open wireshark on host PC and capture packet.

Keep /tmp/hexdump.log from 1 and packet from 2. Notify me by opening issues in my macemu git repo.

This is most painful thing if it can't replicate every time.
There is an App for that!
https://github.com/rickyzhang82
Post Reply