Netatalk / netatalk

Netatalk is a Free and Open Source AFP fileserver. A *NIX or BSD system running Netatalk is capable of serving many Macintosh clients simultaneously as an AppleShare file server.
https://netatalk.io
GNU General Public License v2.0
333 stars 85 forks source link

macipgw Linux tunnels are not working #1551

Open NJRoadfan opened 1 day ago

NJRoadfan commented 1 day ago

Just did a test build and setup with the scripts used with A2SERVER. The tunnel interface does not come up and grab the assigned gateway IP. Looking at the code, its clear that Stefan's version of tunnel_linux.c was likely bitrotted and Jason rewrote the whole thing at one point. The fix is to copy the entire tunnel_linux.c file from Jason's tree.

rdmark commented 1 day ago

I see what happened here. There were "hidden" changes in Jason's initial commit. I think he did some coding locally first rather than committing Stefan's vanilla 1.0 code. What I did was to cherry pick all of the relevant subsequent commits in his fork, which all applied cleanly BTW. But I should have inspected that initial commit, in hindsight.

rdmark commented 1 day ago

I have prepared a PR with a merge of Jason's rewrite. It's not tested beyond compiling and launching macipgw. I'm on way out the door right now, but promise to be responsible and set up a NAT for testing tomorrow. :)

The one major discrepancy between the two forks that I can see right now, is about half of atp_input.c that is quite different. And some minor optarg handling differences elsewhere.

NJRoadfan commented 10 hours ago

There are other changes scattered about. I noticed that the <netatalk/endian.h> header was added in a few places.

rdmark commented 10 hours ago

I would expect a missing header to trigger compile time errors so I didn't pay too much heed to such discrepancies, but I could add these back for good measure if you like.

rdmark commented 10 hours ago

I could confirm that the tunnel interface comes up and gets an IP address with this fix. (Debian Bookworm)

Before

8: tun0: <POINTOPOINT,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 500
    link/none 

After

9: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 586 qdisc fq_codel state UNKNOWN group default qlen 500
    link/none 
    inet 192.168.151.1/24 scope global tun0
       valid_lft forever preferred_lft forever

This is using your startup script https://github.com/NJRoadfan/a2server/blob/currentdev/files/macipgw-start.sh.txt

NJRoadfan commented 8 hours ago

Only the AppleTalk services and utilities seem to include the endian.h header. Maybe there are data type issues on other platforms, although I doubt it since everything is pretty much little endian these days. That or its an obsolete leftover from the 2.x codebase.

To test MacIP, setup a client Mac with Open Transport and select MacIP in the TCP/IP control panel. You should be able to connect out to the Internet or connect to the Netatalk server via DSI.

rdmark commented 4 hours ago

It's very close to working. The client Mac gets an IP address from the gateway. But no TCP/IP traffic is getting through yet. Will keep poking around with the settings.

$ nbplkup 
                  192.168.151.1:IPGATEWAY                          65280.21:72
                          alien:TimeLord                           65280.21:129
                          alien:AFPServer                          65280.21:128
                          alien:netatalk                           65280.21:4
                          alien:Workstation                        65280.21:4
                  192.168.151.2:IPADDRESS                          65280.177:72
                         rescue:AFPServer                          65280.177:253
                         rescue:Workstation                        65280.177:4
rdmark commented 1 hour ago

I merged the Linux tunnel code. But keeping it open until it has been fully tested.