From 7f936694dbc0dc0dbb07d98fa668776c4e4ca595 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 6 Jan 2026 17:48:03 +0100 Subject: [PATCH] [3.13] gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993) (#143482) gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993) (cherry picked from commit 05406b221dc9d5946c60253392788d60f1f08c8b) Co-authored-by: Gleb Smirnoff --- .../Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst | 2 ++ Modules/socketmodule.c | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst 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 index 000000000000..2c76bb4f2bcf --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst @@ -0,0 +1,2 @@ +Fixed socket operations such as recvfrom() and sendto() for FreeBSD +divert(4) socket. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index edc79c9d3b87..4362d95ae1ff 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2649,6 +2649,12 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret) /* RDS sockets use sockaddr_in: fall-through */ #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); -- 2.47.3