Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Description
FreeBSD has divert(4) socket since previous century. Until recently it was in the namespace of PF_INET:
s = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT)
This had no problems with Python's socketmodule, we just put a numeric constant in place of IPPROTO_DIVERT. And since bind(2) argument for divert(4) socket is struct sockaddr_in, luckily everything just worked.
Recently Imoved the divert(4) out of PF_INET namespace, and now it should be created as:
s = socket(PF_DIVERT, SOCK_RAW, 0)
Unfortunately Python's socketmodule can't support this, cause to perform socket.bind() it doesn't know how to construct sockaddr. Attempt to socket.bind() just bails out due to internal socket module error, not even coming to syscall:
s.bind(('0.0.0.0', port))OSError: bind(): bad family
This functionality is important for FreeBSD, causewe use python in our internal regression testing suite.
So, better late than never, let socketmodule recognize and support FreeBSD divert(4) socket. Making pull request in a few minutes.