Skip to content

feat(libSceNet): implement sceNetSetDns6InfoToKernel - #23477

Closed
GRG-DA wants to merge 1 commit into
boykopovar:mainfrom
GRG-DA:feat-libnet-dns6-forward
Closed

GRG-DA wants to merge 1 commit into
boykopovar:mainfrom
GRG-DA:feat-libnet-dns6-forward

Conversation

@GRG-DA

@GRG-DA GRG-DA commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

What

Implement sceNetSetDns6InfoToKernel in core/libs/prx/libSceNet/Export.cpp by forwarding to the already-implemented sceNetSetDns6Info, matching the existing sceNetSetDnsInfoToKernel → sceNetSetDnsInfo pattern in the same file. The forward performs the real IPv6 DNS override work (init and flag validation, checked guest read, primary-address validation, storing g_dns6Override) rather than returning a fabricated success. A debt fragment records that the forwarding is inferred from the in-file pattern and is unmeasured on PS5 hardware.

All other stubbed exports in this library require PS5-specific kernel behaviour (configuration, DHCP/WLAN/PPPoE/routing daemons, BPF dumps, kernel-table text and statistics) with no public source, so they remain throwing and are documented in docs/dev/debt/libSceNet.md.

Tested

Windows host. python tools/progress.py: libraries 17227/39548 → 17228/39548; libSceNet 115/232 → 116/232. python tools/check_conventions.py --base origin/main: all checks passed. python tools/debt_fold.py --check and git diff --check main...HEAD: clean. python tools/pr_overlap.py --names on all libSceNet stub names before implementing: sceNetGetsockopt is claimed by open PR #18108 and was skipped; this function had no overlap. No build, ctest, title or homebrew run was performed for this one-line forward.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

Copy link
Copy Markdown

Progress report (a0f6ff9 → 3fc75c0)

📈 System libraries: 43.89% (+0.0025%, +1 implemented function)

✅ 1 implemented
Library Name
libSceNet sceNetSetDns6InfoToKernel

Changed libraries (implemented exports)

Library Before After Change
libSceNet 115/232 (49.57%) 116/232 (50.00%) +0.43%

@github-actions

github-actions Bot commented Nov 20, 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
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 18108 core/libs/prx/libSceNet/Export.cpp
PR 23975 core/libs/prx/libSceNet/Export.cpp

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head 3fc75c051f, applied with git apply on main fd4aeed483 together with the other 28 PRs of one batch (#22683, #23796, #23923, #24367, #24370, #24409, #24486, #24587, #10623, #18903, #18941, #19461, #21018, #21303, #21451, #21965, #23478, #23726, #24463, #12827, #14127, #14991, #20063, #24103, #24331, #24508, #24565, #15838). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
none: no test of its own in this PR - -

Whole batch: the full ctest -j 12 (6523 tests) on the RTX 3080 has 5 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. Traced to other PRs of the batch, each by reverting it and testing again: #24409 (guest_usbd); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_net_dns_info, test_script_registration. The 2126 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

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

Reviewed — looks good

Nothing blocks this change; the new export forwards to the existing IPv6 DNS setter, which performs initialization, flag, guest-memory, and address validation before updating the override.

What I ran

Reviewed head 3fc75c051f94d66829af8e5a4a02c2ac7eee58c2. No tests or builds were run. The description reports Windows-host checks, but I did not run them.

Results

Check Result Note
Code review passed Forward matches the IPv4 pattern
Tests and build not run No independent execution

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests, build, or console behavior were run. Read core/libs/prx/libSceNet/Export.cpp and docs/dev/debt/changes/feat-libnet-dns6-forward.md; both reviewed files were present in the manifest. files.json was unavailable through the reader, so excluded-file details were not verified.

To get this to a good state

Nothing is required.

@Helldiverr

Copy link
Copy Markdown
Contributor

Windows run of 3fc75c0, merged onto main bca96e3 (merge e4d719dc4d). The merge is clean and adds only this PR's change: 2 files, +6/-2. In this comment, "the test" means core/libs/tests/GuestNetDnsInfo.cpp at main bca96e3; the PR does not change it.

Host: Ryzen 9 9950X3D, Windows 11 Pro 26300, WinLibs GCC 15.2, Ninja, Release. Tests: guest_net_dns_info, the only test that calls sceNetSetDns6InfoToKernel, plus the neighbouring guest_sce_net_kernel_forwards and guest_net_ps4_exports.

Existing runs:

  • The author ran progress.py, check_conventions.py and debt_fold.py. The description says no build or ctest was run.
  • kiwe147 ran Windows at 3fc75c0, together with 28 other PRs on main fd4aeed. That run saw guest_net_dns_info fail but could not trace it to a single PR.
  • MarcZX10 read the code at 3fc75c0, with no findings.

This run traces that failure to this PR alone, then adds a negative control and mutations for a replacement check.

Results

Run Result
main, 3 tests 3/3 pass
merge, 3 tests, 3 runs 2/3 each time; guest_net_dns_info aborts (0xc0000409)
progress.py --module libSceNet 104/231 on main, 105/231 on the merge
check_conventions.py --base upstream/main passes
debt_fold.py --check passes

guest_net_dns_info still requires the export to throw. CheckKernelDnsThrows (the test, 143-152) calls sceNetSetDns6InfoToKernel and requires a std::runtime_error. main calls it three times (156, 159, 163). With the forward, the first call returns the not-initialized error instead of throwing, and Require(threwV6) aborts. kiwe147 saw this failure in the batch run.

The IPv4 forward (57e6abe, sceNetSetDnsInfoToKernel) changed the same test in the same commit: it removed the IPv4 throw check and added the checks the setter has. Doing the same for IPv6 fixes the test. I replaced CheckKernelDnsThrows with this function, and changed the three calls in main to CheckKernelDns6(false), CheckKernelDns6(true) and CheckKernelDns6(false):

void CheckKernelDns6(bool initialized) {
    NetDns6Info info6{};
    std::memset(&info6, 0x5a, sizeof(info6));
    const NetDns6Info before6 = info6;
    if (!initialized) {
        for (const std::uint32_t flags : {0u, 1u, 0xffffffffu}) {
            Require(Failed(sceNetSetDns6InfoToKernel(&info6, flags), kEnotinit));
            Require(Failed(sceNetSetDns6InfoToKernel(nullptr, flags), kEnotinit));
            Require(std::memcmp(&info6, &before6, sizeof(info6)) == 0);
        }
        return;
    }
    NetDns6Info set6{};
    Require(Failed(sceNetSetDns6InfoToKernel(&set6, 0), kEinval));
    set6.primaryAddress.bytes[0] = 0x20;
    set6.primaryAddress.bytes[15] = 0x01;
    Require(Failed(sceNetSetDns6InfoToKernel(&set6, 2), kEinval));
    Require(Failed(sceNetSetDns6InfoToKernel(nullptr, 1), kEinval));
    Require(sceNetSetDns6InfoToKernel(&set6, 0) == 0);
    Require(sceNetGetDns6Info(&info6, 0) == 1 && std::memcmp(&info6, &set6, sizeof(set6)) == 0);
    set6.secondaryAddress.bytes[0] = 0x26;
    Require(sceNetSetDns6InfoToKernel(&set6, 0) == 0);
    Require(sceNetGetDns6Info(&info6, 0) == 2 && std::memcmp(&info6, &set6, sizeof(set6)) == 0);
    void* page = UnreadablePage();
    Require(page != nullptr);
    Require(Failed(sceNetSetDns6InfoToKernel(static_cast<const NetDns6Info*>(page), 1), kEinval));
    Require(Failed(sceNetSetDns6InfoToKernel(static_cast<const NetDns6Info*>(page), 0), kEfault));
    Require(sceNetGetDns6Info(&info6, 0) == 2 && std::memcmp(&info6, &set6, sizeof(set6)) == 0);
#ifdef _WIN32
    Require(VirtualFree(page, 0, MEM_RELEASE) != 0);
#else
    Require(munmap(page, 4096) == 0);
#endif
    Require(sceNetSetDns6InfoToKernel(nullptr, 0) == 0);
    Require(sceNetGetDns6Info(&info6, 0) == 0);
}
Run Result
merge + replacement, 3 tests, 3 runs 3/3 each time
main + replacement (negative control) aborts: sceNetSetDns6InfoToKernel not implemented
m1: the forward returns 0 aborts
m2: the forward passes 0 instead of flags aborts

Once the test file has this replacement or an equivalent, guest_net_dns_info passes with the forward. The debt fragment's "forwards to sceNetSetDns6Info the same way" then has a test behind it.

AI-assisted: yes

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@GRG-DA, I am closing this one. The forward to sceNetSetDns6Info is clean, but it is inferred from the file pattern, with no console probe, no test and no title we know of that calls it, so it would not change what any game does. If you find a title that calls sceNetSetDns6InfoToKernel, or see what it does on a PS5, please reopen with that and it goes to review.

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.

5 participants