fix(libkernel): send to INADDR_ANY through 127.0.0.1 on macOS #17878
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17878"
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 Alexius0815 on 2026-11-09T20:08:16Z.
What
On macOS, a datagram sent to
0.0.0.0or::ffff:0.0.0.0fails withEHOSTUNREACH(65). This makesguest_socket_port_zerofail. The change applies AnyPS5's existing loopback mapping to these destinations in the Darwinsendtopath, matching the mapping used on Windows by #15782.FreeBSD 11.4's
in_pcbconnect_setupselects the first local IPv4 address for an unspecified destination. Loopback is AnyPS5's approximation for this case. Theconnectpath already passes the guest test on macOS and is unchanged.Tested
Apple M4 (Mac16,13), macOS 27.2, Release x86-64 under Rosetta 2. CTest ran serially with the final v4 diffs on Mac integration stack
b05b1c4c93a2(main02452319with Mac build fixes). The review commit is based on main7259cce111.guest_socket_port_zerofails with errno 65.guest_socket_port_zeropasses. The separateguest_socket_optionsfailure remains.::ffff:0.0.0.0.guest_net_raw_protocol), andguest_sce_nethits the known epoll closed-stream failure.Checklist
main; no other open PR implements the same changeSummary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-16T12:13:34Z.
Review: COMMENTED
Tested on macOS 27.2, Apple Silicon (M4), full build (x86-64 under Rosetta 2). This PR was merged alone onto
main04f7633c01withgit merge --no-ff. I ran the 56 socket and net tests (guest_socket_*,guest_poll,guest_refused_connect,guest_sce_net,guest_net_*,guest_kernel_socket*) three times onmainand three times with this PR.guest_socket_port_zerofails in all three runs onmain("sendto INADDR_ANY must reach 127.0.0.1 (errno 65)") and passes in all three runs with this PR.guest_socket_read_writefailed withECONNRESET. That test is flaky onmaintoo (1 failure in 10 runs onmain, 0 in 10 with this PR), so this PR is not the cause.core/libs/prx/libkernel/Socket/src/Udp.cpp, so whichever merges second needs a rebase.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T10:02:24Z.
Review: APPROVED
Reviewed — looks good
The change applies the existing unspecified-address loopback mapping to Darwin
sendtoand the inspected implementation covers IPv4 and IPv4-mapped IPv6.What I ran
Reviewed head
0a7cf3a1d353f2c325c9e5d267dae841fde38b6f. No commands or tests were run; the author-reported test results were not independently verified.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The author reports macOS test results in the PR description; they were not independently confirmed.
files.jsonwas unavailable in the provided review bundle, so I could not compare the read files against its reviewed list. No test, build, or platform behavior was run. Read:description.md,commits.md,manifest.json,diff.patch, andcore/libs/prx/libkernel/Socket/src/Udp.cpplines 400–460 and 1990–2029. Excluded: no paths were available fromfiles.json.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by NobleBrains on 2026-12-01T00:21:55Z.
Review: APPROVED
Confirmed on macOS 15.
Setup: Apple M4, macOS 15.7.9, Apple clang 17.0.0 (clang-1700.6.3.2), x86_64 Release under Rosetta,
BUILD_TESTING=ON. These are the OS and compiler generation of themacos-15runner.Tree:
main93d64f2d1e+ the open macOS build fixes #27201, #27739, #27843, #17425, #27827, #27767 (maindoes not build on macOS without them, see #28168), + #22091, #28369, #28075, #28076, #28284, then #17878, #20161, #25134, #26806, #22932, #28373, #27828, #27950, #27582, #24311 merged one after another. All merged cleanly.guest_socket_port_zero0a7cf3a1d3Full
ctest -j 6after all of them: 7047/7066 pass. Compared with the run before the second group of merges, no test fails that passed before.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T16:40:36Z.
Review: COMMENTED
The existing
guest_socket_port_zeroregression passed with this head integrated on Linux. The changed branch reuses the established IPv4 and IPv4-mapped loopback conversion for Darwinsendto. The conversion itself still needs a macOS run.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T09:57:02Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
56d2119552631118a9c0ab2bd15d8a4bad1c54d7. I read the prepared description, commits, manifest, diff, and the changed file’s relevant helper, address conversion, sendto, and connect sections withrepo_read.py. No tests or builds were run.Results
Negative control
Not run; no test was run.
Findings
Blocking
None.
Non-blocking
None.
Sources
Udp.cppat the reviewed commit defines the IPv4 and IPv4-mapped IPv6 loopback conversion.Udp.cppat the reviewed commit applies it in the Darwinsendtopath.Not verified
The reported macOS test results and behavior on physical consoles were not independently verified. The reviewed file was
core/libs/prx/libkernel/Socket/src/Udp.cpp;files.jsonlists no excluded files.To get this to a good state
Nothing is required.