Skip to content

fix(libSceNet): store SO_ONESBCAST in sceNetSetsockopt - #6886

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
alexpournaras:fix/net-so-onesbcast
Oct 17, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
alexpournaras:fix/net-so-onesbcast

Conversation

@alexpournaras

Copy link
Copy Markdown
Contributor

What

Accept and store SO_ONESBCAST (0x10000) at the SOL_SOCKET level in sceNetSetsockopt, and read it back in sceNetGetsockopt.

Call of Duty: Black Ops (PPSA34501) sets this option when it starts its local server for campaign and zombies.

Previously, sceNetSetsockopt failed with EOPNOTSUPP, and the game later crashed in its Server thread while the mission loaded:

FATAL: unhandled exception 0xc0000005 on thread 6812 'Server'
  rip 0x00000001404700f0 app.exe+0x4700f0
  read of 0x000000000000001b

The implementation now:

  • Stores the value per socket, defaulting to 0.
  • Returns the stored value from sceNetGetsockopt, as shadPS4 does.
  • Keeps the existing checks: a value shorter than an int fails with EINVAL, and other unknown options still fail with EOPNOTSUPP.
  • Adds a guest test covering the default, set and read back, per-socket isolation, and a too-short value.
  • Documents the behaviour under libSceNet technical debt.

Sends ignore the option, so this is a compatibility fallback, not the broadcast behaviour itself. FreeBSD 11.4's ip(4) documents the like-named IP_ONESBCAST. With it, a send to an interface's directed broadcast address, such as 192.168.2.255, leaves through that interface with its destination rewritten to 255.255.255.255. Here host routing picks the interface and the destination is not rewritten. shadPS4 stores the option the same way and does not change sends either. Its TODO reads the option the other way round (255.255.255.255 converted to the interface broadcast address) and notes that "hosts deliver it on the LAN anyway". The exact PS5 semantics, including the value read back, remain unverified.

Tested

Windows 11 Pro, Ryzen 9 9900X, RTX 2060.

  • Without the changes: crashes in the Server thread when campaign or zombies game loads.
  • With the changes: campaign and zombies start and load without crashing.
  • Build and test results: Build succeeded; guest_sce_net, guest_net_ctl and guest_netctl_ap_dialog pass, including the new CheckOnesBroadcast.

Checklist

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 5836 core/libs/prx/libSceNet/Export.cpp L89
PR 6142 core/libs/tests/GuestSceNet.cpp L1085

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 6044 core/libs/tests/GuestSceNet.cpp
PR 6138 core/libs/tests/GuestSceNet.cpp
PR 6447 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md

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

First Linux run (the PR was tested on Windows only).

Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON.
Head a51d7dcce merged onto main 66e290f1c.

  • guest_sce_net, guest_net_ctl, guest_netctl_ap_dialog: pass.
  • Test-only on main (only GuestSceNet.cpp from the PR): guest_sce_net aborts. With the CheckOnesBroadcast() call commented out, the same binary passes, so the abort comes from the new check (EOPNOTSUPP on 0x10000).
  • Full non-GPU suite (-E "^agc|gpu|vulkan|video_out"): 648/650, same as base. The two failures (file_writer_binary/file_writer_text) are known on this host and also fail on base. One run showed a guest_host_standard_error timeout under load; it passed on rerun and in a second full-suite run.

No Linux-specific difference found.

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

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 17, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Rebase handoff — rebased onto current main (authorship unchanged). One conflict in docs/dev/debt/libSceNet.md: your SO_ONESBCAST entry sits alongside main's newer SO_SNDTIMEO/SO_RCVTIMEO entry, both kept.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6886
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 4b656882b.

@alexpournaras

Copy link
Copy Markdown
Contributor Author

Thanks for the rebase and the full-suite run. I pushed 4b656882b as is. 🚀

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 17, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 17, 2026
@oneandonlydean
oneandonlydean merged commit 23f1423 into boykopovar:main Oct 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants