]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-14299...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 7 Jan 2026 14:20:07 +0000 (15:20 +0100)
committerGitHub <noreply@github.com>
Wed, 7 Jan 2026 14:20:07 +0000 (14:20 +0000)
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993)
(cherry picked from commit 05406b221dc9d5946c60253392788d60f1f08c8b)

Co-authored-by: Gleb Smirnoff <glebius@FreeBSD.org>
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 1fbd6eb9294cfaf87dd9e4a5402f116991dea877..8c8a5efa8c99b7e4b2593fadeaf06fbfc79358e1 100644 (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);