Skip to content

feat(libSceNet): list IPv6 sockets in sceNetGetSockInfo6 - #8362

Merged
adriadam10 merged 9 commits into
boykopovar:mainfrom
MarrasFederico:feat/net-get-sock-info6
Oct 24, 2026
Merged

adriadam10 merged 9 commits into
boykopovar:mainfrom
MarrasFederico:feat/net-get-sock-info6

Conversation

@MarrasFederico

@MarrasFederico MarrasFederico commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

sceNetGetSockInfo6 threw not implemented, and its debt entry listed the signature as unknown. SharpProspero Socket.cs documents SceNetSockInfo6: the 0xA0-byte SceNetSockInfo with its two reserved blocks at 0x6C and 0x7C used for the local and remote IPv6 addresses, and the IPv4 address fields kept for IPv4-only sockets. It also documents the IPV6 status flag (0x400000) and the 0x1000 flag that reports both families.

The call is the IPv6 counterpart of sceNetGetSockInfo and follows it for everything else:

  • Validation: flags other than 0x40 (TIME_WAIT) and 0x1000 fail with EINVAL, as do a null info with s >= 0 and n < 1; a bad descriptor fails with EBADF.
  • Counting and listing: with s < 0, a null info returns the count, and otherwise up to n records are written in descriptor order.
  • Which sockets: IPv6 sockets only; with 0x1000 IPv4 sockets too. An IPv4 socket asked for by s without 0x1000 fails with EAFNOSUPPORT, as sceNetGetSockInfo does for an IPv6 socket.
  • Fields: the IPv6 local and remote addresses and ports, buffer sizes and the SELF, NONBLOCK and IPV6 flags. An IPv4 socket is reported with its IPv4 addresses, zero IPv6 addresses and no IPV6 flag. The other fields are 0, as in sceNetGetSockInfo.

The debt entry records that nothing is measured on a console; shadPS4 only stubs the call.

Current overlap follow-up: #9948 changes sock_buffer_size from Sock to SockInfoSource; this PR's fill_sock_info6 still uses the former. I proposed #8362 first, then #9948 with that caller adapted on rebase. This is a proposed order, not a completed combined validation.

Tested

Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with BUILD_TESTING=ON. Windows was not compiled. No title was run.

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

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Progress report (8b3e398 → d5d453c)

📈 System libraries: 43.24% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceNet sceNetGetSockInfo6

@github-actions

github-actions Bot commented Oct 20, 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 9948 core/libs/prx/libSceNet/Export.cpp L1695-1696

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
docs/dev/debt/libSceNet.md
PR 7201 core/libs/prx/libSceNet/Export.cpp
PR 7511 core/libs/tests/GuestSceNet.cpp
PR 9727 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 9733 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 10502 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@MarrasFederico thanks. The layout and the listing logic match sceNetGetSockInfo, but the branch no longer builds once merged with current main:

core/libs/prx/libSceNet/Export.cpp:1639:50: error: 'struct {anonymous}::Sock' has no member named 'nonblock'

Since your base, main moved the non-blocking flag from Sock into the native handle (std::shared_ptr<NativeSocketHandle> native), and sceNetGetSockInfo's fill_sock_info now reads socket.native->nonblock. Please rebase onto main and make the same change in fill_sock_info6:

record.flags = NET_SOCKINFO_F_SELF | (socket.native->nonblock ? NET_SOCKINFO_F_NONBLOCK : 0);

(Checked with GCC 13 -fsyntax-only on the merge of a6a3831b7f into main 7ce3b1df3e: main alone compiles, the merge fails only at that line, and GuestSceNet.cpp compiles.)

@ycbuzi

ycbuzi commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Windows build of a6a3831 merged onto current main b77bd58 (clean merge, 3a504b44fe) fails, the build the description lists as not done. Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release, BUILD_TESTING=ON.

core/libs/prx/libSceNet/Export.cpp: In function 'int fill_sock_info6(int, NetSockInfo6&, bool)':
core/libs/prx/libSceNet/Export.cpp:1639:50: error: 'struct {anonymous}::Sock' has no member named 'nonblock'
 1639 |     record.flags = NET_SOCKINFO_F_SELF | (socket.nonblock ? NET_SOCKINFO_F_NONBLOCK : 0);

fill_sock_info6 copies sceNetGetSockInfo's record code as it was at this PR's base 777bd0f. #8653 (merged 01:19 UTC today) has since removed bool nonblock from Sock and moved the flag to std::atomic<bool> nonblock in NativeSocketHandle; its edit to the IPv4 copy merges without a conflict, so after the merge sceNetGetSockInfo reads socket.native->nonblock (line 1576) while the IPv6 copy still reads socket.nonblock. The line is not under _WIN32 and Sock has no nonblock on any host now, so I expect the same error on Linux after a rebase; I only built Windows. This PR's last checks ran before #8653 landed, with the build jobs skipped.

With this one line changed on the merge, libSceNet and guest_sce_net_tests build with no warnings, and ctest --repeat until-fail:2 on guest_sce_net passes on both repeats. Its new nonblocking datagram case expects the 0x200000 flag, so it exercises this read.

-    record.flags = NET_SOCKINFO_F_SELF | (socket.nonblock ? NET_SOCKINFO_F_NONBLOCK : 0);
+    record.flags = NET_SOCKINFO_F_SELF | (socket.native->nonblock ? NET_SOCKINFO_F_NONBLOCK : 0);

Not run: Linux, a title.

@adriadam10 adriadam10 self-assigned this Oct 21, 2026
@MarrasFederico

Copy link
Copy Markdown
Contributor Author

@oneandonlydean thanks, fixed in c4a2fbf after merging current main: fill_sock_info6 now reads socket.native->nonblock, as fill_sock_info does. It builds, and guest_sce_net passes, including the IPv6 cases in a network namespace with IPv6 on lo.

@ycbuzi that was the same line your Windows build stopped on.

@harmsluis

Copy link
Copy Markdown

Windows run of the fix (c4a2fbf79) merged onto main cecb540a6 without conflicts. Windows 11 build 26300, non-elevated, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON.

  • guest_sce_net builds with no new warnings and passes 5/5 (ctest --repeat until-fail:3 and two more runs). CheckSockInfo6 is called from the test, so sceNetGetSockInfo6 ran.
  • Control, only that one line put back to socket.nonblock: the build stops at Export.cpp:1639 with 'struct {anonymous}::Sock' has no member named 'nonblock', the same error as the earlier Windows build of a6a3831b7.

Not covered: the full build, and any title run.

@MarcZX10

Copy link
Copy Markdown
Contributor

I am reviewing #9506, which adds sceNetSetDnsInfo, sceNetSetDns6Info and sceNetGetDns6Info plus a new registered test and debt entry. The overlap bot could not compare some of these branches because of base conflicts, and this PR author has not yet recorded an agreed merge order. Please confirm whether your current changes overlap these exact exports, CMake/test insertion, or debt section, and whether #9506 can land before your PR or should depend on yours. The #9506 author is being asked to record the agreed order in Depends on and the overlap note.

…nfo6

# Conflicts:
#	core/libs/prx/libSceNet/Export.cpp
#	docs/dev/debt/libSceNet.md
@MarrasFederico

Copy link
Copy Markdown
Contributor Author

@MarcZX10 no overlap with #9506. I checked the exact exports, the CMake/test registration and the debt section:

I updated this branch to main 524398151f, where sceNetGetSockInfo6 now has a declared signature, and the implementation takes it.

Merged together onto that main, the two branches merge cleanly. guest_sce_net and guest_net_dns_info both pass, in a network namespace with IPv6 on loopback. #9506 can land before or after this PR; neither needs to depend on the other. I added this to the description.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@MarcZX10

Copy link
Copy Markdown
Contributor

I compared your current branch with open #9544. The implementations/tests are independent, but both branches add a debt entry at the same insertion point in docs/dev/debt/libSceNet.md, and their pairwise three-way merge currently conflicts in that file. Please coordinate the merge order with #9544’s author and update the overlap note / Depends on if one PR must land first. #9544 individually merges cleanly with current main; the conflict is between the two PR branches.

@MarrasFederico

Copy link
Copy Markdown
Contributor Author

@MarcZX10 thanks. I moved the sceNetGetSockInfo6 debt entry instead of ordering the two PRs. It now sits after the sceNetSendmsg and sceNetRecvmsg entry, a line that no open PR edits; before, both this PR and #9544 inserted right after sceNetGetSockInfo.

With the current head:

No Depends on is needed either way. I updated the overlap note in the description.

@MarrasFederico

Copy link
Copy Markdown
Contributor Author

@ntamas94 I compared the current diffs of #9948 and this PR. The exports are distinct, but #9948 changes sock_buffer_size to take SockInfoSource, while fill_sock_info6 here passes a Sock. I propose #8362 first, then #9948 rebased onto it; the latter will need to pass a SockInfoSource from fill_sock_info6 too. This PR does not require #9948. No combined build has been run here yet.

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

Checked against main 522e32e and SharpProspero Socket.cs (5dfdb4b):

  • It still merges cleanly with current main (3-way merge-tree, no conflicts), and main still throws in sceNetGetSockInfo6, so this isn't duplicated.
  • fill_sock_info6 matches main's fill_sock_info (the native->nonblock read, the Winsock WSAEINVAL handling for an unbound socket, ENOTCONN from getpeername). Because IPV6_V6ONLY is set at socket creation, no v4-mapped addresses reach the IPv6 branch.
  • The NetSockInfo6 definition completes main's global-scope forward declaration, and the static_asserts pin 0x6C/0x7C and the fields shared with NetSockInfo.
  • The debt entry clearly separates what is inferred (IPv4 sockets left out by default, zero IPv6 addresses for IPv4 sockets, accepting 0x40) from what SharpProspero documents, and those inferred paths fail rather than report success. Nothing to add beyond the #9948 ordering you already noted.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

@adriadam10
adriadam10 merged commit d4b85d2 into boykopovar:main Oct 24, 2026
12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Merged onto current main with no conflicts. Checked the NetSockInfo6 layout against NetSockInfo (static_asserts on the shared offsets and the 0x6C/0x7C address blocks), the error and listing paths against sceNetGetSockInfo, and that guest_sce_net pins every byte of the records and fails on main. The Windows build error was fixed in c4a2fbf and verified by @harmsluis. Console behaviour is noted as unmeasured in the debt entry. Merged.

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.

7 participants