gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (#142993)

This commit is contained in:
Gleb Smirnoff 2026-01-06 08:25:29 -08:00 committed by GitHub
parent 54f1ed0299
commit 05406b221d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -0,0 +1,2 @@
Fixed socket operations such as recvfrom() and sendto() for FreeBSD
divert(4) socket.

View File

@ -2769,6 +2769,12 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
_Py_FALLTHROUGH;
#endif /* AF_RDS */
#ifdef AF_DIVERT
case AF_DIVERT:
/* FreeBSD divert(4) sockets use sockaddr_in: fall-through */
_Py_FALLTHROUGH;
#endif /* AF_DIVERT */
case AF_INET:
{
*len_ret = sizeof (struct sockaddr_in);