5757# SCM_RIGHTS control message when several are sent in a single sendmsg().
5858BSD_COMBINES_SCM_RIGHTS = sys .platform .startswith (
5959 ("netbsd" , "openbsd" , "dragonfly" ))
60+ # OpenBSD and DragonFly fail recvmsg() with EMSGSIZE, instead of setting
61+ # MSG_CTRUNC, when the ancillary data buffer is too small for a cmsghdr.
62+ CMSG_TRUNC_RAISES_EMSGSIZE = sys .platform .startswith (("openbsd" , "dragonfly" ))
6063WSL = "microsoft-standard-WSL" in platform .release ()
6164
6265try :
@@ -4145,6 +4148,7 @@ def _testCmsgTrunc0(self):
41454148 # (but still too small) buffer sizes.
41464149
41474150 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4151+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
41484152 def testCmsgTrunc1 (self ):
41494153 self .checkTruncatedHeader (self .doRecvmsg (self .serv_sock , len (MSG ), 1 ))
41504154
@@ -4153,6 +4157,7 @@ def _testCmsgTrunc1(self):
41534157 self .createAndSendFDs (1 )
41544158
41554159 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4160+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
41564161 def testCmsgTrunc2Int (self ):
41574162 # The cmsghdr structure has at least three members, two of
41584163 # which are ints, so we still shouldn't see any ancillary
@@ -4165,6 +4170,7 @@ def _testCmsgTrunc2Int(self):
41654170 self .createAndSendFDs (1 )
41664171
41674172 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4173+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
41684174 def testCmsgTruncLen0Minus1 (self ):
41694175 self .checkTruncatedHeader (self .doRecvmsg (self .serv_sock , len (MSG ),
41704176 socket .CMSG_LEN (0 ) - 1 ))
@@ -4202,6 +4208,7 @@ def checkTruncatedArray(self, ancbuf, maxdata, mindata=0):
42024208 self .checkFDs (fds )
42034209
42044210 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4211+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
42054212 def testCmsgTruncLen0 (self ):
42064213 self .checkTruncatedArray (ancbuf = socket .CMSG_LEN (0 ), maxdata = 0 )
42074214
@@ -4210,6 +4217,7 @@ def _testCmsgTruncLen0(self):
42104217 self .createAndSendFDs (1 )
42114218
42124219 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4220+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
42134221 def testCmsgTruncLen0Plus1 (self ):
42144222 self .checkTruncatedArray (ancbuf = socket .CMSG_LEN (0 ) + 1 , maxdata = 1 )
42154223
@@ -4218,6 +4226,7 @@ def _testCmsgTruncLen0Plus1(self):
42184226 self .createAndSendFDs (2 )
42194227
42204228 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4229+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
42214230 def testCmsgTruncLen1 (self ):
42224231 self .checkTruncatedArray (ancbuf = socket .CMSG_LEN (SIZEOF_INT ),
42234232 maxdata = SIZEOF_INT )
@@ -4228,6 +4237,7 @@ def _testCmsgTruncLen1(self):
42284237
42294238
42304239 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4240+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
42314241 def testCmsgTruncLen2Minus1 (self ):
42324242 self .checkTruncatedArray (ancbuf = socket .CMSG_LEN (2 * SIZEOF_INT ) - 1 ,
42334243 maxdata = (2 * SIZEOF_INT ) - 1 )
@@ -4500,6 +4510,7 @@ def _testSingleCmsgTrunc0(self):
45004510 # (but still too small) buffer sizes.
45014511
45024512 @requireAttrs (socket , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" )
4513+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
45034514 def testSingleCmsgTrunc1 (self ):
45044515 self .checkHopLimitTruncatedHeader (ancbufsize = 1 )
45054516
@@ -4509,6 +4520,7 @@ def _testSingleCmsgTrunc1(self):
45094520 self .sendToServer (MSG )
45104521
45114522 @requireAttrs (socket , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" )
4523+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
45124524 def testSingleCmsgTrunc2Int (self ):
45134525 self .checkHopLimitTruncatedHeader (ancbufsize = 2 * SIZEOF_INT )
45144526
@@ -4518,6 +4530,7 @@ def _testSingleCmsgTrunc2Int(self):
45184530 self .sendToServer (MSG )
45194531
45204532 @requireAttrs (socket , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" )
4533+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
45214534 def testSingleCmsgTruncLen0Minus1 (self ):
45224535 self .checkHopLimitTruncatedHeader (ancbufsize = socket .CMSG_LEN (0 ) - 1 )
45234536
@@ -4527,6 +4540,7 @@ def _testSingleCmsgTruncLen0Minus1(self):
45274540 self .sendToServer (MSG )
45284541
45294542 @requireAttrs (socket , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" )
4543+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
45304544 def testSingleCmsgTruncInData (self ):
45314545 # Test truncation of a control message inside its associated
45324546 # data. The message may be returned with its data truncated,
@@ -4599,6 +4613,7 @@ def _testSecondCmsgTrunc0(self):
45994613
46004614 @requireAttrs (socket , "CMSG_SPACE" , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" ,
46014615 "IPV6_RECVTCLASS" , "IPV6_TCLASS" )
4616+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
46024617 def testSecondCmsgTrunc1 (self ):
46034618 self .checkTruncatedSecondHeader (socket .CMSG_SPACE (SIZEOF_INT ) + 1 )
46044619
@@ -4609,6 +4624,7 @@ def _testSecondCmsgTrunc1(self):
46094624
46104625 @requireAttrs (socket , "CMSG_SPACE" , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" ,
46114626 "IPV6_RECVTCLASS" , "IPV6_TCLASS" )
4627+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
46124628 def testSecondCmsgTrunc2Int (self ):
46134629 self .checkTruncatedSecondHeader (socket .CMSG_SPACE (SIZEOF_INT ) +
46144630 2 * SIZEOF_INT )
@@ -4620,6 +4636,7 @@ def _testSecondCmsgTrunc2Int(self):
46204636
46214637 @requireAttrs (socket , "CMSG_SPACE" , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" ,
46224638 "IPV6_RECVTCLASS" , "IPV6_TCLASS" )
4639+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
46234640 def testSecondCmsgTruncLen0Minus1 (self ):
46244641 self .checkTruncatedSecondHeader (socket .CMSG_SPACE (SIZEOF_INT ) +
46254642 socket .CMSG_LEN (0 ) - 1 )
@@ -4631,6 +4648,7 @@ def _testSecondCmsgTruncLen0Minus1(self):
46314648
46324649 @requireAttrs (socket , "CMSG_SPACE" , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" ,
46334650 "IPV6_RECVTCLASS" , "IPV6_TCLASS" )
4651+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
46344652 def testSecondCmsgTruncInData (self ):
46354653 # Test truncation of the second of two control messages inside
46364654 # its associated data.
0 commit comments