fix(libkernel): keep IP_TTL, IP_TOS and the multicast options as measured on a PS5 #10320
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10320"
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 orezraey on 2026-10-23T17:37:36Z.
What
The
IPPROTO_IPsocket options measured on a retail PS5 (firmware 13.60) throughlibkernel_sys.sprxfrom a payload process. The source and console log are in this gist (pinet4;pinetshowed the defaults first). This branch is on top of #10302, which split the socket options debt entry this one edits.On an
AF_INETsocket the console:IP_TTLat 64,IP_TOSat 0,IP_MULTICAST_TTLat 1 andIP_MULTICAST_LOOPat 1;IP_TTLandIP_TOS(300 reads back as 44, -1 as 255, 0x1ff as 0xff, 0 is kept) and fails a value shorter than anintwithEINVAL;intIP_MULTICAST_TTL, failing anintabove 255 withEINVAL, and readsIP_MULTICAST_LOOPback as 0 or 1;IPPROTO_IPlevel on anAF_INET6socket and an unknown level (99) withEINVAL, and an unknownIPPROTO_IPoption withENOPROTOOPT.AnyPS5 failed the whole
IPPROTO_IPlevel and every unknown level withENOPROTOOPT. The four options are now kept per socket;IP_TTL(when not 0) and the multicast options are also set on the host socket, so packets leave with them, and an accepted socket takesIP_TTLandIP_TOSfrom its listener as FreeBSD'ssyncache_socketdoes. AnintIP_MULTICAST_LOOPkeeps only its low byte, as FreeBSD 11.4'sinp_setmoptionsdoes (the console was only given 0 and 5). What still differs is in a new debt entry:IP_TOSis not applied to the host's packets, the host's default time to live is not changed to 64, and Winsock appliesIP_MULTICAST_LOOPon the receiving socket rather than the sender.IP_MULTICAST_IF, the membership options,SO_REUSEPORT,SO_DEBUG,SO_TIMESTAMPand the TCP keepalive options, which the same log shows the console accepting, are left for separate changes.Tested
Windows 11, MinGW (winlibs).
guest_socket_optionschecks the defaults, the byte truncation, the one-byte and oversized multicast values, the low byte of anintIP_MULTICAST_LOOP, theAF_INET6and unknown level answers. The socket and net tests pass three runs in a row.-E "^agc_|^select_tests$") passes.tools/check_conventions.pypasses.tools/pr_overlap.py: #7511, #8448, #8921 touch nearby lines; whichever lands second keeps both.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 harisibrar1 on 2026-10-24T12:48:12Z.
Review: COMMENTED
Checked against main
39a36bbec8and gist d9efe0da (pinet4.c/pinet4.log), FreeBSD release/11.4.0 sys/netinet/in_mcast.c and Microsoft's IPPROTO_IP socket options page:IP_MULTICAST_LOOPwith an int above 255 (SocketOptions.cpp:309): FreeBSD 11.4inp_setmoptions(in_mcast.c:2799-2802) truncates tou_charbefore!!, so an int 256 turns loopback off, butnumber != 0here turns it on. The probe only tried 0 and 5, so this isn't measured. Would(number & 0xff) != 0be the safer reading?IP_MULTICAST_LOOPtakes effect on the receiving socket, while the BSD option acts on the sender. Passing the guest value to the host therefore may not give the console's meaning on Windows. I couldn't run this; could the new debt entry mention it?Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.