Skip to content

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

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
Queuse:codex/net-oob-inline
Oct 26, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
Queuse:codex/net-oob-inline

Conversation

@Queuse

@Queuse Queuse commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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: feat(libSceNet): expose socket type and listen state #9525 (merge order)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Queuse commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@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.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5836 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 7201 core/libs/prx/libSceNet/Export.cpp
PR 7490 core/libs/prx/libSceNet/Export.cpp
PR 9231 core/libs/prx/libSceNet/Export.cpp
PR 9515 core/libs/prx/libSceNet/Export.cpp
PR 9578 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 9932 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 9948 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 10097 docs/dev/debt/libSceNet.md
PR 10502 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 10628 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 10629 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 10881 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 10949 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 11037 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 11134 core/libs/prx/libSceNet/Export.cpp
PR 11155 docs/dev/debt/libSceNet.md
PR 11242 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 11243 core/libs/prx/libSceNet/Export.cpp
PR 11341 core/libs/prx/libSceNet/Export.cpp

@Queuse
Queuse force-pushed the codex/net-oob-inline branch from 05c4efa to 6dbde36 Compare October 22, 2026 01:35
@Queuse

Queuse commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@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 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Queuse commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@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.

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MarcZX10

Copy link
Copy Markdown
Contributor

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

Queuse commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@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.

@Queuse

Queuse commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed in 8d1b7bc6f5. The merge retains both SO_OOBINLINE and main's SO_PROTOCOL getter, plus main's short TCP_NODELAY reads. The OOB inheritance/data test and the protocol, TCP_NODELAY and buffer controls pass 4/4 on Windows. Public-header, convention and whitespace checks pass too.

#9525 before this PR remains the order. #6044 was closed without its test relocation; the separate peer/broadcast coordination with #5836 is still pending.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 26, 2026
@adriadam10 adriadam10 self-assigned this Oct 26, 2026
@adriadam10
adriadam10 force-pushed the codex/net-oob-inline branch from 8d1b7bc to 6c0bb5a Compare October 26, 2026 13:06
@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 26, 2026 13:07

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@adriadam10
adriadam10 merged commit 0e5d5a5 into boykopovar:main Oct 26, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Rebased onto current main after #9525 merged: the SO_TYPE/SO_ACCEPTCONN getter, the SO_OOBINLINE getter and the SO_PROTOCOL getter are all kept, and the merge/chore commits are dropped. Checked the FreeBSD 11.4 sosetopt/sogetopt semantics, the accept-inheritance and truncated-readback tests, and the debt entry; libSceNet and libs tests pass after the rebase; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants