Skip to content

fix(libSceNet): return EOPNOTSUPP when connecting a listening socket - #7490

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Lindamea1:fix/scenet-connect-listener
Nov 11, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Lindamea1:fix/scenet-connect-listener

Conversation

@Lindamea1

Copy link
Copy Markdown
Contributor

What

sceNetConnect on a listening stream socket handed the call to the host. On Linux it failed with 0x80410138 (EISCONN); on Windows, Winsock documents WSAEINVAL for it, which maps to 0x80410116 (EINVAL). With an address of the other family it failed with 0x8041012f (EAFNOSUPPORT) before reaching the host.

FreeBSD 11.4 refuses any connect on a listening socket first. sys_connect copies the address in and calls kern_connectat, which calls soconnect; soconnectat returns EOPNOTSUPP when SO_ACCEPTCONN is set, before the protocol's pru_connect looks at the address family. libkernel connect does the same since #6950.

sceNetConnect now returns 0x8041012d (EOPNOTSUPP, errno 45) for a socket that sceNetListen has put into the listening state, once the address is converted and before the family check, as #6950 does for connect. Null and short addresses keep their address errors. The listener keeps accepting afterwards. I don't know of a title that hits this.

Tested

Gentoo Linux, kernel 7.2.8, GCC 16.2.1, glibc 2.43, Release, BUILD_TESTING=ON, on main cb1d6e5.

Not run on Windows, macOS or a console.

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

🤖 Generated with Claude Code

sceNetConnect on a listening stream socket passed the call to the host,
so it failed with EISCONN (0x80410138) on Linux, EINVAL on Windows, and
EAFNOSUPPORT (0x8041012f) for an address of the other family. FreeBSD
11.4 soconnectat refuses any connect on a socket with SO_ACCEPTCONN
with EOPNOTSUPP before the protocol looks at the address, and libkernel
connect does the same since boykopovar#6950. Return 0x8041012d (EOPNOTSUPP) for a
listening socket once the address is converted, before the family check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 18, 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/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 12682 core/libs/prx/libSceNet/Export.cpp
PR 12688 core/libs/prx/libSceNet/Export.cpp
PR 12700 core/libs/prx/libSceNet/Export.cpp
PR 12965 core/libs/prx/libSceNet/Export.cpp
PR 13098 core/libs/prx/libSceNet/Export.cpp
PR 18515 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp

@github-actions github-actions Bot added the prx label Oct 18, 2026
@wachi35676

Copy link
Copy Markdown
Contributor

Windows run, since this was only syntax-checked there: Windows 11 (MinGW GCC 15.2), with this PR merged onto main 9f25d0bf5.

  • guest_sce_net with the two new sceNetConnect checks passes, and the listener still accepts afterwards.
  • With only GuestSceNet.cpp from this PR, the test aborts on main on Windows, as on Ubuntu 24.04 (GCC 13.3).
  • The socket/sce_net set passes (Windows 38/38, Linux 26/26).

This matches soconnectat (uipc_socket.c:993-994).

AI-assisted: yes (Claude Code); results above were run on this machine.

@ycarogabriel-lgtm

Copy link
Copy Markdown
Contributor

Ran this on macOS, since it was not run there: Apple M1, macOS 26.6.2 (25G83), x86-64 build under Rosetta 2, AppleClang 21. Merged into the macOS host branch of #7332 (57bccfbfc, main at d71853cf2) together with #7121, #7475, #7490, #7507 and #7612; Release build.

AI-assisted: yes (Claude Code). I ran the build and tests on my machine.

@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@JJenkx

JJenkx commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Windows check of head d841fb7bb6, merged onto main 49f3653632 (81b85ebe44, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_sce_net passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

@gabichuuuuu

Copy link
Copy Markdown
Contributor

Windows check of head d841fb7bb6, merged onto main 23541681b7 (clean merge, built together with other open PRs that touch different files).

Setup: Windows 11 x64, WinLibs GCC 15.2.0 (r7), Ninja, Release, BUILD_TESTING=ON, Python 3.15.

  • Tests built from this PR's test files: guest_sce_net.
  • All of them pass in 3 of 3 runs.
  • Negative control: with this PR's code reverted to main (files it adds removed) and rebuilt, guest_sce_net fail in 2 of 2 runs, so the tests detect the change.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit e877bcf into boykopovar:main Nov 11, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants