fragglet / ipxbox

Standalone DOSbox IPX-over-UDP server
GNU General Public License v2.0
71 stars 8 forks source link

Win98 IPXBox PPTP no connection to Dos Dali #13

Open skadarnold opened 2 years ago

skadarnold commented 2 years ago

When trying to connect an IPX game using Win98 through IPXBox PPTP tunnel to a Dos through Dali, Win98 will not receive connection handshake.

Dos Dali will confirm and recognize when player 2 has joined, but Win98 / PPTP does not receive player 2 handshake. Not entirely sure if this is IPXBox or Dali but it seems it is the former.

fragglet commented 2 years ago

Can you state which game this is?

It would be helpful if you could definitively narrow it down to one or the other. The most straightforward way would be to connect a dosbox client and run the game from there. Then you should be able to determine if it's a Dali or PPTP problem.

Another thing you can do is to save a packet dump from ipxbox. You can do this with eg.

ipxbox --dump_packets --enable_pptp > packet-log.txt

Then if you share the packet log I might be able to figure out more about what's going on.

skadarnold commented 2 years ago

Here are some packet dumps testing with doom19. This seems to be an issue with dali as dosbox to pptp seems to work fine.

dali - dali - doom19.txt dali - pptp - doom19.txt dosbox - pptp - doom19.txt

skadarnold commented 4 months ago

Tried this connection last night with Shadow Warrior using a self compiled version of Dali with the latest code and Win98 PPTP using real hardware. When the game starts to connect it locks up or restarts the Dali computer. No issues connecting Dali - Dali or Dali - IPXBox or even PPTP - PPTP so far with my testing. But something is funky between Dali - PPTP connection.

Let me know if I can provide any other dumps or logs to help narrow this down. I will try to provide some more dumps for the Shadow Warrior connection tests.

fragglet commented 4 months ago

Thanks, any data you can provide to help me figure it out will be very helpful.

skadarnold commented 4 months ago

I logged a pcap file for two different sessions that might provide a little more information.

edit: I originally labeled these files wrong and also added PCAP file for DosBox to PPTP connection which is successful.

Shadow Warrior PCAP.zip

Dali - DosBox: Successful connection with 2 player Shadow Warrior. IPXBox starts / hosts the session, then Dali connects as player two.

Dosbox - PPTP: This also connects successfully.

Dali - PPTP: Unsuccessful connection with 2 player Shadow Warrior. PPTP starts / hosts the session. When Dali connects as player two the host computer shows no sign of attempted connection through Shadow Warrior and continues to look as normal. On the Dali side, Shadow Warrior reports that it has found 2 players but then continues displaying dots as if it is waiting to receive more connection data from the host. This seems to be consistent whenever attempting to connect Dali through PPTP.

One thing that stands out is in these frames, the length sent from Dali seems to be 7680 instead of 30. image

fragglet commented 4 months ago

Looks like Dali isn't byte-swapping the length field properly for its keepalive pings:

>>> "%x" % 7680
'1e00'
>>> 0x1e
30
skadarnold commented 4 months ago

Looks like Dali isn't byte-swapping the length field properly for its keepalive pings:

>>> "%x" % 7680
'1e00'
>>> 0x1e
30

Thanks for confirming, I was playing around with the dali source code at sendRegistration() and sendPingReply() to see if I could make the correct adjustment for this, but so far no luck. I was pulled away for some work things but I will give it a few more tries when I have a moment.

skadarnold commented 4 months ago

I did a quick test by forcing the size with htons(0x1e) under sendPingReply() and even though the size seems to be correct in pcap file, it is still not connecting correctly with Dali - PPTP. Maybe it is still related to the inaccurate size calculation, but I will keep looking for other evidence.

skadarnold commented 4 months ago

I have gone over several pcap logs over and over now and I have not spotted anything else I can see is unusual. Actually what is strange is the packets seem to indicate that the connection between Dali and PPTP is working as expected or seem to sync in a similar way a working connection dos between Dali and DosBox. Even if Dali starts as host or joins as client, the Dali side game indicates it has found a second player. On the PPTP side the game does not indicate any recognition of a second player joining. It seems the PPTP side is missing a critical packet / response, or is not recognizing that devices have started syncing.

Lots of working options there which is amazing!

edit: Looked a little more and noticed that during this section where it seems to initialize sync, the source is alternating between the two, but the destination routes are not alternating and pointing to each other. image

I think it should look more like this example with Dali to DosBox connection

image

The destination seems to be triggered even further up the packet sequence.

fragglet commented 4 months ago

Thanks for all the detailed information. Is there any chance you could get a packet dump of the PPTP stream?

skadarnold commented 4 months ago

This is what I was able to dump from the PPTP stream, assuming I did it correctly at least.

PPTP Stream.zip

Win98 connects to PPTP first, then Dali connects. Win98/PPTP hosts / starts, then Dali connects as second player.

To verify I captured the pptp stream correctly, I made this modification to the IPXBox code image

edit: I just double checked and realized adding the pptp.CopyPackets() did not work like I thought. It is undefined which makes sense. I will look for another way to do this.

skadarnold commented 4 months ago

Here is a photo of the destination node in Dali to PPTP after it thinks it has found 2 players and tries to connect. signal-2024-07-18-084519_002

Getting a similar output with a successful connection between Dali and DosBox is a little trickier because it clears the screen so fast, but I can get the output after I unload Dali after closing out the game. I tried to >> to a file but that doesn't seem to work correctly either. signal-2024-07-18-084949 signal-2024-07-18-085554

edit: also here is the PPTP stream dump of that last successful Dali to DosBox connection so you can use for comparison. Dali to DosBox - PPTP Stream Dump .zip

edit: This stream dump is probably from the regular IPX and not the PPTP stream sine I realized that pptp.CopyPackets() was not defined so it did not compile as I thought. Excuse the confusion for my mistake.