feat(libSceNet): implement sceNetGetDnsInfo #8268

Merged
Athen2045 merged 1 commit from upstream-pr/8268 into main 2026-10-20 22:50:31 +00:00
Athen2045 commented 2026-10-20 07:52:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Athen2045 on 2026-10-20T07:52:04Z.


What

Implements sceNetGetDnsInfo(info, flags). It writes the host's first two IPv4 DNS servers into the two slots of info, in network byte order, and returns the number of servers (0 to 2). Unused slots are zeroed.

  • Signature, layout and return value: the PS4 OpenOrbis musl resolver calls sceNetGetDnsInfo(&info, 0) with {primary_dns, secondary_dns} and uses the result as the server count. OpenOrbis Net.h declares int32_t sceNetGetDnsInfo(OrbisNetDnsInfo*, int32_t flags). SharpProspero has the same two-address struct. Not verified on PS5 hardware.
  • The servers come from the same host interface that sceNetCtlGetInfo uses for PRIMARY_DNS and SECONDARY_DNS, so the two libraries agree. libSceNetCtl exports NetCtlHostDnsServers_nid_no_patch and libSceNet links libSceNetCtl, as libSceAudioOut links libScePad. There is no made-up default server.
  • Nonzero flags and a null info throw, because their console results are unknown.
  • Not in this PR: sceNetSetDnsInfo, which SharpProspero describes as setting fallback servers (its effect on Get is unknown), and the Dns6 pair (the only source is shadPS4). They still throw.
  • The debt entry now lists what is still unverified.

Tested

Windows 11 (26300), WinLibs GCC 15.2.0, on main 3fd1cc393.

  • New checks in guest_sce_net: the result matches sceNetCtlGetInfo(17) and (18) slot by slot, nothing is written past the two slots, unused slots are zero, and nonzero flags and a null info throw. This host has DNS servers configured, so the comparison runs against real addresses. With the two slots swapped on purpose, the test fails.
  • The Net and NetCtl tests (23) pass. Full suite: 1713 of 1717 pass. The 4 failures also fail on main on this machine: conventions_env_reference and conventions_blob_reads (the git helper in their temporary repositories), windows_import_modules (msvcrt stdout probe) and agc_driver_pass_input_hazard (NVIDIA GPU).
  • 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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4932713041 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8268). Originally posted by [Athen2045](https://github.com/Athen2045) on 2026-10-20T07:52:04Z. --- ### What Implements `sceNetGetDnsInfo(info, flags)`. It writes the host's first two IPv4 DNS servers into the two slots of `info`, in network byte order, and returns the number of servers (0 to 2). Unused slots are zeroed. - Signature, layout and return value: the PS4 [OpenOrbis musl resolver](https://github.com/OpenOrbis/musl/blob/2b0bb8ce2fa64ac255cb656785729d159a5f074c/src/network/resolvconf.c) calls `sceNetGetDnsInfo(&info, 0)` with `{primary_dns, secondary_dns}` and uses the result as the server count. [OpenOrbis Net.h](https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/0a1aaf9dd4a92695538bdeb09fb056d06dd11725/include/orbis/Net.h) declares `int32_t sceNetGetDnsInfo(OrbisNetDnsInfo*, int32_t flags)`. [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Net/Socket.cs) has the same two-address struct. Not verified on PS5 hardware. - The servers come from the same host interface that `sceNetCtlGetInfo` uses for `PRIMARY_DNS` and `SECONDARY_DNS`, so the two libraries agree. libSceNetCtl exports `NetCtlHostDnsServers_nid_no_patch` and libSceNet links libSceNetCtl, as libSceAudioOut links libScePad. There is no made-up default server. - Nonzero flags and a null `info` throw, because their console results are unknown. - Not in this PR: `sceNetSetDnsInfo`, which SharpProspero describes as setting fallback servers (its effect on Get is unknown), and the Dns6 pair (the only source is shadPS4). They still throw. - The debt entry now lists what is still unverified. ### Tested Windows 11 (26300), WinLibs GCC 15.2.0, on `main` 3fd1cc393. - New checks in `guest_sce_net`: the result matches `sceNetCtlGetInfo(17)` and `(18)` slot by slot, nothing is written past the two slots, unused slots are zero, and nonzero flags and a null info throw. This host has DNS servers configured, so the comparison runs against real addresses. With the two slots swapped on purpose, the test fails. - The Net and NetCtl tests (23) pass. Full suite: 1713 of 1717 pass. The 4 failures also fail on `main` on this machine: `conventions_env_reference` and `conventions_blob_reads` (the git helper in their temporary repositories), `windows_import_modules` (msvcrt stdout probe) and `agc_driver_pass_input_hazard` (NVIDIA GPU). - No title was run. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-20 08:08:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T08:08:17Z.


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
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 6044 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/tests/GuestSceNet.cpp
PR 6879 core/libs/prx/libSceNet/Export.cpp
PR 7201 core/libs/prx/libSceNet/Export.cpp
core/libs/prx/libSceNetCtl/Export.cpp
PR 8204 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6286457755 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8268#issuecomment-6286457755). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T08:08:17Z. --- <!-- pr-overlap --> 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](https://www.github.com/boykopovar/AnyPS5/pull/5836) | `core/libs/prx/libSceNet/CMakeLists.txt`<br>`core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/tests/GuestSceNet.cpp`<br>`docs/dev/debt/libSceNet.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceNet/CMakeLists.txt`<br>`core/libs/tests/GuestSceNet.cpp` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libSceNet/Export.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/prx/libSceNetCtl/Export.cpp` | | [PR 8204](https://www.github.com/boykopovar/AnyPS5/pull/8204) | `core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/tests/GuestSceNet.cpp`<br>`docs/dev/debt/libSceNet.md` |
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8268
No description provided.