Repository navigation
fix(libkernel): return EISCONN from sendto with an address on a connected datagram socket - #7475
Bonjourcestmatt wants to merge 2 commits into
Conversation
…cted datagram socket FreeBSD 11.4 udp_output fails with EISCONN when a destination is supplied and inp_faddr is already set. The host accepts the send, so the guest socket now checks getpeername first. The test pinned the old behaviour and now sends without an address on the connected socket. Written with AI assistance (Claude). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Some 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.
|
jotitadev
left a comment
There was a problem hiding this comment.
Linux run, and the check against main that the description leaves open.
Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON, full build.
Head 90c26b2e3 merged onto main 9caecfd2d (clean merge).
guest_udppasses, as do the other socket/network tests (ctest -R "udp|socket|^guest_sce_net$", 16 tests). On Linuxgetpeername()succeeds on the connected datagram socket, sosendtowith an address returns -1 with errno 56, andsend/sendmsgwithout one still deliver.GuestUdp.cpponly, onmain:guest_udpaborts at the newsendto(...) == -1 && errno == 56line (I numbered theRequirecalls to find it), since the host accepts the send. So the new check fails without the fix.- Non-GPU suite (
ctest -E "^agc|gpu|vulkan|video_out"): 712/712, same asmain.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
Ran this on macOS, since it was not run there: Apple M1, macOS 26.6.2 (25G83), x86-64 build under Rosetta 2, AppleClang 21. Merged into the macOS host branch of #7332 (
AI-assisted: yes (Claude Code). I ran the build and tests on my machine. |
|
Independent Windows run of this PR (data only). Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against Results (3 runs each):
Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run. AI-assisted (Claude Code). |
The guest socket layer relies on a few Linux calls: - The equeue wait uses poll with the timeout rounded up to a millisecond; macOS has no ppoll. - A readable stream socket whose peer closed is reported with POLLHUP by peeking one byte; macOS has no POLLRDHUP. - FIONREAD on a datagram socket, and the byte count that fstat and kevent report for it, is SO_NREAD, the size of the next datagram; macOS adds the source address to FIONREAD. - socketpair throws for SOCK_SEQPACKET, which has no AF_UNIX pair on macOS. - gethostbyname replaces gethostbyname_r, which macOS lacks. The UDP test sends on its connected socket without an address, as #7475 does, because macOS, like FreeBSD, fails sendto with an address on a connected socket with EISCONN. The log test uses a datagram pair with enlarged buffers instead of SOCK_SEQPACKET.
|
Merged 🤖 Addressed by Claude Code |
|
Closing: this branch conflicts with the current 🤖 Closed by Claude Code |
What
sendto(andsendmsgwith a name) with a destination address on an already connected datagram socket now fails withEISCONN(56). FreeBSD 11.4udp_output()doesif (inp->inp_faddr.s_addr != INADDR_ANY) { error = EISCONN; goto release; }when a destination is supplied (read insys/netinet/udp_usrreq.c, release/11.4.0). Linux and Winsock accept such a send, so the guest socket now checksgetpeernamefirst.GuestUdp.cpppinned the old behaviour in two places (sendtoandsendmsgwith an address on the connected sender); they now send without an address, and a new check pins theEISCONNresult.Overlap: open PRs #7201 and #7332 (macOS port) touch the same file and #7332 adds a similar
EISCONNtest expectation, because macOS already returnsEISCONNnatively; this change is the Linux/Windows side and does not conflict with the macOS host path, though the test lines may need a trivial merge.Tested
guest_udp_testsand all 27 udp/socket ctest tests pass; the full non-GPU suite passes (755 of 755, skipped ones included);python tools/check_conventions.py --base origin/mainpasses.mainwithout the fix; it follows from the host accepting the send. The two oldsendto/sendmsglines in the test did fail with the fix, which shows the new check is active.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryAI-assisted: yes
🤖 Generated with Claude Code