Thank you for that packet dump in netrek format. I’ll have to upgrade my logs to be that helpful. ;-) I’m actively troubleshooting using your data. On a general netrek-dev note, programming with Swift for most things is cool. I’m using Apple’s new Network framework to send my data (I believe they are working with the IETF on that), so no more BSD socket API. My TCP reader/writer is around 100 lines (have not implemented UDP). Packet analyzer is larger of course. One Swift pain point is generating arbitrary packets. In C you can just send a struct out a network interface. But Swift does not guarantee the layout of native-Swift Structs, particularly Structs with arrays. Swift also does not have arrays of predefined sizes. For simple structs with no arrays/strings, it works to create the Struct natively in Swift and spit it out the network interface (at least for Swift 4.2).. But whenever I have a struct with an array or String, I have to define the struct in C and import it into Swift. This makes it “difficult” to layout the packet in Swift, although I’m now past that challenge. I remember looking at the Netrek source code back in 1991. I was impressed, but the C was mostly beyond my abilities. I looked at it again recently. It's still beyond my abilities. Swift just works better with the way my brain is wired. I salute you all! Darrell > On Mar 4, 2019, at 2:52 PM, James Cameron <quozl at laptop.org> wrote: > > Here's a packet dump from Gytha just now. > > http://dev.laptop.org/~quozl/z/1h0wOC.txt <http://dev.laptop.org/~quozl/z/1h0wOC.txt> > > Note how CP_FEATURE is sent early, and there's a burst of SP_FEATURE > after CP_LOGIN and before SP_LOGIN. > > Also, I was wrong in previous mail, SP_YOU is seen before CP_LOGIN, > but with zero flags. > > On Mon, Mar 04, 2019 at 02:26:14PM -0800, Darrell Root wrote: >> I’ll take a look at those documents although I’m already all over packets.h >> from the distribution. >> >> Here’s the full sequence in order. SP_YOU comes early before I send my login >> authentication as guest. >> >> Darrell >> >> "Sending CP_PACKET 27" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_PLAYER_INFO" >> "Received SP_YOU" >> "Sending CP_LOGIN 8" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PL_LOGIN" >> "Received SP_HOSTILE" >> "Received SP_PLAYER_INFO" >> "Received SP_KILLS" >> "Received SP_PSTATUS" >> "Received SP_FLAGS" >> "Received SP_PLAYER" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_PLANET_LOC" >> "Received SP_LOGIN" >> "Sending CP_FEATURE 60" >> "Sending CP_OUTFIT 9" >> >> On Mar 4, 2019, at 2:19 PM, James Cameron <[1]quozl at laptop.org <mailto:quozl at laptop.org>> wrote: >> >> G'day Darrell, >> >> According to protocol, you should expect SP_YOU in response to >> CP_LOGIN and CP_FEATURE. You say you have it in the count of packets, >> but you don't have it in the end of the sequence. Can you show the >> whole sequence? >> >> Also, see these references; >> >> 1. netrek protocol >> >> [2]https://github.com/quozl/netrek-server/blob/master/include/packets.h#L24 <https://github.com/quozl/netrek-server/blob/master/include/packets.h#L24> >> >> 2. sending CP_FEATURE of FEATURE_PACKETS immediately after CP_SOCKET, >> >> https://github.com/quozl/gytha/blob/master/gytha/__init__.py#L5644 >> >> On Mon, Mar 04, 2019 at 01:07:35PM -0800, Darrell Root wrote: >> >> netrek-dev, >> >> I’m working on a Swift Netrek client for the Mac. I’m having trouble >> getting >> through the login sequence. >> >> I’m using netrek-server-vanilla netrek-server-vanilla-2.19.0 with no >> active >> players as a test target. In my packet traces below the server is at >> 192.168.0.10. >> >> I’m able to successfully play on my test server with the MacTrek >> client. >> >> Here’s a count of the packets I’ve been able to send/receive and >> process (not >> in order): >> >> 31 "Received SP_FLAGS" >> 32 "Received SP_HOSTILE" >> 32 "Received SP_KILLS" >> 1 "Received SP_LOGIN" >> 40 "Received SP_PLANET_LOC" >> 32 "Received SP_PLAYER" >> 52 "Received SP_PLAYER_INFO" >> 32 "Received SP_PL_LOGIN" >> 32 "Received SP_PSTATUS" >> 1 "Received SP_YOU" >> 1 "Sending CP_FEATURE 60" >> 1 "Sending CP_LOGIN 8" >> 1 "Sending CP_OUTFIT 9" >> 1 "Sending CP_SOCKET 27" >> >> Here’s the end of the sequence: >> >> ... >> "Received SP_LOGIN" >> "Sending CP_FEATURE 60" >> "Sending CP_OUTFIT 9" >> >> No response to CP_OUTFIT. >> The server logs an inability to do a DNS reverse lookup on >> 192.168.0.31, but I >> don’t think that is related (and it doesn’t stop the MacTrek >> Objective-C client >> from playing). >> >> I presume that something is wrong with my CP_OUTFIT or CP_LOGIN, or >> that some >> other packet is required to login on the server. >> >> Here’s my CP_FEATURE: >> >> 12:46:33.444140 IP 192.168.0.31.62943 > 192.168.0.10.netrek: Flags >> [P.], seq >> 61:149, ack 5873, win 2048, options [nop,nop,TS val 516594040 ecr >> 1657847922], >> length 88 >> 0x0000: 685b 3589 0a04 1410 9fd7 77b1 0800 4500 >> 0x0010: 008c 0000 4000 4006 b8f2 c0a8 001f c0a8 >> 0x0020: 000a f5df 0a20 187e d37b 87ce 7c2f 8018 >> 0x0030: 0800 96e5 0000 0101 080a 1eca 9978 62d0 >> 0x0040: c072 3c53 0000 0000 0001 4645 4154 5552 >> 0x0050: 455f 5041 434b 4554 5300 0000 0000 0000 >> 0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0x0090: 0000 0000 0000 0000 0000 >> >> Here’s a packet dump of a MacTrek CP_FEATURE packet. Mine looks >> correct. >> >> 08:29:02.233675 IP 192.168.0.31.60481 > 192.168.0.10.netrek: Flags >> [P.], seq >> 9:97, ack 1, win 2058, options [nop,nop,TS val 501230260 ecr >> 1642419149], >> length 88 >> 0x0000: 685b 3589 0a04 1410 9fd7 77b1 0800 4500 >> 0x0010: 008c 0000 4000 4006 b8f2 c0a8 001f c0a8 >> 0x0020: 000a ec41 0a20 47c9 bead f710 babe 8018 >> 0x0030: 080a b569 0000 0101 080a 1de0 2ab4 61e5 >> 0x0040: 53cd 3c53 0000 0000 0001 4645 4154 5552 >> 0x0050: 455f 5041 434b 4554 5300 0000 0000 0000 >> 0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0x0090: 0000 0000 0000 0000 0000 >> >> For reference here’s reference information on that structure: >> >> #define CP_FEATURE 60 >> >> struct feature_cpacket { /* CP_FEATURE py-struct "!bcbbi80s" #60 */ >> char type; >> char feature_type; /* either 'C' or 'S' */ >> char arg1, >> arg2; >> int value; >> char name[80]; >> }; >> >> struct feature_var feature_vars[] = { >> {"FEATURE_PACKETS", &F_client_feature_packets, NULL}, >> >> Here’s my CP_OUTFIT when I try to login as fed (I also tried setting >> team to 0 at 0x0044 since that is what MacTrek appears to do). >> >> 12:46:34.381240 IP 192.168.0.31.62943 > 192.168.0.10.netrek: Flags >> [P.], seq 149:153, ack 5873, win 2048, options [nop,nop,TS val >> 516594969 ecr 1657848989], length 4 >> 0x0000: 685b 3589 0a04 1410 9fd7 77b1 0800 4500 >> 0x0010: 0038 0000 4000 4006 b946 c0a8 001f c0a8 >> 0x0020: 000a f5df 0a20 187e d3d3 87ce 7c2f 8018 >> 0x0030: 0800 0e95 0000 0101 080a 1eca 9d19 62d0 >> 0x0040: c49d 0901 0200 >> >> Here’s info on that struct: >> >> #define CP_OUTFIT 9 /* outfit to new ship */ >> >> struct outfit_cpacket { /* CP_OUTFIT py-struct "!bbbx" #9 */ >> char type; >> char team; >> char ship; >> char pad1; >> }; >> >> Could the problem be with my earlier packets? They got responses. But >> here they are for completeness: >> >> CP_SOCKET: (note that my client does not support UDP) >> >> 11:46:12.530856 IP 192.168.0.31.62508 > 192.168.0.10.netrek: Flags >> [P.], seq 1:9, ack 1, win 2058, options [nop,nop,TS val 512991468 ecr >> 1654229963], length 8 >> 0x0000: 685b 3589 0a04 1410 9fd7 77b1 0800 4500 >> 0x0010: 003c 0000 4000 4006 b942 c0a8 001f c0a8 >> 0x0020: 000a f42c 0a20 c97b 28a2 549c ed30 8018 >> 0x0030: 080a 67e8 0000 0101 080a 1e93 a0ec 6299 >> 0x0040: 8bcb 1b04 0a00 0000 8020 >> >> #define CP_SOCKET 27 /* new socket for reconnection >> */ >> >> struct socket_cpacket { /* CP_SOCKET py-struct "!bbbxI" #27 */ >> char type; >> char version; >> char udp_version; /* was pad2 */ >> char pad3; >> u_int socket; >> }; >> >> CP_LOGIN: (hardcoded to guest as the username, password and login >> empty) >> >> 11:46:13.591234 IP 192.168.0.31.62508 > 192.168.0.10.netrek: Flags >> [P.], seq 9:61, ack 5769, win 2048, options [nop,nop,TS val 512992524 >> ecr 1654231039], length 52 >> 0x0000: 685b 3589 0a04 1410 9fd7 77b1 0800 4500 >> 0x0010: 0068 0000 4000 4006 b916 c0a8 001f c0a8 >> 0x0020: 000a f42c 0a20 c97b 28aa 549d 03b8 8018 >> 0x0030: 0800 a51c 0000 0101 080a 1e93 a50c 6299 >> 0x0040: 8fff 0801 0000 6775 6573 7400 0000 0000 >> 0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0x0070: 0000 0000 0000 >> >> struct login_cpacket { /* CP_LOGIN py-struct '!bbxx16s16s16s' #8 */ >> char type; >> char query; >> char pad2; >> char pad3; >> char name[NAME_LEN]; >> char password[NAME_LEN]; >> char login[NAME_LEN]; >> }; >> >> Any ideas what I need to correct or what else I need to supply to >> successfully login as guest? >> >> Darrell >> >> _______________________________________________ >> netrek-dev mailing list >> netrek-dev at us.netrek.org <mailto:netrek-dev at us.netrek.org> >> http://mailman.us.netrek.org/mailman/listinfo/netrek-dev <http://mailman.us.netrek.org/mailman/listinfo/netrek-dev> >> >> -- >> James Cameron >> http://quozl.netrek.org/ <http://quozl.netrek.org/> >> >> References: >> >> [1] mailto:quozl at laptop.org <mailto:quozl at laptop.org> >> [2] https://github.com/quozl/netrek-server/blob/master/include/packets.h#L24 <https://github.com/quozl/netrek-server/blob/master/include/packets.h#L24> > >> _______________________________________________ >> netrek-dev mailing list >> netrek-dev at us.netrek.org <mailto:netrek-dev at us.netrek.org> >> http://mailman.us.netrek.org/mailman/listinfo/netrek-dev <http://mailman.us.netrek.org/mailman/listinfo/netrek-dev> > > > -- > James Cameron > http://quozl.netrek.org/ <http://quozl.netrek.org/> > _______________________________________________ > netrek-dev mailing list > netrek-dev at us.netrek.org <mailto:netrek-dev at us.netrek.org> > http://mailman.us.netrek.org/mailman/listinfo/netrek-dev <http://mailman.us.netrek.org/mailman/listinfo/netrek-dev> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20190304/c7231e78/attachment-0001.html>