libkernel: getsockname still returns the old local address after a UDP association is dissolved #8681

Closed
opened 2026-10-20 20:53:21 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-20 20:53:21 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T20:53:21Z.


Repro

connect(s, 127.0.0.1:P) on an unbound UDP socket, then connect(s, AF_UNSPEC), then getsockname(s).
Expected (FreeBSD 11.4 udp_disconnect, sys/netinet/udp_usrreq.c): the local address is INADDR_ANY, the port is kept.
Actual: 127.0.0.1 (Windows; Linux keeps it for a socket bound to an explicit port). guest_udp skipped the check on Windows.
Test: core/libs/tests/GuestUdp.cpp (existing check, now run on Windows).
Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/udp-disconnect-clears-local-address
AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5949478489 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8681). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T20:53:21Z. --- ### Repro `connect(s, 127.0.0.1:P)` on an unbound UDP socket, then `connect(s, AF_UNSPEC)`, then `getsockname(s)`. Expected (FreeBSD 11.4 `udp_disconnect`, sys/netinet/udp_usrreq.c): the local address is INADDR_ANY, the port is kept. Actual: 127.0.0.1 (Windows; Linux keeps it for a socket bound to an explicit port). `guest_udp` skipped the check on Windows. Test: `core/libs/tests/GuestUdp.cpp` (existing check, now run on Windows). Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/udp-disconnect-clears-local-address AI-assisted (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#8681
No description provided.