DEV9: Add EthUDPPorts config for inbound UDP in Sockets mode#14285
Draft
fjtrujy wants to merge 2 commits intoPCSX2:masterfrom
Draft
DEV9: Add EthUDPPorts config for inbound UDP in Sockets mode#14285fjtrujy wants to merge 2 commits intoPCSX2:masterfrom
fjtrujy wants to merge 2 commits intoPCSX2:masterfrom
Conversation
In Sockets mode, UDP ports are only bound when the PS2 sends a packet first. PS2 software that listens for incoming UDP without sending first (e.g. ps2link on port 18194) cannot receive traffic from the host. Add an EthUDPPorts setting (comma-separated port list) under [DEV9/Eth] in PCSX2.ini. The SocketAdapter pre-creates UDP_FixedPort entries at initialization, binding real host sockets so incoming packets are forwarded to the emulated PS2. UDP_FixedPort gains an isListening flag that: - Accepts packets from any source without requiring a child session - Prevents auto-close when all child sessions disconnect - Survives socket errors without tearing down the port Also fixes two issues with received IP packets: - Set TTL=64 (was 0, causing lwIP to discard packets) - Use configured PS2IP for destination routing on listening ports (dhcpServer.ps2IP is always 192.0.2.100 in Sockets mode, which doesn't match the PS2's static IP from IPCONFIG.DAT) Example PCSX2.ini config for ps2link/ps2client support: [DEV9/Eth] EthUDPPorts = 18194 PS2IP = 192.168.1.10 InterceptDHCP = true Then use: ps2client -h 127.0.0.1 execee host:program.elf
Add a text field for EthUDPPorts in the Intercept DHCP tab of the Network & HDD settings page, so users don't need to manually edit PCSX2.ini to configure pre-bound UDP ports.
This was referenced Apr 12, 2026
Contributor
|
Does #13391 serve the same purpose? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Add an
EthUDPPortssetting (comma-separated port list) that pre-binds UDP ports on the host when using Sockets mode. This allows inbound UDP traffic from the host to reach the emulated PS2.Currently in Sockets mode, UDP ports are only bound when the PS2 sends a packet first. PS2 software that listens for incoming UDP without sending first (e.g. ps2link on port 18194) cannot receive traffic from the host. This change creates
UDP_FixedPortentries at adapter initialization with anisListeningflag that accepts packets from any source.A "UDP Ports" text field is added to the Network & HDD settings page (Intercept DHCP tab) so users can configure this from the UI.
Also fixes two issues with received IP packets:
PS2IPfor destination routing on listening ports (dhcpServer.ps2IPis always192.0.2.100in Sockets mode, which doesn't match the PS2's static IP)Rationale behind Changes
Enables
ps2client(the standard PS2 development tool) to communicate with ps2link running inside PCSX2, which is essential for PS2 homebrew development workflows. Previously,ps2clientcommands likeexeceeandresetcould only work on real hardware because the Sockets adapter didn't support inbound UDP.With this change, developers can use:
Suggested Testing Steps
192.168.1.10), and set UDP Ports to18194lsof -nP -c PCSX2 | grep UDPshould show*:18194ps2client -h 127.0.0.1 execee host:hello.elf— the ELF should load and executeps2client -h 127.0.0.1 reset— ps2link should process the reset command (note: PCSX2's IOP recompiler may crash on the soft reboot, which is a pre-existing limitation)Did you use AI to help find, test, or implement this issue or feature?
Yes. Claude (Anthropic) was used to analyze the DEV9 Sockets adapter architecture, implement the changes, and iteratively debug the packet routing (destination IP mismatch and TTL=0 issues).