]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (#142993)
authorGleb Smirnoff <glebius@FreeBSD.org>
Tue, 6 Jan 2026 16:25:29 +0000 (08:25 -0800)
committerGitHub <noreply@github.com>
Tue, 6 Jan 2026 16:25:29 +0000 (17:25 +0100)
Misc/NEWS.d/next/Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst [new file with mode: 0644]
Modules/socketmodule.c

diff --git a/Misc/NEWS.d/next/Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst b/Misc/NEWS.d/next/Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst
new file mode 100644 (file)
index 0000000..2c76bb4
--- /dev/null
@@ -0,0 +1,2 @@
+Fixed socket operations such as recvfrom() and sendto() for FreeBSD
+divert(4) socket.
index 1ef359cb265ed46194cf9369123bb98c930417ff..ee78ad01598262b9d12b133af061d7c5f29b27a4 100644 (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);