guest_sce_net aborts when IPv6 is disabled by sysctl (kernel has IPv6, ::1 unusable) #2820

Closed
opened 2026-10-10 16:10:19 +00:00 by eliyarson · 0 comments
eliyarson commented 2026-10-10 16:10:19 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-10T16:10:19Z.


guest_sce_net aborts on a Linux host where the kernel has IPv6 but net.ipv6.conf.all.disable_ipv6=1. #2251 skips the IPv6 checks only when socket(AF_INET6) fails with EAFNOSUPPORT (guest errno 47). Here the socket opens, so that skip is not taken, and the send to ::1 then fails.

Setup: main 57f96fd2, CachyOS (Arch-based), kernel 7.2.2, GCC, Release, -DBUILD_TESTING=ON. net.ipv6.conf.all.disable_ipv6 = 1; loopback has no ::1.

Reproduce: ctest --test-dir build -R '^guest_sce_net$' gives Subprocess aborted. The failing assertion is the Require on sceNetSendto to ::1 in CheckUnspecifiedIpv6 (core/libs/tests/GuestSceNet.cpp:242 before the patch). sceNetSendto returns guest errno 51 (NET_ENETUNREACH).

Patch: if that send fails with errno 51, close both sockets, set ipv6Unavailable, and return. The other checks still run and the test exits 77 as in #2251. Any other result still reaches the original Require. The rest of the file uses AF_INET, and the remaining ::1 use is pure text conversion.

diff --git a/core/libs/tests/GuestSceNet.cpp b/core/libs/tests/GuestSceNet.cpp
index cce92d27..8b70b048 100644
--- a/core/libs/tests/GuestSceNet.cpp
+++ b/core/libs/tests/GuestSceNet.cpp
@@ -239,7 +239,14 @@ static void CheckUnspecifiedIpv6() {
     Require(sceNetInetPton(28, "::1", address.data() + 8) == 1);
 
     const char payload[] = "IPv6 wildcard receive";
-    Require(sceNetSendto(sender, payload, sizeof(payload), 0, address.data(), address.size()) == sizeof(payload));
+    const auto sent = sceNetSendto(sender, payload, sizeof(payload), 0, address.data(), address.size());
+    if (sent < 0 && *sceNetErrnoLoc() == 51) {
+        Require(sceNetSocketClose(sender) == 0);
+        Require(sceNetSocketClose(receiver) == 0);
+        ipv6Unavailable = true;
+        return;
+    }
+    Require(sent == sizeof(payload));
     char received[sizeof(payload)]{};
     std::array<std::uint8_t, 28> peer{};
     size = peer.size();
@@ -430,7 +437,7 @@ int main() {
     Require(sceNetCtlGetState(&state) == 0);
     Require(state == 0 || state == 3);
     if (ipv6Unavailable) {
-        std::puts("skipped the IPv6 socket checks, the host has no IPv6");
+        std::puts("skipped the IPv6 socket checks, the host has no usable IPv6 loopback");
         return 77;
     }
 }

Tested (this host only): guest_sce_net now reports Skipped; the binary exits 77; tools/check_conventions.py --base origin/main passes; full ctest -j12 --timeout 60 gives 698 tests with no failures (skips: this test plus 7 video_out_* tests that need a display). Not tested on a host with working IPv6.

Caveat: a host with IPv6 enabled but no route could also return errno 51 and skip instead of fail, hiding a regression. I judged that unlikely because the address bytes are checked just before the send. A stricter version would also require a plain host-side probe of ::1 to fail.

I can't open a PR (intake pause), so the patch is here for anyone who can. AI-assisted: yes. The patch and this report were written with AI assistance and reviewed by a second model; I take responsibility for the content.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5792986426 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2820). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-10T16:10:19Z. --- `guest_sce_net` aborts on a Linux host where the kernel has IPv6 but `net.ipv6.conf.all.disable_ipv6=1`. #2251 skips the IPv6 checks only when `socket(AF_INET6)` fails with `EAFNOSUPPORT` (guest errno 47). Here the socket opens, so that skip is not taken, and the send to `::1` then fails. **Setup:** `main` 57f96fd2, CachyOS (Arch-based), kernel 7.2.2, GCC, Release, `-DBUILD_TESTING=ON`. `net.ipv6.conf.all.disable_ipv6 = 1`; loopback has no `::1`. **Reproduce:** `ctest --test-dir build -R '^guest_sce_net$'` gives `Subprocess aborted`. The failing assertion is the `Require` on `sceNetSendto` to `::1` in `CheckUnspecifiedIpv6` (`core/libs/tests/GuestSceNet.cpp:242` before the patch). `sceNetSendto` returns guest errno 51 (`NET_ENETUNREACH`). **Patch:** if that send fails with errno 51, close both sockets, set `ipv6Unavailable`, and return. The other checks still run and the test exits 77 as in #2251. Any other result still reaches the original `Require`. The rest of the file uses AF_INET, and the remaining `::1` use is pure text conversion. ```diff diff --git a/core/libs/tests/GuestSceNet.cpp b/core/libs/tests/GuestSceNet.cpp index cce92d27..8b70b048 100644 --- a/core/libs/tests/GuestSceNet.cpp +++ b/core/libs/tests/GuestSceNet.cpp @@ -239,7 +239,14 @@ static void CheckUnspecifiedIpv6() { Require(sceNetInetPton(28, "::1", address.data() + 8) == 1); const char payload[] = "IPv6 wildcard receive"; - Require(sceNetSendto(sender, payload, sizeof(payload), 0, address.data(), address.size()) == sizeof(payload)); + const auto sent = sceNetSendto(sender, payload, sizeof(payload), 0, address.data(), address.size()); + if (sent < 0 && *sceNetErrnoLoc() == 51) { + Require(sceNetSocketClose(sender) == 0); + Require(sceNetSocketClose(receiver) == 0); + ipv6Unavailable = true; + return; + } + Require(sent == sizeof(payload)); char received[sizeof(payload)]{}; std::array<std::uint8_t, 28> peer{}; size = peer.size(); @@ -430,7 +437,7 @@ int main() { Require(sceNetCtlGetState(&state) == 0); Require(state == 0 || state == 3); if (ipv6Unavailable) { - std::puts("skipped the IPv6 socket checks, the host has no IPv6"); + std::puts("skipped the IPv6 socket checks, the host has no usable IPv6 loopback"); return 77; } } ``` **Tested (this host only):** `guest_sce_net` now reports Skipped; the binary exits 77; `tools/check_conventions.py --base origin/main` passes; full `ctest -j12 --timeout 60` gives 698 tests with no failures (skips: this test plus 7 `video_out_*` tests that need a display). Not tested on a host with working IPv6. **Caveat:** a host with IPv6 enabled but no route could also return errno 51 and skip instead of fail, hiding a regression. I judged that unlikely because the address bytes are checked just before the send. A stricter version would also require a plain host-side probe of `::1` to fail. I can't open a PR (intake pause), so the patch is here for anyone who can. AI-assisted: yes. The patch and this report were written with AI assistance and reviewed by a second model; I take responsibility for the content.
Sign in to join this conversation.
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#2820
No description provided.