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

This commit is contained in:
Gleb Smirnoff 2025-12-19 13:56:34 -08:00
parent 08bc03ff2a
commit fde061609b
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);