-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket #142993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
725ffa2 to
fde0616
Compare
|
Tag @vstinner who handled the initial submission of PF_DIVERT. |
|
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 |
What FreeBSD version do you test on? The GENERIC kernel doesn't have divert module. Do you have ipdivert.ko loaded? |
I tested on: Ah! The example works if I load the kernel module with |
|
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 |
…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. |
|
Merged, thanks. I backported the fix to 3.13 and 3.14 branches. |
|
Thanks, Victor! |
|
|
Oops, the 3.13 backport broke the build on FreeBSD. I wrote #143514 to fix it. |
This is my miss from #96534