@@ -1377,6 +1377,43 @@ impl Socket {
13771377 }
13781378 }
13791379
1380+ /// Get the value of the `IP_MULTICAST_ALL` option for this socket.
1381+ ///
1382+ /// For more information about this option, see [`set_multicast_all_v4`].
1383+ ///
1384+ /// [`set_multicast_all_v4`]: Socket::set_multicast_all_v4
1385+ #[ cfg( all( feature = "all" , target_os = "linux" ) ) ]
1386+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , target_os = "linux" ) ) ) ) ]
1387+ pub fn multicast_all_v4 ( & self ) -> io:: Result < bool > {
1388+ unsafe {
1389+ getsockopt :: < c_int > ( self . as_raw ( ) , sys:: IPPROTO_IP , libc:: IP_MULTICAST_ALL )
1390+ . map ( |all| all != 0 )
1391+ }
1392+ }
1393+
1394+ /// Set the value of the `IP_MULTICAST_ALL` option for this socket.
1395+ ///
1396+ /// This option can be used to modify the delivery policy of
1397+ /// multicast messages. The argument is a boolean
1398+ /// (defaults to true). If set to true, the socket will receive
1399+ /// messages from all the groups that have been joined
1400+ /// globally on the whole system. Otherwise, it will deliver
1401+ /// messages only from the groups that have been explicitly
1402+ /// joined (for example via the `IP_ADD_MEMBERSHIP` option) on
1403+ /// this particular socket.
1404+ #[ cfg( all( feature = "all" , target_os = "linux" ) ) ]
1405+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , target_os = "linux" ) ) ) ) ]
1406+ pub fn set_multicast_all_v4 ( & self , all : bool ) -> io:: Result < ( ) > {
1407+ unsafe {
1408+ setsockopt (
1409+ self . as_raw ( ) ,
1410+ sys:: IPPROTO_IP ,
1411+ libc:: IPV6_MULTICAST_ALL ,
1412+ all as c_int ,
1413+ )
1414+ }
1415+ }
1416+
13801417 /// Get the value of the `IP_MULTICAST_IF` option for this socket.
13811418 ///
13821419 /// For more information about this option, see [`set_multicast_if_v4`].
@@ -1659,6 +1696,43 @@ impl Socket {
16591696 }
16601697 }
16611698
1699+ /// Get the value of the `IPV6_MULTICAST_ALL` option for this socket.
1700+ ///
1701+ /// For more information about this option, see [`set_multicast_all_v6`].
1702+ ///
1703+ /// [`set_multicast_all_v6`]: Socket::set_multicast_all_v6
1704+ #[ cfg( all( feature = "all" , target_os = "linux" ) ) ]
1705+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , target_os = "linux" ) ) ) ) ]
1706+ pub fn multicast_all_v6 ( & self ) -> io:: Result < bool > {
1707+ unsafe {
1708+ getsockopt :: < c_int > ( self . as_raw ( ) , sys:: IPPROTO_IPV6 , libc:: IPV6_MULTICAST_ALL )
1709+ . map ( |all| all != 0 )
1710+ }
1711+ }
1712+
1713+ /// Set the value of the `IPV6_MULTICAST_ALL` option for this socket.
1714+ ///
1715+ /// This option can be used to modify the delivery policy of
1716+ /// multicast messages. The argument is a boolean
1717+ /// (defaults to true). If set to true, the socket will receive
1718+ /// messages from all the groups that have been joined
1719+ /// globally on the whole system. Otherwise, it will deliver
1720+ /// messages only from the groups that have been explicitly
1721+ /// joined (for example via the `IPV6_ADD_MEMBERSHIP` option) on
1722+ /// this particular socket.
1723+ #[ cfg( all( feature = "all" , target_os = "linux" ) ) ]
1724+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "all" , target_os = "linux" ) ) ) ) ]
1725+ pub fn set_multicast_all_v6 ( & self , all : bool ) -> io:: Result < ( ) > {
1726+ unsafe {
1727+ setsockopt (
1728+ self . as_raw ( ) ,
1729+ sys:: IPPROTO_IPV6 ,
1730+ libc:: IPV6_MULTICAST_ALL ,
1731+ all as c_int ,
1732+ )
1733+ }
1734+ }
1735+
16621736 /// Get the value of the `IPV6_MULTICAST_IF` option for this socket.
16631737 ///
16641738 /// For more information about this option, see [`set_multicast_if_v6`].
0 commit comments