fix(libkernel): join and leave multicast groups as measured on a PS5 #10331
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10331"
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-23T18:10:28Z.
What
Multicast group membership and
IP_MULTICAST_IFmeasured on a retail PS5 (firmware 13.60) throughlibkernel_sys.sprxfrom a payload process. The source and console log are in this gist (pmcast). This branch is on top of #10330 (and so #10327, #10320 and #10302), which edit the same option code and debt entries.On a datagram socket the console:
INADDR_ANYand 224.0.0.252 through 127.0.0.1, fails a second join of the same group withEADDRINUSE(48), and takes a 12-byte value as an 8-byteip_mreq;EINVAL, and an interface address it does not have withEADDRNOTAVAIL;EADDRNOTAVAIL(49);IP_MULTICAST_IFasINADDR_ANY, then as the address set, accepts a zeroed 12-byteip_mreqn, and fails a value shorter than 4 bytes withEINVAL.A stream socket fails
IP_ADD_MEMBERSHIPwithEOPNOTSUPP(45).AnyPS5 failed all three options with
ENOPROTOOPT, so a title could not join a group for LAN discovery. They now check what the console checked, track the joined groups per socket (Winsock answers a second join withEINVAL, notEADDRINUSE), and are set on the host socket. The other multicast options also fail withEOPNOTSUPPon a stream socket now, as FreeBSD 11.4'sinp_setmoptionsandinp_getmoptionsdo, and a drop throughINADDR_ANYleaves the first joined group of that address on any interface, as itsinp_leave_groupdoes; neither was measured. Anip_mreqnwith an interface index or with any non-zero byte in its address fields throws, since only the all-zero form was measured, and so does readingIP_MULTICAST_IFinto 12 bytes, and the debt entry lists that and the interface error that comes from the host.Tested
Windows 11, MinGW (winlibs).
guest_socket_optionschecks the short and unicast values, the stream socket, a drop of a group never joined and the all-zero 12-byteIP_MULTICAST_IF; the forms with a non-zero address are not pinned by a test.guest_socket_options_multicast(the same executable in itsmulticastmode) requires the join, the double join, both drops, a join through 127.0.0.1 dropped throughINADDR_ANYand the loopbackIP_MULTICAST_IFreadback to succeed, so it fails on a host that cannot join a group. The socket and net tests pass three runs in a row.-E "^agc_|^select_tests$") passes apart fromguest_kqueue, which fails only under-j 14, as onmain.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:13Z.
Review: COMMENTED
Checked against main
39a36bbec8and gist d9efe0da (pmcast.c/pmcast.log), FreeBSD release/11.4.0 sys/netinet/in_mcast.c:IP_MULTICAST_IFerrors match pmcast.log case by case (48/22/22/49 for joins, 49 for both failed drops, 42 for a membership get, 45 on the stream socket). The stack merges cleanly into current main; it carries #10320 and needs to land after it.inp_leave_groupleavesifpNULL for INADDR_ANY (in_mcast.c:2286-2296), andimo_match_groupthen matches the group on any interface. So join {224.0.0.252, 127.0.0.1} followed by drop {224.0.0.252, 0.0.0.0} succeeds in that code, but returns EADDRNOTAVAIL here. pmcast doesn't measure this. Could it either match by group when the interface is INADDR_ANY, or be listed in the debt entry next to the join-side note?IP_MULTICAST_IFget with a 12-byte buffer (SocketOptions.cpp:430) returns 4 bytes, whereas FreeBSD 11.4inp_getmoptions(in_mcast.c:1803-1810) returns the wholeip_mreqn. Since the unmeasured 12-byte set forms now throw, should the 12-byte get also throw, or go in the debt entry?Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.