I worked through another round of bug fixes and trouble-shooting this week. Once I fixed a bug in the serial port code, eliminated the lwip PPP authentication code and got the timing right for when to start the PPP server, I finally was able to negotiate a connection with the Mac SE on System 7.1!: Jan 10 20:44:11 PowerMac-G4 pppd <notice>: Connect: ppp0 <--> /dev/cu.usbserial Jan 10 20:44:20 PowerMac-G4 pppd <notice>: local IP address 192.168.11.69 Jan 10 20:44:20 PowerMac-G4 pppd <notice>: remote IP address 192.168.11.130
The ms-dns setting in PPPd sets the DNS server for more than just devices running MS Windows. lwip is also able to negotiate this setting with the PPP server to get the DNS server addresses. Unfortunately, I could not get lwip to negotiate the netmask setting properly. It kept coming back as 255.255.255.255, regardless of the server setting, which puts the gateway outside the network. This won't work. I had to override this in my lwip program until I can figure out the issue.
Then, I was sending pings but lwip was returning protocol errors. Of course, I had to enable lwip's ICMP to get it to recognize ICMP messages, like pings.
Finally, the trickiest issue. I was sending pings, and I could see that lwip was receiving them and returning them, but my G4 was not showing the returned ping. I tried tcpdump on the G4 and I could see the pings on the G4's serial interface, but the ping program would not receive them. Not until I ran in verbose mode: tcpdump -i ppp0 -v did the problem reveal itself - the G4 was ignoring the ping return because of bad checksum errors. Simply enabling the checksum calculation code in lwip fixed the problem.
I added tcpecho application code, and I can telnet to the Mac SE and it echoes my typing. So, the lwip networking stack is up and running on System 7.1!
So, I am at a crossroads. I can fix up the user interface, add a telnet client and make it a real Mac application, or focus on getting this limited network functionality working on the Macintosh 128K. Since the latter is far less sensible, that's where I will spend my time.