feat(libkernel): add LAN relay settings and a loopback skeleton (off by default) #17212

Closed
MarcZX10 wants to merge 30 commits from upstream-pr/17212 into main
MarcZX10 commented 2026-11-08 14:42:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-08T14:42:15Z.


What

Adds the configuration and a loopback relay skeleton for a future LAN link between two AnyPS5 instances. Off by default: with ANYPS5_LAN_LISTEN and ANYPS5_LAN_PEERS both unset nothing changes.

  • ANYPS5_LAN_LISTEN (host:port, IPv4 literal, UDP): opens the relay's socket at process start. Port 1 to 65535.
  • ANYPS5_LAN_PEERS (comma-separated host:port): parsed and checked; repeated entries count once; needs ANYPS5_LAN_LISTEN.
  • Bad values print one line naming the variable and leave the feature off; they never stop the title.
  • The relay sends nothing yet, and it is closed at exit.
  • No guest-visible change: no libkernel socket function calls the relay.
  • Docs: docs/dev/ENVIRONMENT.md rows; docs/dev/debt/libkernel.md entry that broadcast forwarding is not implemented.

Follow-ups (not in this PR): frame format and loop filter; broadcast relay in sendto; delivery of relayed datagrams to local receivers; multicast.

Tested

Linux x86-64 (GCC), archive build through the anyps5 validate script, head 2e46368c7c: BUILD-EXIT 0, and ctest -R '^(lan_relay|guest_socket_.*)$': 17 of 17 passed, including lan_relay (parser, validation, settings, open/close on ephemeral ports, port-in-use refusal, no leaked descriptors, default-off, one-line log) and the existing guest_socket_* tests. tools/check_conventions.py and git diff --check passed. Windows, macOS and a second machine: not tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Not verified

  • Two machines, or two instances talking over a LAN: not done, and nothing sends yet.
  • Windows, macOS and console behaviour: not built or run here.
  • Real game titles: not run.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5212227903 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17212). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-08T14:42:15Z. --- ### What Adds the configuration and a loopback relay skeleton for a future LAN link between two AnyPS5 instances. Off by default: with `ANYPS5_LAN_LISTEN` and `ANYPS5_LAN_PEERS` both unset nothing changes. - `ANYPS5_LAN_LISTEN` (`host:port`, IPv4 literal, UDP): opens the relay's socket at process start. Port 1 to 65535. - `ANYPS5_LAN_PEERS` (comma-separated `host:port`): parsed and checked; repeated entries count once; needs `ANYPS5_LAN_LISTEN`. - Bad values print one line naming the variable and leave the feature off; they never stop the title. - The relay sends nothing yet, and it is closed at exit. - No guest-visible change: no libkernel socket function calls the relay. - Docs: `docs/dev/ENVIRONMENT.md` rows; `docs/dev/debt/libkernel.md` entry that broadcast forwarding is not implemented. Follow-ups (not in this PR): frame format and loop filter; broadcast relay in `sendto`; delivery of relayed datagrams to local receivers; multicast. ### Tested Linux x86-64 (GCC), archive build through the anyps5 validate script, head 2e46368c7c: `BUILD-EXIT 0`, and `ctest -R '^(lan_relay|guest_socket_.*)$'`: 17 of 17 passed, including `lan_relay` (parser, validation, settings, open/close on ephemeral ports, port-in-use refusal, no leaked descriptors, default-off, one-line log) and the existing `guest_socket_*` tests. `tools/check_conventions.py` and `git diff --check` passed. Windows, macOS and a second machine: not tested. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes ### Not verified - Two machines, or two instances talking over a LAN: not done, and nothing sends yet. - Windows, macOS and console behaviour: not built or run here. - Real game titles: not run.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!17212
No description provided.