@@ -1116,7 +1116,7 @@ pub enum ControlMessage<'a> {
1116
1116
#[ cfg_attr( docsrs, doc( cfg( feature = "net" ) ) ) ]
1117
1117
UdpGsoSegments ( & ' a u16 ) ,
1118
1118
1119
- /// Configure the sending addressing and interface for v4
1119
+ /// Configure the sending addressing and interface for v4.
1120
1120
///
1121
1121
/// For further information, please refer to the
1122
1122
/// [`ip(7)`](https://man7.org/linux/man-pages/man7/ip.7.html) man page.
@@ -1129,7 +1129,7 @@ pub enum ControlMessage<'a> {
1129
1129
#[ cfg_attr( docsrs, doc( cfg( feature = "net" ) ) ) ]
1130
1130
Ipv4PacketInfo ( & ' a libc:: in_pktinfo) ,
1131
1131
1132
- /// Configure the sending addressing and interface for v6
1132
+ /// Configure the sending addressing and interface for v6.
1133
1133
///
1134
1134
/// For further information, please refer to the
1135
1135
/// [`ipv6(7)`](https://man7.org/linux/man-pages/man7/ipv6.7.html) man page.
@@ -1154,6 +1154,17 @@ pub enum ControlMessage<'a> {
1154
1154
#[ cfg_attr( docsrs, doc( cfg( feature = "net" ) ) ) ]
1155
1155
Ipv4SendSrcAddr ( & ' a libc:: in_addr) ,
1156
1156
1157
+ /// Configure the hop limit for v6 multicast traffic.
1158
+ ///
1159
+ /// Set the IPv6 hop limit for this message. The argument is an integer
1160
+ /// between 0 and 255. A value of -1 will set the hop limit to the route
1161
+ /// default if possible on the interface. Without this cmsg, packets sent
1162
+ /// with sendmsg have a hop limit of 1 and will not leave the local network.
1163
+ /// For further information, please refer to the
1164
+ /// [`ipv6(7)`](https://man7.org/linux/man-pages/man7/ipv6.7.html) man page.
1165
+ #[ cfg( any( target_os = "linux" ) ) ]
1166
+ Ipv6HopLimit ( & ' a libc:: c_int) ,
1167
+
1157
1168
/// SO_RXQ_OVFL indicates that an unsigned 32 bit value
1158
1169
/// ancilliary msg (cmsg) should be attached to recieved
1159
1170
/// skbs indicating the number of packets dropped by the
@@ -1267,6 +1278,8 @@ impl<'a> ControlMessage<'a> {
1267
1278
target_os = "openbsd" , target_os = "dragonfly" ) ) ]
1268
1279
#[ cfg( feature = "net" ) ]
1269
1280
ControlMessage :: Ipv4SendSrcAddr ( addr) => addr as * const _ as * const u8 ,
1281
+ #[ cfg( any( target_os = "linux" ) ) ]
1282
+ ControlMessage :: Ipv6HopLimit ( limit) => limit as * const _ as * const u8 ,
1270
1283
#[ cfg( any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" ) ) ]
1271
1284
ControlMessage :: RxqOvfl ( drop_count) => {
1272
1285
drop_count as * const _ as * const u8
@@ -1330,6 +1343,10 @@ impl<'a> ControlMessage<'a> {
1330
1343
target_os = "openbsd" , target_os = "dragonfly" ) ) ]
1331
1344
#[ cfg( feature = "net" ) ]
1332
1345
ControlMessage :: Ipv4SendSrcAddr ( addr) => mem:: size_of_val( addr) ,
1346
+ #[ cfg( any( target_os = "linux" ) ) ]
1347
+ ControlMessage :: Ipv6HopLimit ( limit) => {
1348
+ mem:: size_of_val( limit)
1349
+ } ,
1333
1350
#[ cfg( any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" ) ) ]
1334
1351
ControlMessage :: RxqOvfl ( drop_count) => {
1335
1352
mem:: size_of_val( drop_count)
@@ -1369,6 +1386,9 @@ impl<'a> ControlMessage<'a> {
1369
1386
target_os = "openbsd" , target_os = "dragonfly" ) ) ]
1370
1387
#[ cfg( feature = "net" ) ]
1371
1388
ControlMessage :: Ipv4SendSrcAddr ( _) => libc:: IPPROTO_IP ,
1389
+ #[ cfg( any( target_os = "linux" ) ) ]
1390
+ #[ cfg( feature = "net" ) ]
1391
+ ControlMessage :: Ipv6HopLimit ( _) => libc:: IPPROTO_IPV6 ,
1372
1392
#[ cfg( any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" ) ) ]
1373
1393
ControlMessage :: RxqOvfl ( _) => libc:: SOL_SOCKET ,
1374
1394
#[ cfg( target_os = "linux" ) ]
@@ -1415,6 +1435,8 @@ impl<'a> ControlMessage<'a> {
1415
1435
target_os = "openbsd" , target_os = "dragonfly" ) ) ]
1416
1436
#[ cfg( feature = "net" ) ]
1417
1437
ControlMessage :: Ipv4SendSrcAddr ( _) => libc:: IP_SENDSRCADDR ,
1438
+ #[ cfg( any( target_os = "linux" ) ) ]
1439
+ ControlMessage :: Ipv6HopLimit ( _) => libc:: IPV6_HOPLIMIT ,
1418
1440
#[ cfg( any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" ) ) ]
1419
1441
ControlMessage :: RxqOvfl ( _) => {
1420
1442
libc:: SO_RXQ_OVFL
@@ -2240,13 +2262,7 @@ pub fn recvfrom<T: SockaddrLike>(
2240
2262
& mut len as * mut socklen_t ,
2241
2263
) ) ? as usize ;
2242
2264
2243
- Ok ( (
2244
- ret,
2245
- T :: from_raw (
2246
- addr. assume_init ( ) . as_ptr ( ) ,
2247
- Some ( len) ,
2248
- ) ,
2249
- ) )
2265
+ Ok ( ( ret, T :: from_raw ( addr. assume_init ( ) . as_ptr ( ) , Some ( len) ) ) )
2250
2266
}
2251
2267
}
2252
2268
0 commit comments