gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket#142993
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket#142993vstinner merged 1 commit into
Conversation
725ffa2 to
fde0616
Compare
December 20, 2025 18:22
|
Tag @vstinner who handled the initial submission of PF_DIVERT. |
Sorry, something went wrong.
|
The example from the issue still fails after applying this change: vstinner@freebsd$ cat raw.py
from socket import socket, PF_DIVERT, SOCK_RAW
with socket(PF_DIVERT, SOCK_RAW, 0) as fd:
r = fd.recvfrom(16384)
vstinner@freebsd$ ./python raw.py
Traceback (most recent call last):
File "/usr/home/vstinner/python/main/raw.py", line 2, in <module>
with socket(PF_DIVERT, SOCK_RAW, 0) as fd:
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/home/vstinner/python/main/Lib/socket.py", line 237, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 47] Address family not supported by protocol family |
Sorry, something went wrong.
What FreeBSD version do you test on? The GENERIC kernel doesn't have divert module. Do you have ipdivert.ko loaded? |
Sorry, something went wrong.
I tested on: Ah! The example works if I load the kernel module with |
Sorry, something went wrong.
|
Without this change, the example fails with: Traceback (most recent call last):
File "/usr/home/vstinner/python/main/raw.py", line 3, in <module>
r = fd.recvfrom(16384)
OSError: getsockaddrlen: bad family |
Sorry, something went wrong.
05406b2
into
python:main
Jan 6, 2026
…ocket (pythonGH-142993) (cherry picked from commit 05406b2) Co-authored-by: Gleb Smirnoff <glebius@FreeBSD.org>
…ocket (pythonGH-142993) (cherry picked from commit 05406b2) Co-authored-by: Gleb Smirnoff <glebius@FreeBSD.org>
|
Merged, thanks. I backported the fix to 3.13 and 3.14 branches. |
Sorry, something went wrong.
|
Thanks, Victor! |
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 FreeBSD14 3.13 (tier-3) has failed when building commit 7f93669. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#/builders/1481/builds/1800 Summary of the results of the build (if available): Click to see traceback logsremote: Enumerating objects: 14, done.
remote: Counting objects: 12% (1/8)
remote: Counting objects: 25% (2/8)
remote: Counting objects: 37% (3/8)
remote: Counting objects: 50% (4/8)
remote: Counting objects: 62% (5/8)
remote: Counting objects: 75% (6/8)
remote: Counting objects: 87% (7/8)
remote: Counting objects: 100% (8/8)
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 12% (1/8)
remote: Compressing objects: 25% (2/8)
remote: Compressing objects: 37% (3/8)
remote: Compressing objects: 50% (4/8)
remote: Compressing objects: 62% (5/8)
remote: Compressing objects: 75% (6/8)
remote: Compressing objects: 87% (7/8)
remote: Compressing objects: 100% (8/8)
remote: Compressing objects: 100% (8/8), done.
remote: Total 14 (delta 1), reused 2 (delta 0), pack-reused 6 (from 2)
From https://github.com/python/cpython
* branch 3.13 -> FETCH_HEAD
Note: switching to '7f936694dbc0dc0dbb07d98fa668776c4e4ca595'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 7f936694dbc [3.13] gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993) (#143482)
Switched to and reset branch '3.13'
1 error |
Sorry, something went wrong.
|
Oops, the 3.13 backport broke the build on FreeBSD. I wrote #143514 to fix it. |
Sorry, something went wrong.
This is my miss from #96534