File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ Added TCP_INFO for ` getsockopt `
Original file line number Diff line number Diff line change @@ -1308,6 +1308,15 @@ sockopt_impl!(
13081308 libc:: SO_ATTACH_REUSEPORT_CBPF ,
13091309 libc:: sock_fprog
13101310) ;
1311+ #[ cfg( target_os = "linux" ) ]
1312+ sockopt_impl ! (
1313+ /// Used to collect information about this socket.
1314+ TcpInfo ,
1315+ GetOnly ,
1316+ libc:: SOL_TCP ,
1317+ libc:: TCP_INFO ,
1318+ libc:: tcp_info
1319+ ) ;
13111320
13121321#[ allow( missing_docs) ]
13131322// Not documented by Linux!
Original file line number Diff line number Diff line change @@ -1270,3 +1270,16 @@ pub fn test_so_attach_reuseport_cbpf() {
12701270 assert_eq ! ( e, nix:: errno:: Errno :: ENOPROTOOPT ) ;
12711271 } ) ;
12721272}
1273+
1274+ #[ cfg( target_os = "linux" ) ]
1275+ #[ test]
1276+ pub fn test_so_tcp_info ( ) {
1277+ let fd = socket (
1278+ AddressFamily :: Inet6 ,
1279+ SockType :: Stream ,
1280+ SockFlag :: empty ( ) ,
1281+ SockProtocol :: Tcp ,
1282+ )
1283+ . unwrap ( ) ;
1284+ getsockopt ( & fd, sockopt:: TcpInfo ) . unwrap ( ) ;
1285+ }
You can’t perform that action at this time.
0 commit comments