[3.14] gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993) (#143481)

gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993)
(cherry picked from commit 05406b221dc9d5946c60253392788d60f1f08c8b)

Co-authored-by: Gleb Smirnoff <glebius@FreeBSD.org>
This commit is contained in:
Miss Islington (bot) 2026-01-07 15:20:07 +01:00 committed by GitHub
parent ad53bf5fd7
commit fcd9500c53
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

@ -2774,6 +2774,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);