File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -959,6 +959,37 @@ def testWindowsSpecificConstants(self):
959
959
socket .IPPROTO_L2TP
960
960
socket .IPPROTO_SCTP
961
961
962
+ @unittest .skipUnless (sys .platform == 'darwin' , 'macOS specific test' )
963
+ @unittest .skipUnless (socket_helper .IPV6_ENABLED , 'IPv6 required for this test' )
964
+ def test3542SocketOptions (self ):
965
+ # Ref. issue #35569 and https://tools.ietf.org/html/rfc3542
966
+ opts = {
967
+ 'IPV6_CHECKSUM' ,
968
+ 'IPV6_DONTFRAG' ,
969
+ 'IPV6_DSTOPTS' ,
970
+ 'IPV6_HOPLIMIT' ,
971
+ 'IPV6_HOPOPTS' ,
972
+ 'IPV6_NEXTHOP' ,
973
+ 'IPV6_PATHMTU' ,
974
+ 'IPV6_PKTINFO' ,
975
+ 'IPV6_RECVDSTOPTS' ,
976
+ 'IPV6_RECVHOPLIMIT' ,
977
+ 'IPV6_RECVHOPOPTS' ,
978
+ 'IPV6_RECVPATHMTU' ,
979
+ 'IPV6_RECVPKTINFO' ,
980
+ 'IPV6_RECVRTHDR' ,
981
+ 'IPV6_RECVTCLASS' ,
982
+ 'IPV6_RTHDR' ,
983
+ 'IPV6_RTHDRDSTOPTS' ,
984
+ 'IPV6_RTHDR_TYPE_0' ,
985
+ 'IPV6_TCLASS' ,
986
+ 'IPV6_USE_MIN_MTU' ,
987
+ }
988
+ for opt in opts :
989
+ self .assertTrue (
990
+ hasattr (socket , opt ), f"Missing RFC3542 socket option '{ opt } '"
991
+ )
992
+
962
993
def testHostnameRes (self ):
963
994
# Testing hostname resolution mechanisms
964
995
hostname = socket .gethostname ()
Original file line number Diff line number Diff line change
1
+ Expose RFC 3542 IPv6 socket options.
Original file line number Diff line number Diff line change @@ -1116,8 +1116,12 @@ def detect_crypt(self):
1116
1116
def detect_socket (self ):
1117
1117
# socket(2)
1118
1118
if not VXWORKS :
1119
- self .add (Extension ('_socket' , ['socketmodule.c' ],
1120
- depends = ['socketmodule.h' ]))
1119
+ kwargs = {'depends' : ['socketmodule.h' ]}
1120
+ if MACOS :
1121
+ # Issue #35569: Expose RFC 3542 socket options.
1122
+ kwargs ['extra_compile_args' ] = ['-D__APPLE_USE_RFC_3542' ]
1123
+
1124
+ self .add (Extension ('_socket' , ['socketmodule.c' ], ** kwargs ))
1121
1125
elif self .compiler .find_library_file (self .lib_dirs , 'net' ):
1122
1126
libs = ['net' ]
1123
1127
self .add (Extension ('_socket' , ['socketmodule.c' ],
You can’t perform that action at this time.
0 commit comments