feat(libkernel): set and read IPV6_V6ONLY on a guest socket #6663
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6663"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-16T02:58:38Z.
What
setsockoptandgetsockoptrefused everyIPPROTO_IPV6option withENOPROTOOPT. Java creates its TCP and UDP sockets asAF_INET6and turnsIPV6_V6ONLYoff on each one, so it can reach IPv4 addresses through the mapped form. Java 25 Advanced Network (PPSA99871) stops there onmain. Its HTTPS row fails withjava.net.SocketException: Protocol not available, aftersetsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, 0)on a freshAF_INET6stream socket.IPV6_V6ONLY(27) now works on anAF_INET6socket, following FreeBSD 11.4'sip6_ctloutput:intfails withEINVAL(L1572), and so does setting it on a bound socket (L1722), which both hosts refuse too.IPPROTO_IPV6level on anAF_INETorAF_UNIXsocket fails withEINVAL, as forIPPROTO_TCPthere. OtherIPPROTO_IPV6options still fail withENOPROTOOPT, as in FreeBSD's default cases (L1928-L1929, L2158-L2159).socketalready turns the option on for everyAF_INET6socket, as FreeBSD's defaultnet.inet6.ip6.v6onlydoes. The debt entry forgetsockopt, setsockoptnow lists the option. It also notes that PPSA99871 setsSO_REUSEPORTand carries on when that fails.Tested
Windows 11 Pro (26300), WinLibs GCC 15.2.0 r7, Ninja Release, on
main31cbb55d7:guest_socket_stream_optionspasses. The new part checks:AF_INET6stream socket reads 1, is set to 0, reads 0 and then connects to an IPv4 listener through::ffff:127.0.0.1EINVAL, and so does setting the option after a bind to::IPV6_UNICAST_HOPSgivesENOPROTOOPTAF_INETdatagram socket and on asocketpairend givesEINVALconventions_function_bodiesshards timed out while the machine was busy and passed when rerun alone.python tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.py --branchfinds no conflicting lines. The PRs it could not compare already conflict withmain. A trial merge with each of the recent ones (#5973, #6228, #6343, #6510, #6542, #5835) gives only the conflicts it has withmain, and #6142 and #5967 merge cleanly.Java 25 Advanced Network (PPSA99871, 01.000.002, SHA-256
8c95655c87b1433c291170d606c22e740b2099b4e8a28ed2906905ba534c32cc, matching the release'sSHA256SUMS), relinked with--windows --to-intel --trap-sdk-syscall-stubs --registry:main44df21632with #5918, which only touches thread stacks), the HTTPS row stops atHTTPS stage connect HTTPS with certificate and hostname verification: java.net.SocketException: Protocol not available.DestroyJavaVMpass, each ending withfixture returned normallyorDestroyJavaVM complete.::ffff:and the IPv4 address ofexample.com, and then fails withSoftware caused connection aborton the firstread. That isn't this change. Here the interpreter-only VM, which also traces every memory call, takes longer betweenconnectand the TLS ClientHello than the server keeps an idle connection open. A plain connection to the same address answersHTTP/1.1 200when the request goes out at once, a reset after 15 s and an end of stream after 40 s. This PC has no IPv6 route to the internet, so only the IPv4 address was tried.Linux not tested. The change goes through the same
setsockoptandgetsockoptcalls there.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T03:22:21Z.
Review: APPROVED
Reviewed the IPv6 option dispatch, AF_INET6 default setup, canonical boolean readback, invalid-domain/error handling, and focused socket tests. The Windows loopback and Java title evidence is clearly scoped, and conventions/intake/eligibility/report checks pass. Linux runtime coverage is still unreported, but I found no code issue in the change.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T03:31:01Z.
Review: COMMENTED
Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, Ninja Release, full build), head
411dc0748merged ontomain5d9dcc42d. Host hasnet.ipv6.bindv6only = 0.guest_socket_stream_optionspasses, including theIPV6_V6ONLYpart: a freshAF_INET6socket reads 1 (sosocketsets it, not the host default), clears to 0 and connects to the IPv4 listener through::ffff:127.0.0.1;EINVALafter the bind to::is the Linux kernel's answer.core/libs/prx/libkernel/Socketfiles frommainand the new test kept: it aborts withsocket stream option check failed at line 78, errno 42(ENOPROTOOPT, in theGethelper) on the firstIPV6_V6ONLYread, as on Windows.guest_socket*tests pass.Non-GPU suite (
ctest -E "^agc|gpu|vulkan|video_out", 650 tests): same result asmain; onlyfile_writer_binaryandfile_writer_textfail, and they fail onmaintoo on this machine (Ubuntu 26.04 coreutils).Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T03:37:57Z.
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.
main)core/libs/prx/libkernel/Socket/src/Udp.cppL989-990, L993-995docs/dev/debt/libkernel.mdL181Some 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.
core/libs/prx/libkernel/Socket/src/Udp.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Socket/src/Udp.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Socket/src/Udp.cppdocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Socket/src/Udp.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Socket/src/Udp.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Socket/src/SocketOptions.cppcore/libs/prx/libkernel/Socket/src/Udp.cppdocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Socket/include/SocketOptions.hppcore/libs/prx/libkernel/Socket/src/SocketOptions.cppcore/libs/prx/libkernel/Socket/src/Udp.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdImported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-16T06:52:09Z.
Thanks @MarcZX100 for the review and @jotitadev for the Linux run, which covers what I couldn't test here.
Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-17T22:36:30Z.
Windows run of head
411dc0748merged ontomain11acfdd84(Windows 11, Ryzen 5 9600X, RTX 5070 Ti, WinLibs GCC 15.2.0, Release). Title: Java 25 Advanced Network (PPSA99871, 01.000.002, the author's release, SHA-256 matching itsSHA256SUMS), converted with--windows --to-intel --trap-sdk-syscall-stubs --registry, rows driven withAPS5_PAD_INPUT_FILE.main: the HTTPS row stops atjava.net.SocketException: Protocol not available(theIPV6_V6ONLYsetsockopt) in 3 of 3 runs, 2 on11acfdd84and 1 on922dc8999.STAGE: HTTPS: read bounded HTTPS responsethenSTAGE: Advanced Network fixture returned normally. On this machine the idle-timeout failure mentioned earlier in this thread didn't occur.The IPv6 loopback and load rows weren't run.
AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T08:46:15Z.
Checked the
IPV6_V6ONLYget/set against FreeBSD'sip6_ctloutput(length check, 0/1 readback, EINVAL on bound socket and on non-AF_INET6sockets, other optionsENOPROTOOPT), the test (pins values and the::ffff:connect, fails without the change) and the debt entry. The Linux and Windows runs from @jotitadev and @wachi35676 cover the hosts. Merged.