ps2dev / ps2client

Desktop clients to interact with ps2link and ps2netfs
44 stars 17 forks source link

ps2link and ps2netfs port numbers and type (UDP/TCP) #12

Open browntownington opened 3 years ago

browntownington commented 3 years ago

Hi, would you be able to post details of the port numbers required for ps2link and ps2netfs and their types (UDP/TCP)? I have a raspberrypi sitting between my network and PS2 and need to do some port translations. Thank you :)

browntownington commented 3 years ago

I imagine ps2netfs is the same as FTP active (port 20/21 TCP) and passive (21 TCP and 1024-65536 TCP) as I was able to connect using one of the ps2-klients.

Just need to figure out what p2link uses for ports.

AKuHAK commented 3 years ago

Are you sure that you investigate all documentation? https://www.github.com/ps2dev/ps2client/tree/master/doc%2Fps2link-protocol.txt Contains answers for all your questions.

sp193 commented 3 years ago

ps2netfs isn't FTP, from what I do recall. If it were, then you should have been able to use any FTP client.

browntownington commented 3 years ago

ps2netfs isn't FTP, from what I do recall. If it were, then you should have been able to use any FTP client.

Wasn't suggesting ps2netfs is using FTP protocol only that it was using a similar port range to FTP... 1024-65536 TCP there's a fair chance something will fall in that range ;) :)

browntownington commented 3 years ago

Are you sure that you investigate all documentation? https://www.github.com/ps2dev/ps2client/tree/master/doc%2Fps2link-protocol.txt Contains answers for all your questions.

Thanks @AKuHAK I do recall seeing this document recently and forgot where i had read it... Anyway, there is ambiguity or perhaps a typo in this document. Firstly i believe the port numbers are listed in hex so I will convert them to a decimal port number below.

          PS2LINK PORT NUMBERS

              Command (UDP) 0x4712 - One way communication to send commands. Decimal port number [**18194**]
              Request (TCP) 0x4711 - Two way communication to serve requests. Decimal port number [**18193**]
              Log (UDP)     0x4712 - One way communication to receive log text. Decimal port number [**18194**]

Now the documentation also states that communication takes place on three ports. It mentioned 1 UDP port, 1 TCP port, and another UDP port.

                    Communication with ps2link takes place on three ports. I'm not entirely
                      sure why, but it does. One udp port is used to send commands to ps2link
                      in the form of command packets. A tcp port is used to receive requests
                      and send responses during program runtime. And another udp port is used
                      to receive log text from ps2link for debug or informational purposes.

So I wonder if there is actually a third port number or if the server (PS2) initiates a log connection back to the client on 18194 UDP and the author is suggesting there is third port because the connection is imitated from the server back to the client. I will run some debugs and see.

Source Destination Type Destination-Port Description ps2client ps2link UDP 18194 Command (one-way) ps2client ps2link TCP 18193 Request & Reply (two-way) ps2link ps2client UDP 18194 Log connection (on-way)

bignaux commented 2 years ago

I think having 2 services on same UDP port is confusing user. In a first place, i'd like to remove any reference to Log in ps2client and change UDP command port. udptty was designed so that its messages can be accessed without establishing a connection, so we can let a basic command run, such as using netcat : nc -ukl 18194 or tshark (promiscous) : tshark -o data.show_as_text:TRUE -f "dst port 18194" -Tfields -e data.text

Such easy first move would make (non-exhaustive list) :

F0bes commented 2 years ago

Removing listen from PS2client would technically break existing workflows that rely on listen

From personal experience, it isn't that confusing. Why not just change the command port and keep the log.

I'm plenty sure PS2client can be fixed to not use TCP during listen.

I agree that after a command it should exit. Possibly add a -listen argument for old behaviour.

Make it clear to users? Or remove the fact that a TCP server is currently needed. Either way, changing PS2client listen behaviour is a solution as said above.

I think this is for changing the port, which I'm not against.