fix(libkernel): refuse a reconnect after a dropped connection on macOS #17879
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17879"
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:55Z.
What
On macOS, retrying
connectafter a refused nonblocking TCP connection returnsEISCONN(56).guest_socket_optionsexpectsECONNREFUSED(61). #14183 addressed the Windows behavior for this test.For Darwin IPv4 and IPv6 stream sockets, the change queries
TCP_CONNECTION_INFOafter anEISCONNresult. It returnsECONNREFUSEDwhen the query succeeds, the response covers the state field, and that field isTCPS_CLOSED. Every other result preserves the originalconnecterror. Unix-domain sockets bypass the query.In FreeBSD 11.4, the IPv4
tcp_usr_connectpath returnsECONNREFUSEDfor anINP_DROPPEDPCB.INP_TIMEWAITtakes a separateEADDRINUSEbranch. The Darwin patch leaves the nativeEISCONNresult unchanged in the tested TIME_WAIT case.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_optionsaborts with errno 56 at the refused-connect retry check.guest_socket_optionspasses. The separateguest_socket_port_zerofailure remains.guest_net_raw_protocol), andguest_sce_nethits the known epoll closed-stream failure.A separate native Darwin probe checked the state query and its returned length. Refusal and peer reset produced
CLOSED. The live, peer FIN, and local-close-first controls producedESTABLISHED,CLOSE_WAIT, andTIME_WAITrespectively. The TCP option query returnedEOPNOTSUPPfor Unix-domain sockets. These controls are native probe results. Guest coverage is the refused-connect case inguest_socket_options.Checklist
main; no other open PR implements the same changeImported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-16T12:13:43Z.
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_optionsfails in all three runs onmain("a connect after a refused nonblocking one must fail with ECONNREFUSED (61), not start another attempt (errno 56)") and passes in all three runs with this PR.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-22T08:45:51Z.
Review: APPROVED
Reviewed — looks good
The reviewed change at
a9af1f20373d9b8606bd42805d4dff0a50bfafeehas no verified blocking defects; the description reports targeted native Darwin controls and guest coverage, which I did not run.What I ran
No commands or tests were run. I inspected the prepared diff and the changed source at the pinned head.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run tests or independently verify the reported macOS probes and integration results.
files.jsonwas not available in the review bundle, but the manifest lists one reviewed file, and its full source was read. No files were excluded according to the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T16:40:38Z.
Review: COMMENTED
With this revision integrated on Linux,
guest_socket_optionspassed and the multicast variant was skipped. The Darwin code checks theTCP_CONNECTION_INFOresult and returned length before readingtcpi_state, and preserves errno across the probe. The Darwin reconnect path still needs verification on macOS.AI-assisted: yes.