5959# SCM_RIGHTS control message when several are sent in a single sendmsg().
6060BSD_COMBINES_SCM_RIGHTS = sys .platform .startswith (
6161 ("netbsd" , "openbsd" , "dragonfly" ))
62+ # OpenBSD and DragonFly fail recvmsg() with EMSGSIZE, instead of setting
63+ # MSG_CTRUNC, when the ancillary data buffer is too small for a cmsghdr.
64+ CMSG_TRUNC_RAISES_EMSGSIZE = sys .platform .startswith (("openbsd" , "dragonfly" ))
6265WSL = "microsoft-standard-WSL" in platform .release ()
6366
6467try :
@@ -4350,6 +4353,7 @@ def _testCmsgTrunc0(self):
43504353 # (but still too small) buffer sizes.
43514354
43524355 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4356+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
43534357 def testCmsgTrunc1 (self ):
43544358 self .checkTruncatedHeader (self .doRecvmsg (self .serv_sock , len (MSG ), 1 ))
43554359
@@ -4358,6 +4362,7 @@ def _testCmsgTrunc1(self):
43584362 self .createAndSendFDs (1 )
43594363
43604364 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4365+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
43614366 def testCmsgTrunc2Int (self ):
43624367 # The cmsghdr structure has at least three members, two of
43634368 # which are ints, so we still shouldn't see any ancillary
@@ -4370,6 +4375,7 @@ def _testCmsgTrunc2Int(self):
43704375 self .createAndSendFDs (1 )
43714376
43724377 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4378+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
43734379 def testCmsgTruncLen0Minus1 (self ):
43744380 self .checkTruncatedHeader (self .doRecvmsg (self .serv_sock , len (MSG ),
43754381 socket .CMSG_LEN (0 ) - 1 ))
@@ -4407,6 +4413,7 @@ def checkTruncatedArray(self, ancbuf, maxdata, mindata=0):
44074413 self .checkFDs (fds )
44084414
44094415 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4416+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
44104417 def testCmsgTruncLen0 (self ):
44114418 self .checkTruncatedArray (ancbuf = socket .CMSG_LEN (0 ), maxdata = 0 )
44124419
@@ -4415,6 +4422,7 @@ def _testCmsgTruncLen0(self):
44154422 self .createAndSendFDs (1 )
44164423
44174424 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4425+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
44184426 def testCmsgTruncLen0Plus1 (self ):
44194427 self .checkTruncatedArray (ancbuf = socket .CMSG_LEN (0 ) + 1 , maxdata = 1 )
44204428
@@ -4423,6 +4431,7 @@ def _testCmsgTruncLen0Plus1(self):
44234431 self .createAndSendFDs (2 )
44244432
44254433 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4434+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
44264435 def testCmsgTruncLen1 (self ):
44274436 self .checkTruncatedArray (ancbuf = socket .CMSG_LEN (SIZEOF_INT ),
44284437 maxdata = SIZEOF_INT )
@@ -4433,6 +4442,7 @@ def _testCmsgTruncLen1(self):
44334442
44344443
44354444 @skipForRefleakHuntinIf (sys .platform == "darwin" , "#80931" )
4445+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
44364446 def testCmsgTruncLen2Minus1 (self ):
44374447 self .checkTruncatedArray (ancbuf = socket .CMSG_LEN (2 * SIZEOF_INT ) - 1 ,
44384448 maxdata = (2 * SIZEOF_INT ) - 1 )
@@ -4705,6 +4715,7 @@ def _testSingleCmsgTrunc0(self):
47054715 # (but still too small) buffer sizes.
47064716
47074717 @requireAttrs (socket , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" )
4718+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
47084719 def testSingleCmsgTrunc1 (self ):
47094720 self .checkHopLimitTruncatedHeader (ancbufsize = 1 )
47104721
@@ -4714,6 +4725,7 @@ def _testSingleCmsgTrunc1(self):
47144725 self .sendToServer (MSG )
47154726
47164727 @requireAttrs (socket , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" )
4728+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
47174729 def testSingleCmsgTrunc2Int (self ):
47184730 self .checkHopLimitTruncatedHeader (ancbufsize = 2 * SIZEOF_INT )
47194731
@@ -4723,6 +4735,7 @@ def _testSingleCmsgTrunc2Int(self):
47234735 self .sendToServer (MSG )
47244736
47254737 @requireAttrs (socket , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" )
4738+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
47264739 def testSingleCmsgTruncLen0Minus1 (self ):
47274740 self .checkHopLimitTruncatedHeader (ancbufsize = socket .CMSG_LEN (0 ) - 1 )
47284741
@@ -4732,6 +4745,7 @@ def _testSingleCmsgTruncLen0Minus1(self):
47324745 self .sendToServer (MSG )
47334746
47344747 @requireAttrs (socket , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" )
4748+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
47354749 def testSingleCmsgTruncInData (self ):
47364750 # Test truncation of a control message inside its associated
47374751 # data. The message may be returned with its data truncated,
@@ -4804,6 +4818,7 @@ def _testSecondCmsgTrunc0(self):
48044818
48054819 @requireAttrs (socket , "CMSG_SPACE" , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" ,
48064820 "IPV6_RECVTCLASS" , "IPV6_TCLASS" )
4821+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
48074822 def testSecondCmsgTrunc1 (self ):
48084823 self .checkTruncatedSecondHeader (socket .CMSG_SPACE (SIZEOF_INT ) + 1 )
48094824
@@ -4814,6 +4829,7 @@ def _testSecondCmsgTrunc1(self):
48144829
48154830 @requireAttrs (socket , "CMSG_SPACE" , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" ,
48164831 "IPV6_RECVTCLASS" , "IPV6_TCLASS" )
4832+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
48174833 def testSecondCmsgTrunc2Int (self ):
48184834 self .checkTruncatedSecondHeader (socket .CMSG_SPACE (SIZEOF_INT ) +
48194835 2 * SIZEOF_INT )
@@ -4825,6 +4841,7 @@ def _testSecondCmsgTrunc2Int(self):
48254841
48264842 @requireAttrs (socket , "CMSG_SPACE" , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" ,
48274843 "IPV6_RECVTCLASS" , "IPV6_TCLASS" )
4844+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
48284845 def testSecondCmsgTruncLen0Minus1 (self ):
48294846 self .checkTruncatedSecondHeader (socket .CMSG_SPACE (SIZEOF_INT ) +
48304847 socket .CMSG_LEN (0 ) - 1 )
@@ -4836,6 +4853,7 @@ def _testSecondCmsgTruncLen0Minus1(self):
48364853
48374854 @requireAttrs (socket , "CMSG_SPACE" , "IPV6_RECVHOPLIMIT" , "IPV6_HOPLIMIT" ,
48384855 "IPV6_RECVTCLASS" , "IPV6_TCLASS" )
4856+ @unittest .skipIf (CMSG_TRUNC_RAISES_EMSGSIZE , "skipping, see gh-154240" )
48394857 def testSecondCmsgTruncInData (self ):
48404858 # Test truncation of the second of two control messages inside
48414859 # its associated data.
0 commit comments