You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose RFC 3542 IPv6 socket options on macOS #79750
Python builds on MacOS do not expose the IPV6_RECVPKTINFO flag specified in [RFC3842], which is required for UDP protocols that need control over their servers' sending ports like CoAP.
While I don't own Apple hardware and thus can't test it, the nginx code indicates that this API is available on OSX and is just gated behind -D__APPLE_USE_RFC_3542. Searching the web for that define indicates that other interpreted langues and applications use the flag as well (PHP, Ruby; PowerDNS, nmap, libcoap).
Please consider enabling this on future releases of Python on OSX.
#include<netinet6/in6.h>inthemacOS10.14SDKsays:
/* * RFC 3542 define the following socket options in a manner incompatible * with RFC 2292: * IPV6_PKTINFO * IPV6_HOPLIMIT * IPV6_NEXTHOP * IPV6_HOPOPTS * IPV6_DSTOPTS * IPV6_RTHDR * * To use the new IPv6 Sockets options introduced by RFC 3542 * the constant __APPLE_USE_RFC_3542 must be defined before * including <netinet/in.h> * * To use the old IPv6 Sockets options from RFC 2292 * the constant __APPLE_USE_RFC_2292 must be defined before * including <netinet/in.h> * * Note that eventually RFC 3542 is going to be the * default and RFC 2292 will be obsolete. */
My conclusion from reading this: the name might suggest that this is an internal macro, but should be safe to use.
Testing the application to current git master (on a borrowed machine with Darwin Kernel Version 18.5.0), the provided patch does enable the desired IPV6_RECVPKTINFO flag, and the received pktinfo struct complies to the spec.
Activity
chrysn commentedon Dec 23, 2018
Python builds on MacOS do not expose the IPV6_RECVPKTINFO flag specified in [RFC3842], which is required for UDP protocols that need control over their servers' sending ports like CoAP.
While I don't own Apple hardware and thus can't test it, the nginx code indicates that this API is available on OSX and is just gated behind
-D__APPLE_USE_RFC_3542. Searching the web for that define indicates that other interpreted langues and applications use the flag as well (PHP, Ruby; PowerDNS, nmap, libcoap).Please consider enabling this on future releases of Python on OSX.
ronaldoussoren commentedon Dec 23, 2018
My conclusion from reading this: the name might suggest that this is an internal macro, but should be safe to use.
erlend-aasland commentedon Feb 29, 2020
Proposed patch attached.
chrysn commentedon Mar 10, 2020
Testing the application to current git master (on a borrowed machine with Darwin Kernel Version 18.5.0), the provided patch does enable the desired IPV6_RECVPKTINFO flag, and the received pktinfo struct complies to the spec.
erlend-aasland commentedon Mar 10, 2020
Thanks for testing @chrysn. I guess I should add unit tests if this is to be applied to master.
erlend-aasland commentedon Apr 13, 2020
Added (Mac OS specific) unit tests.
ned-deily commentedon May 17, 2020
New changeset 9a45bfe by Erlend Egeberg Aasland in branch 'master':
bpo-35569: Expose RFC 3542 IPv6 socket options on macOS (GH-19526)
9a45bfe
ned-deily commentedon May 17, 2020
Thanks for the PR! Merged for 3.9.0b1
[-]OSX: Enable IPV6_RECVPKTINFO[/-][+]Expose RFC 3542 IPv6 socket options on macOS[/+]ned-deily commentedon May 17, 2020
New changeset fa098b6 by Ned Deily in branch 'master':
bpo-35569: add Erlend to Misc/ACKS (GH-20146)
fa098b6