Uh oh!
There was an error while loading. Please reload this page.
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket - #142993
Conversation
Uh oh!
There was an error while loading. Please reload this page.
725ffa2 to
fde0616Compareglebius
commented
Dec 21, 2025
Tag @vstinner who handled the initial submission of PF_DIVERT. |
vstinner
commented
Dec 22, 2025
The example from the issue still fails after applying this change: vstinner@freebsd$ catraw.pyfromsocketimportsocket, PF_DIVERT, SOCK_RAWwithsocket(PF_DIVERT, SOCK_RAW, 0) asfd:
r=fd.recvfrom(16384)
vstinner@freebsd$ ./pythonraw.pyTraceback (mostrecentcalllast):
File"/usr/home/vstinner/python/main/raw.py", line2, in<module>withsocket(PF_DIVERT, SOCK_RAW, 0) asfd:
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^File"/usr/home/vstinner/python/main/Lib/socket.py", line237, in__init___socket.socket.__init__(self, family, type, proto, fileno)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^OSError: [Errno47] Addressfamilynotsupportedbyprotocolfamily |
glebius
commented
Dec 22, 2025
What FreeBSD version do you test on? The GENERIC kernel doesn't have divert module. Do you have ipdivert.ko loaded? |
vstinner
commented
Jan 6, 2026
I tested on: Ah! The example works if I load the kernel module with |
vstinner
commented
Jan 6, 2026
Without this change, the example fails with: Traceback (mostrecentcalllast):
File"/usr/home/vstinner/python/main/raw.py", line3, in<module>r=fd.recvfrom(16384)
OSError: getsockaddrlen: badfamily |
Uh oh!
There was an error while loading. Please reload this page.
…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>
GH-143481 is a backport of this pull request to the 3.14 branch. |
GH-143482 is a backport of this pull request to the 3.13 branch. |
vstinner
commented
Jan 6, 2026
Merged, thanks. I backported the fix to 3.13 and 3.14 branches. |
glebius
commented
Jan 6, 2026
Thanks, Victor! |
bedevere-bot
commented
Jan 6, 2026
|
vstinner
commented
Jan 7, 2026
Oops, the 3.13 backport broke the build on FreeBSD. I wrote #143514 to fix it. |
This is my miss from #96534