feat(libSceNet): receive urgent TCP data inline #9543

Merged
Queuse merged 3 commits from upstream-pr/9543 into main 2026-10-26 13:25:46 +00:00
Queuse commented 2026-10-22 01:10:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Queuse on 2026-10-22T01:10:19Z.


What

Implement SO_OOBINLINE for sceNetSetsockopt and sceNetGetsockopt. TCP enables native inline urgent data; other socket types retain the flag, as FreeBSD socket flags do. Readback returns bit 0x100 with truncated output. Semantics follow FreeBSD 11.4 sosetopt/sogetopt and the Winsock OOB contract; PS5 urgent-pointer and signalling differences remain unverified in debt.

Merge after #9525 because both add a getter path beside the argument checks.

Tested

Windows 11 x86-64, WinLibs MinGW-w64 GCC 15.2.0-r7, Ninja, Release. Head 8d1b7bc6f5 includes main b4d8e8bb3b.

  • Rebuilt affected libraries and focused targets; guest_net_oob_inline, guest_net_protocol, guest_net_nodelay_readback and guest_net_buffer_validation: 4/4 pass, no skips.
  • Canonical public-declaration audit, conventions and whitespace checks pass.
  • The merge retains main's protocol getter, truncated TCP_NODELAY reads, test registrations and current debt entries. The shared integer-length guard remains after the short-output paths.
  • A source recheck and trial merge with consulted main 19fe176ddc are clean. Its later closed-stream polling, IPv6 text and unrelated libc/kernel changes are outside these option paths; the local runtime results above belong to the stated head/base.
  • No fresh Linux/macOS runtime, full hosted product build, title or console run.

Integration order remains #9523 → #9542 → #9515 → #9578 and #9525 → #9543. #9930 and #9931 are now merged, so their former prerequisites for #9932/#9948 are satisfied; #9948 still follows #9932. #6044 was closed without merging the test relocation. #10097 follows #9523 as its author confirmed. The #5836 peer/broadcast order remains a proposal. The #9525/#10949 intersection concerns CMake test registration, with no option-behavior dependency; the author of #10949 confirmed #9525-first and declared Depends on: #9525.

Canonical overlap snapshot 7e4f6e0440: confirmed intersections with #9525. 7 comparisons remain incomplete because those branches conflict with the base: #5836, #7201, #9727, #9733, #9932, #9948, #10502. Manual inspection covers peer/broadcast transport mapping, macOS paths, argument validation, socket records and diagnostic output. Preserve every option path, field, canonical declaration, fixture and debt entry during integration; these checks do not establish a combined runtime pass with the conflicting branches.

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: #9525 (merge order)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4960537766 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543). Originally posted by [Queuse](https://github.com/Queuse) on 2026-10-22T01:10:19Z. --- ### What Implement `SO_OOBINLINE` for `sceNetSetsockopt` and `sceNetGetsockopt`. TCP enables native inline urgent data; other socket types retain the flag, as FreeBSD socket flags do. Readback returns bit `0x100` with truncated output. Semantics follow FreeBSD 11.4 [sosetopt/sogetopt](https://github.com/freebsd/freebsd-src/blob/releng/11.4/sys/kern/uipc_socket.c) and the Winsock [OOB contract](https://learn.microsoft.com/en-us/windows/win32/winsock/protocol-independent-out-of-band-data-2); PS5 urgent-pointer and signalling differences remain unverified in debt. Merge after #9525 because both add a getter path beside the argument checks. ### Tested Windows 11 x86-64, WinLibs MinGW-w64 GCC 15.2.0-r7, Ninja, Release. Head `8d1b7bc6f5` includes main `b4d8e8bb3b`. - Rebuilt affected libraries and focused targets; `guest_net_oob_inline`, `guest_net_protocol`, `guest_net_nodelay_readback` and `guest_net_buffer_validation`: 4/4 pass, no skips. - Canonical public-declaration audit, conventions and whitespace checks pass. - The merge retains main's protocol getter, truncated TCP_NODELAY reads, test registrations and current debt entries. The shared integer-length guard remains after the short-output paths. - A source recheck and trial merge with consulted main `19fe176ddc` are clean. Its later closed-stream polling, IPv6 text and unrelated libc/kernel changes are outside these option paths; the local runtime results above belong to the stated head/base. - No fresh Linux/macOS runtime, full hosted product build, title or console run. Integration order remains #9523 → #9542 → #9515 → #9578 and #9525 → #9543. #9930 and #9931 are now merged, so their former prerequisites for #9932/#9948 are satisfied; #9948 still follows #9932. #6044 was closed without merging the test relocation. #10097 follows #9523 as its author confirmed. The #5836 peer/broadcast order remains a proposal. The #9525/#10949 intersection concerns CMake test registration, with no option-behavior dependency; the author of #10949 confirmed #9525-first and declared `Depends on: #9525`. Canonical overlap snapshot `7e4f6e0440`: confirmed intersections with #9525. 7 comparisons remain incomplete because those branches conflict with the base: #5836, #7201, #9727, #9733, #9932, #9948, #10502. Manual inspection covers peer/broadcast transport mapping, macOS paths, argument validation, socket records and diagnostic output. Preserve every option path, field, canonical declaration, fixture and debt entry during integration; these checks do not establish a combined runtime pass with the conflicting branches. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### 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: #9525 (merge order) <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-10-22 01:15:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:15:58Z.

Review: CHANGES_REQUESTED


The accepted connection does not inherit the listener’s SO_OOBINLINE state. sceNetAccept constructs a fresh Sock connection with default fields and does not copy this option or set it on the accepted native socket. FreeBSD 11.4 copies head->so_options into the new socket in sonewconn (minus only SO_ACCEPTCONN), so an option set before listen is inherited by accepted sockets. The current test only checks a listener configured before listen, but its expected accepted value is 256 even when testing the first listener state? In this test the loop sets listener through {1,-1,0,256,0,1}, leaving it enabled, so it misses the disabled case. Please copy/apply the listener option state for the accepted socket and cover both enabled and disabled listener cases, including option changes after listen if supported. The existing independent SO_OOBINLINE boolean is also not copied in sceNetAccept. Hosted eligibility, conventions, intake, labels and report checks pass; platform build jobs were skipped by path policy. I did not run a local build.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5608149196 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543#pullrequestreview-5608149196). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T01:15:58Z. **Review:** CHANGES_REQUESTED --- The accepted connection does not inherit the listener’s `SO_OOBINLINE` state. `sceNetAccept` constructs a fresh `Sock connection` with default fields and does not copy this option or set it on the accepted native socket. FreeBSD 11.4 copies `head->so_options` into the new socket in `sonewconn` (minus only `SO_ACCEPTCONN`), so an option set before `listen` is inherited by accepted sockets. The current test only checks a listener configured before listen, but its expected accepted value is `256` even when testing the first listener state? In this test the loop sets listener through {1,-1,0,256,0,1}, leaving it enabled, so it misses the disabled case. Please copy/apply the listener option state for the accepted socket and cover both enabled and disabled listener cases, including option changes after listen if supported. The existing independent `SO_OOBINLINE` boolean is also not copied in `sceNetAccept`. Hosted eligibility, conventions, intake, labels and report checks pass; platform build jobs were skipped by path policy. I did not run a local build.
Queuse commented 2026-10-22 01:28:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Queuse on 2026-10-22T01:28:07Z.


@MarcZX10 thanks for catching the test gap. You're right that the loop ends with the listener option enabled, so it doesn't cover accepting with the option disabled or toggling it after listen.

I couldn't reproduce the inheritance failure on Windows. For TCP, sceNetGetsockopt reads SO_OOBINLINE from the native socket; the cached oobInline field is only read for non-stream sockets. sceNetAccept uses native accept, which inherits the listener's socket properties.

A standalone Winsock check passed all eight IPv4/IPv6 combinations: enabled/disabled before listen, both toggle directions after listen, and isolation from later listener changes. That's a host check, not a new guest-test or Linux run.

The guest regression still needs those missing cases. I'd like to pin them there before adding an explicit option copy to sceNetAccept, since the current TCP path already gets the inherited state from the native socket.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330450454 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543#issuecomment-6330450454). Originally posted by [Queuse](https://github.com/Queuse) on 2026-10-22T01:28:07Z. --- @MarcZX10 thanks for catching the test gap. You're right that the loop ends with the listener option enabled, so it doesn't cover accepting with the option disabled or toggling it after `listen`. I couldn't reproduce the inheritance failure on Windows. For TCP, `sceNetGetsockopt` reads `SO_OOBINLINE` from the native socket; the cached `oobInline` field is only read for non-stream sockets. `sceNetAccept` uses native `accept`, which [inherits the listener's socket properties](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept). A standalone Winsock check passed all eight IPv4/IPv6 combinations: enabled/disabled before `listen`, both toggle directions after `listen`, and isolation from later listener changes. That's a host check, not a new guest-test or Linux run. The guest regression still needs those missing cases. I'd like to pin them there before adding an explicit option copy to `sceNetAccept`, since the current TCP path already gets the inherited state from the native socket.
Queuse commented 2026-10-22 01:35:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Queuse on 2026-10-22T01:35:50Z.


@MarcZX10 added the missing guest-test coverage in 6dbde36e7d.

All eight IPv4/IPv6 scenarios pass: enabled/disabled before listen, both toggle directions after listen, and listener/accepted-socket isolation in both directions. The existing real MSG_OOB receive check still passes. Rebuilt libSceNet and the test on Windows 11, GCC 15.2.0 UCRT, Release; guest_net_oob_inline passes 1/1 in 0.23 s.

Forcing the accepted native option always on passes the old fixture but fails the expanded test. Forcing it always off also fails the expanded test; restoring the implementation passes. No production-code change or explicit copy in sceNetAccept was needed. Linux is still untested.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330552650 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543#issuecomment-6330552650). Originally posted by [Queuse](https://github.com/Queuse) on 2026-10-22T01:35:50Z. --- @MarcZX10 added the missing guest-test coverage in `6dbde36e7d`. All eight IPv4/IPv6 scenarios pass: enabled/disabled before `listen`, both toggle directions after `listen`, and listener/accepted-socket isolation in both directions. The existing real `MSG_OOB` receive check still passes. Rebuilt libSceNet and the test on Windows 11, GCC 15.2.0 UCRT, Release; `guest_net_oob_inline` passes 1/1 in 0.23 s. Forcing the accepted native option always on passes the old fixture but fails the expanded test. Forcing it always off also fails the expanded test; restoring the implementation passes. No production-code change or explicit copy in `sceNetAccept` was needed. Linux is still untested.
MarcZX10 commented 2026-10-22 01:40:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:40:50Z.

Review: DISMISSED


Thanks for adding the missing inheritance coverage. I reviewed the new head: it now tests IPv4 and IPv6 listeners with OOBINLINE enabled and disabled before listen, changes in both directions after listen, and isolation between listener, accepted socket and client. Your PR description reports the focused Windows test passing, and the current conventions/eligibility/labels/report checks pass. The product and relinker jobs were skipped; I did not run a local build.

One integration item remains before approval. I reran python3 tools/pr_overlap.py --branch refs/remotes/review/pr9543 --repo boykopovar/AnyPS5. It confirms the declared #9525 dependency and lists #6044 among shared files it could not compare because that branch conflicts with base. I manually checked #6044: it relocates networking tests and changes their registrations in this same libSceNet/CMakeLists.txt from add_test to add_library_test(networking ...). This PR adds another test there using the old path and registration pattern. Please coordinate with @TaymKal on which PR should land first, then update this branch/its Depends on entry as needed so the new OOB test is preserved in the networking test reorganization. The existing #9525 dependency should remain. Once this is resolved, I can reassess; I found no remaining issue with the accepted-socket inheritance behavior itself.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5608293540 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543#pullrequestreview-5608293540). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T01:40:50Z. **Review:** DISMISSED --- Thanks for adding the missing inheritance coverage. I reviewed the new head: it now tests IPv4 and IPv6 listeners with OOBINLINE enabled and disabled before listen, changes in both directions after listen, and isolation between listener, accepted socket and client. Your PR description reports the focused Windows test passing, and the current conventions/eligibility/labels/report checks pass. The product and relinker jobs were skipped; I did not run a local build. One integration item remains before approval. I reran `python3 tools/pr_overlap.py --branch refs/remotes/review/pr9543 --repo boykopovar/AnyPS5`. It confirms the declared #9525 dependency and lists #6044 among shared files it could not compare because that branch conflicts with base. I manually checked #6044: it relocates networking tests and changes their registrations in this same `libSceNet/CMakeLists.txt` from `add_test` to `add_library_test(networking ...)`. This PR adds another test there using the old path and registration pattern. Please coordinate with @TaymKal on which PR should land first, then update this branch/its `Depends on` entry as needed so the new OOB test is preserved in the networking test reorganization. The existing #9525 dependency should remain. Once this is resolved, I can reassess; I found no remaining issue with the accepted-socket inheritance behavior itself.
Queuse commented 2026-10-22 01:45:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Queuse on 2026-10-22T01:45:58Z.


@MarcZX10 thanks for checking the expanded test. I've proposed the landing order to @TaymKal on #6044, covering both this OOB test and #9542's boolean-readback test.

For this PR, the proposal is #9525 → #9543 → #6044. If the reorganization needs to land first, I'll instead adapt the test path and registration here, retain #9525, add #6044 to Depends on, and rerun the focused test. The order is still awaiting confirmation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330683757 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543#issuecomment-6330683757). Originally posted by [Queuse](https://github.com/Queuse) on 2026-10-22T01:45:58Z. --- @MarcZX10 thanks for checking the expanded test. I've [proposed the landing order to @TaymKal on #6044](https://github.com/boykopovar/AnyPS5/pull/6044#issuecomment-6330681462), covering both this OOB test and #9542's boolean-readback test. For this PR, the proposal is #9525 → #9543 → #6044. If the reorganization needs to land first, I'll instead adapt the test path and registration here, retain #9525, add #6044 to `Depends on`, and rerun the focused test. The order is still awaiting confirmation.
jotitadev commented 2026-10-22 04:36:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T04:36:08Z.

Review: COMMENTED


Linux run, since the description lists only Windows 11. The accept-inheritance cases depend on what the host's accept copies, so I checked them on a Linux host too.

Machine: Linux x86_64, i7-8700, Ubuntu 26.04 (kernel 7.0.0-38), GCC 15.2, Release, BUILD_TESTING=ON. Head 6dbde36e7 merged --no-commit onto main ab347d144 (clean).

  • guest_net_oob_inline passes, 3 of 3 runs: all eight IPv4/IPv6 inheritance scenarios and the real MSG_OOB receive (A!B). The 20 other libSceNet tests (guest_sce_net, net_dontwait_*, net_blocking_send, net_epoll_lifetime_*) pass with it.
  • Red→green: with main's Export.cpp and this test, it aborts at line 56, the first sceNetSetsockopt(listener, SOL_SOCKET, 0x100, ...).
  • Linux host check, plain sockets on the same box (IPv4 and IPv6 loopback): an accepted socket reads SO_OOBINLINE back as the listener had it before the connection (0→0, 1→1), and A, urgent !, B arrive as AB without the option and A!B with it. So on Linux the inheritance comes from the host socket as well, the same way the PR relies on it on Windows, and the stream-socket getter that reads the native option gives the FreeBSD sonewconn result here too.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609312351 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543#pullrequestreview-5609312351). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-22T04:36:08Z. **Review:** COMMENTED --- Linux run, since the description lists only Windows 11. The accept-inheritance cases depend on what the host's `accept` copies, so I checked them on a Linux host too. Machine: Linux x86_64, i7-8700, Ubuntu 26.04 (kernel 7.0.0-38), GCC 15.2, Release, `BUILD_TESTING=ON`. Head `6dbde36e7` merged `--no-commit` onto `main` `ab347d144` (clean). - `guest_net_oob_inline` passes, 3 of 3 runs: all eight IPv4/IPv6 inheritance scenarios and the real `MSG_OOB` receive (`A!B`). The 20 other libSceNet tests (`guest_sce_net`, `net_dontwait_*`, `net_blocking_send`, `net_epoll_lifetime_*`) pass with it. - Red→green: with `main`'s `Export.cpp` and this test, it aborts at line 56, the first `sceNetSetsockopt(listener, SOL_SOCKET, 0x100, ...)`. - Linux host check, plain sockets on the same box (IPv4 and IPv6 loopback): an `accept`ed socket reads `SO_OOBINLINE` back as the listener had it before the connection (0→0, 1→1), and `A`, urgent `!`, `B` arrive as `AB` without the option and `A!B` with it. So on Linux the inheritance comes from the host socket as well, the same way the PR relies on it on Windows, and the stream-socket getter that reads the native option gives the FreeBSD `sonewconn` result here too. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-22 11:46:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:46:48Z.


Current-head recheck: conventions/diff-check pass and the branch merges cleanly with current main; sync is 2 ahead / 116 behind (94fbb8cea base). The branch contains the added IPv4/IPv6 listener/accepted-socket cases, with Windows 1/1 and Linux focused results reported in the PR history. The proposed #9525 → #9543 → #6044 test-reorganization order is documented but still awaiting #6044’s author confirmation. Please close that loop, refresh onto current main, and rerun the focused tests before merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339961683 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543#issuecomment-6339961683). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:46:48Z. --- Current-head recheck: conventions/diff-check pass and the branch merges cleanly with current `main`; sync is 2 ahead / 116 behind (`94fbb8cea` base). The branch contains the added IPv4/IPv6 listener/accepted-socket cases, with Windows 1/1 and Linux focused results reported in the PR history. The proposed #9525 → #9543 → #6044 test-reorganization order is documented but still awaiting #6044’s author confirmation. Please close that loop, refresh onto current `main`, and rerun the focused tests before merge.
Queuse commented 2026-10-22 15:37:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Queuse on 2026-10-22T15:37:36Z.


@MarcZX10 refreshed this branch onto main b7d1d47a5 (head 2034dfe9b3). Conventions and whitespace checks pass, and the description separates earlier runtime results from the refreshed revision. The #9525 before #9543 order remains. I followed up with the authors of #6044 and #5836 and marked their ordering pending; I will not treat either proposal as agreed before they reply.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6344747268 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9543#issuecomment-6344747268). Originally posted by [Queuse](https://github.com/Queuse) on 2026-10-22T15:37:36Z. --- @MarcZX10 refreshed this branch onto main `b7d1d47a5` (head `2034dfe9b3`). Conventions and whitespace checks pass, and the description separates earlier runtime results from the refreshed revision. The #9525 before #9543 order remains. I followed up with the authors of #6044 and #5836 and marked their ordering pending; I will not treat either proposal as agreed before they reply.
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!9543
No description provided.